[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFy4SvRc_4VwV9AD8Fpc5zKPPBdbzGYFej6LHBb1prK6=g@mail.gmail.com>
Date: Fri, 12 Apr 2013 17:11:30 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Anatol Pomozov <anatol.pomozov@...il.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Salman Qazi <sqazi@...gle.com>,
Rusty Russell <rusty@...tcorp.com.au>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] module: Fix race condition between load and unload module
On Fri, Apr 12, 2013 at 4:53 PM, Greg Kroah-Hartman
<gregkh@...uxfoundation.org> 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.
Linus
--
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