[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [dm-devel] kobject: provide kobject_put_wait to fix module unload race



On Tue, Jan 07 2014 at  3:16pm -0500,
Mikulas Patocka <mpatocka redhat com> wrote:

> On Tue, 7 Jan 2014, Mike Snitzer wrote:
> 
> > I've staged your patch in linux-next for 3.14, see:
> > http://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=af7b1e5c767fc895788c971c8f4686402ac8344f
> 
> Looking at this patch, I realize that it is buggy too. If module unload 
> happens at this point (after the completion is signaled, but before the 
> release function returns), it crashes.
> 
> static void dm_kobject_release(struct kobject *kobj)
> {
> 	complete(dm_get_completion_from_kobject(kobj));
> 	>========== module unload here ===============<
> }

That race isn't a surprise, thought you pointed it out earlier in this
thread?  Anyway, I'm inclined to keep the racey patch staged in
linux-dm.git until the stalemate with gregkh is resolved.  DM is no
worse than other code that follows this same wait for completion
pattern.

> The patch that I sent initially in this thread doesn't have this bug 
> because the completion is signaled in non-module code.
> 
> That goes back to my initial claim - it is impossible to use the kobject 
> interface correctly! But if Greg doesn't want a patch that fixes the 
> kobject interface, I don't really know what to do about it.

Right, I'm missing what is wrong with your proposed kobject_put_wait
interface.

Greg, can you please establish that you understand the problem, and
existing kobject patterns, before you dismiss a fix?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]