]> git.baikalelectronics.ru Git - kernel.git/commit
lib/idr.c: fix rcu related race with idr_find
authorManfred Spraul <manfred@colorfullife.com>
Mon, 1 Dec 2008 21:14:02 +0000 (13:14 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 2 Dec 2008 03:55:25 +0000 (19:55 -0800)
commitd1779719f0aaf7df17d0c6695b2ba632b1910258
tree8d480975d95adf85f3a87dd478e36e4ac0b0edd0
parent7a5edfacb9743a0a17dd2d9b67cd137997b8e305
lib/idr.c: fix rcu related race with idr_find

2nd part of the fixes needed for
http://bugzilla.kernel.org/show_bug.cgi?id=11796.

When the idr tree is either grown or shrunk, then the update to the number
of layers and the top pointer were not atomic.  This race caused crashes.

The attached patch fixes that by replicating the layers counter in each
layer, thus idr_find doesn't need idp->layers anymore.

Signed-off-by: Manfred Spraul <manfred@colorfullife.com>
Cc: Clement Calmels <cboulte@gmail.com>
Cc: Nadia Derbey <Nadia.Derbey@bull.net>
Cc: Pierre Peiffer <peifferp@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/idr.h
lib/idr.c