Messages in this thread | | | Date | Tue, 4 Nov 2014 14:15:35 -0500 | From | Tejun Heo <> | Subject | Re: Subject: [PATCH] kobject: fix the race between kobject_del and get_device_parent |
| |
Hello,
Sorry about the delay.
On Wed, Oct 22, 2014 at 04:07:44PM +0800, Weng Meiling wrote: > diff --git a/drivers/base/core.c b/drivers/base/core.c > index 28b808c..645eacf 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -724,12 +724,12 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj) > return &dir->kobj; > } > > +static DEFINE_MUTEX(gdp_mutex); > > static struct kobject *get_device_parent(struct device *dev, > struct device *parent) > { > if (dev->class) { > - static DEFINE_MUTEX(gdp_mutex); > struct kobject *kobj = NULL; > struct kobject *parent_kobj; > struct kobject *k; > @@ -793,7 +793,9 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) > glue_dir->kset != &dev->class->p->glue_dirs) > return; > > + mutex_lock(&gdp_mutex); > kobject_put(glue_dir); > + mutex_unlock(&gdp_mutex);
So, yeah, this looks like a correct approach; however, do we even need to clear the glue directories? What's the downside of just keeping them around once created?
Thanks.
-- tejun
| |