[lkml]   [2011]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH] rcu: Fix wrong check in list_splice_init_rcu()

    If I don't miss something obvious, the following patch would
    be a good idea.

    There are currently two users of list_splice_init_rcu(): IPMI and btrfs.
    For these, list_splice_init_rcu() is currently a NOP.

    If I interpret the code correctly, this fixes a memory leak for
    IPMI and something probably worse for btrfs.

    The call from within btrfs was introduced only after v2.6.39 with commit
    1f78160 ("Btrfs: using rcu lock in the reader side of devices list") by
    converting a list_splice_init() call.

    Therefore, this patch might be a candidate for v3.0.


    From: Jan H. Schönherr <>

    Splicing something into an empty list should work, while there is
    nothing to do if the source list is empty.

    Signed-off-by: Jan H. Schönherr <>
    include/linux/rculist.h | 2 +-
    1 files changed, 1 insertions(+), 1 deletions(-)

    diff --git a/include/linux/rculist.h b/include/linux/rculist.h
    index e3beb31..d079290 100644
    --- a/include/linux/rculist.h
    +++ b/include/linux/rculist.h
    @@ -183,7 +183,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
    struct list_head *last = list->prev;
    struct list_head *at = head->next;

    - if (list_empty(head))
    + if (list_empty(list))

    /* "first" and "last" tracking list, so initialize it. */
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2011-07-19 21:13    [W:0.022 / U:5.272 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site