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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 27 Sep 2011 10:08:24 +0200
From:	Manohar Vanga <manohar.vanga@...n.ch>
To:	"Emilio G. Cota" <cota@...ap.org>
CC:	<gregkh@...e.de>, <martyn.welch@...com>,
	<devel@...verdev.osuosl.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/4] staging: vme: make match() driver specific to
 improve non-VME64x support

> > diff --git a/drivers/staging/vme/vme.c b/drivers/staging/vme/vme.c
> > index 76e08f3..9cb6938 100644
> > --- a/drivers/staging/vme/vme.c
> > +++ b/drivers/staging/vme/vme.c
> > @@ -1317,6 +1317,7 @@ static int vme_add_bus(struct vme_bridge *bridge)
> >  		if ((vme_bus_numbers & (1 << i)) == 0) {
> >  			vme_bus_numbers |= (1 << i);
> >  			bridge->num = i;
> > +			INIT_LIST_HEAD(&bridge->devices);
> >  			list_add_tail(&bridge->bus_list, &vme_bus_list);
> 
> Just realised that vme_buses_lock also protects vme_bus_list; appending
> to this list here should be protected by the mutex, otherwise
> vme_add_bus (ie this function) could race with __vme_register_driver,
> which might access a corrupt copy of the list.
> 
> Note that vme_remove_bus does the right thing though; it acquires
> the lock before unpinning the bridge from vme_bus_list.

It _does_ acquire the lock. The patch here doesn't show it:

	mutex_lock(&vme_buses_lock);
	for (i = 0; i < sizeof(vme_bus_numbers) * 8; i++) {
		if ((vme_bus_numbers & (1 << i)) == 0) {
			vme_bus_numbers |= (1 << i);
			bridge->num = i;
			INIT_LIST_HEAD(&bridge->devices);
			list_add_tail(&bridge->bus_list, &vme_bus_list);
			ret = 0;
			break;
		}
	}
	mutex_unlock(&vme_buses_lock);

This was submitted and acknowledged by Martyn in a previous patch:
	https://lkml.org/lkml/2011/8/12/107

Thanks!

-- 
/manohar
--
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