lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090805101327.2c49cc62.akpm@linux-foundation.org>
Date:	Wed, 5 Aug 2009 10:13:27 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Jiri Pirko <jpirko@...hat.com>
Cc:	Ingo Molnar <mingo@...e.hu>, David Miller <davem@...emloft.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	torvalds@...ux-foundation.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: Fix spinlock use in alloc_netdev_mq()

On Wed, 5 Aug 2009 10:47:47 +0200 Jiri Pirko <jpirko@...hat.com> wrote:

> >it's using an zero-initialized spinlock. This is a side-effect of:
> >
> >        dev_unicast_init(dev);
> >
> >in alloc_netdev_mq() making use of dev->addr_list_lock.
> >
> >The device has just been allocated freshly, it's not accessible
> >anywhere yet so no locking is needed at all - in fact it's wrong
> >to lock it here (the lock isnt initialized yet).
> 
> Yes this looks like the right approach. Sorry for this bug :(

Really?

> >--- a/net/core/dev.c
> >+++ b/net/core/dev.c
> >@@ -4007,9 +4007,7 @@ static void dev_unicast_flush(struct net_device *dev)
> > 
> > static void dev_unicast_init(struct net_device *dev)
> > {
> >-	netif_addr_lock_bh(dev);
> > 	__hw_addr_init(&dev->uc);
> >-	netif_addr_unlock_bh(dev);
> > }

This means that the net_device is still floating around for quite a
long time with an uninitialised spinlock, so it will be quite easy for
the same problem to reoccur as the code evolves.

It would be more robust were we to initialise that lock close to the
netdev's allocation site.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ