Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752619AbaKDTPk (ORCPT ); Tue, 4 Nov 2014 14:15:40 -0500 Received: from mail-qc0-f174.google.com ([209.85.216.174]:55445 "EHLO mail-qc0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751325AbaKDTPj (ORCPT ); Tue, 4 Nov 2014 14:15:39 -0500 Date: Tue, 4 Nov 2014 14:15:35 -0500 From: Tejun Heo To: Weng Meiling Cc: Greg KH , Frans Klaver , Jens Axboe , akpm@linux-foundation.org, adilger.kernel@dilger.ca, Jan Kara , "linux-kernel@vger.kernel.org" , Xiang Rui , Li Zefan , Huang Qiang , Zhao Hongjiang , Wangyijing Subject: Re: Subject: [PATCH] kobject: fix the race between kobject_del and get_device_parent Message-ID: <20141104191535.GI14459@htj.dyndns.org> References: <543E1754.8040701@huawei.com> <543F25D3.8010708@huawei.com> <543F7289.8010807@huawei.com> <20141016091328.GB24374@kroah.com> <544765D0.70302@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <544765D0.70302@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/