[lkml]   [2013]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] module: Fix race condition between load and unload module
On Fri, Apr 12, 2013 at 4:53 PM, Greg Kroah-Hartman
<> wrote:
> Linus, I think your patch will reduce the window the race could happen,
> but it should still be there, although testing with it would be
> interesting to see if the original problem can be triggered with it.

Well, with my patch, there's no way you'll ever look up an object with
a zero refcount, so you'll never release it twice. The atomic
operations (atomic_inc_nonzero()) do guarantee that.

The "kset->list_lock" means that the list traversal is safe too.

So one particular race is definitely gone.

Now, what people who call "kset_find_obj()" really expect when not
locked against the last kobject_put(), I don't know. But at least it's
conceptually safe now. They'll either get NULL (either because the
object doesn't exist on the list, or because it does exist but is
about to be removed), or they will get a valid object that has *not*
started to be torn down yet.


 \ /
  Last update: 2013-04-13 02:41    [W:0.079 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site