lib/idr.c: fix rcu related race with idr_find

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6ff2d39b91aec3dcae951afa982059e3dd9b49dc
Commit:     6ff2d39b91aec3dcae951afa982059e3dd9b49dc
Parent:     1d678f365dae28420fa7329a2a35390b3582678d
Author:     Manfred Spraul <manfred <at> colorfullife.com>
AuthorDate: Mon Dec 1 13:14:02 2008 -0800
Committer:  Linus Torvalds <torvalds <at> linux-foundation.org>
CommitDate: Mon Dec 1 19:55:25 2008 -0800

    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 <at> colorfullife.com>
    Cc: Clement Calmels <cboulte <at> gmail.com>
    Cc: Nadia Derbey <Nadia.Derbey <at> bull.net>
    Cc: Pierre Peiffer <peifferp <at> gmail.com>
    Cc: <stable <at> kernel.org>
    Signed-off-by: Andrew Morton <akpm <at> linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds <at> linux-foundation.org>
---
 include/linux/idr.h |    3 ++-
 lib/idr.c           |   14 ++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
(Continue reading)


Gmane