[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140425151327.GF2206@localhost>
Date: Fri, 25 Apr 2014 17:13:27 +0200
From: Johan Hovold <jhovold@...il.com>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Li Zhong <zhong@...ux.vnet.ibm.com>, Tejun Heo <tj@...nel.org>,
Johan Hovold <jhovold@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
rafael.j.wysocki@...el.com
Subject: Re: [PATCH] USB: serial: fix sysfs-attribute removal deadlock
On Fri, Apr 25, 2014 at 09:54:33AM -0400, Alan Stern wrote:
> On Fri, 25 Apr 2014, Li Zhong wrote:
>
> > > I don't get why try_module_get() matters here. We can't call into
> > > ->store if the object at hand is already destroyed and the underlying
> > > module can't go away if the target device is still alive.
> > > try_module_get() doesn't actually protect the object. Why does that
> > > matter? This is self removal, right? Can you please take a look at
> > > kernfs_remove_self()?
> >
> > This is about one process writing something to driver attributes, and
> > one process trying to unload this driver.
> >
> > I think try_module_get() could detect whether the driver is being
> > unloaded, and if not, prevent it from being unloaded, so it could
> > protect the object here by not allow the driver to be unloaded.
>
> That isn't how try_module_get() works. If the module is being
> unloaded, try_module_get() simply fails. It does not prevent the
> module from being unloaded -- that's why its name begins with "try".
Well, to be fair, if the try_module_get() *succeeds* it will prevent the
module from being unloaded (and otherwise the sysfs operation bails
out).
Johan
--
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