[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20130414045650.GG4068@ZenIV.linux.org.uk>
Date: Sun, 14 Apr 2013 05:56:50 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Anatol Pomozov <anatol.pomozov@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Salman Qazi <sqazi@...gle.com>,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] module: Fix race condition between load and unload module
On Sat, Apr 13, 2013 at 09:42:06PM -0700, Anatol Pomozov wrote:
> > in kobject_cleanup(). Why don't we require kobject_del() before the final
> > kobject_put(), if the sucker had been added? FWIW, I thought it *was*
> > required all along...
>
> But kobject_release/kobject_cleanup function is called as a result of
> atomic decrement_compare. Until we perform the atomic operation we
> don't know whether it is final kobject_put() or not.
>
> kobject_put() {
> if (atomic_sub_and_test(kobj->kref->refcount)) {
> // refcounter is decremented to 0 so cleanup sysfs
> kobject_release(kobj)
> }
> }
Yes, of course, but WTF do we play with kobject_del() on that path at all?
Let the caller do it when it decides that object shouldn't be possible to
see anymore. Which is not the same thing as "the last reference is gone"...
Sigh... kobject model sucks, film at 11... ;-/
--
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