[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20140107223220.GA20588@redhat.com>
Date: Tue, 7 Jan 2014 17:32:20 -0500
From: Mike Snitzer <snitzer@...hat.com>
To: Mikulas Patocka <mpatocka@...hat.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Bart Van Assche <bvanassche@....org>,
Jeff Mahoney <jeffm@...e.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
device-mapper development <dm-devel@...hat.com>,
Thomas Gleixner <tglx@...utronix.de>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: kobject: provide kobject_put_wait to fix module unload race
On Tue, Jan 07 2014 at 3:16pm -0500,
Mikulas Patocka <mpatocka@...hat.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?
--
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