]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
rcu: Fix wrong check in list_splice_init_rcu()
authorJan H. Schönherr <schnhrr@cs.tu-berlin.de>
Tue, 19 Jul 2011 19:10:26 +0000 (21:10 +0200)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 1 Aug 2011 08:36:59 +0000 (01:36 -0700)
If the list to be spliced is empty, then list_splice_init_rcu() has
nothing to do.  Unfortunately, list_splice_init_rcu() does not check
the list to be spliced; it instead checks the list to be spliced into.
This results in memory leaks given current usage.  This commit
therefore fixes the empty-list check.

Signed-off-by: Jan H. Schönherr <schnhrr@cs.tu-berlin.de>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
include/linux/rculist.h

index e3beb315517a7a06dea6db0b2d0c8c9aee7ce9e4..d079290843a93f9b508f9d05cd9489ea263dc380 100644 (file)
@@ -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))
                return;
 
        /* "first" and "last" tracking list, so initialize it. */