Re: [PATCH v4 OPT2] driver core: Fix use-after-free and double free on glue directory

2019-07-03 Thread Benjamin Herrenschmidt
On Thu, 2019-07-04 at 07:40 +0200, Greg KH wrote: > On Thu, Jul 04, 2019 at 08:57:13AM +1000, Benjamin Herrenschmidt > wrote: > > On Wed, 2019-07-03 at 21:36 +0200, Greg KH wrote: > > > > > > > -static struct kobject *get_device_parent(struct device *dev, > > > > -

Re: [PATCH v4 OPT2] driver core: Fix use-after-free and double free on glue directory

2019-07-03 Thread Greg KH
On Thu, Jul 04, 2019 at 08:57:13AM +1000, Benjamin Herrenschmidt wrote: > On Wed, 2019-07-03 at 21:36 +0200, Greg KH wrote: > > > > > -static struct kobject *get_device_parent(struct device *dev, > > > - struct device *parent) > > > +/** > > > + * __get_device_pare

Re: [PATCH v4 OPT2] driver core: Fix use-after-free and double free on glue directory

2019-07-03 Thread Benjamin Herrenschmidt
On Wed, 2019-07-03 at 21:36 +0200, Greg KH wrote: > > > -static struct kobject *get_device_parent(struct device *dev, > > -struct device *parent) > > +/** > > + * __get_device_parent() - Get the parent device kobject. > > + * @dev: Pointer to the device structur

Re: [PATCH v4 OPT2] driver core: Fix use-after-free and double free on glue directory

2019-07-03 Thread Greg KH
On Wed, Jun 26, 2019 at 10:40:21PM +0800, Muchun Song wrote: > There is a race condition between removing glue directory and adding a new > device under the glue directory. It can be reproduced in following test: > > path 1: Add the child device under glue dir > device_add() > get_device_paren

[PATCH v4 OPT2] driver core: Fix use-after-free and double free on glue directory

2019-06-26 Thread Muchun Song
There is a race condition between removing glue directory and adding a new device under the glue directory. It can be reproduced in following test: path 1: Add the child device under glue dir device_add() get_device_parent() mutex_lock(&gdp_mutex); /*find parent fr