projects/linux·commit 7f708931

rcu: Fix wrong check in list_splice_init_rcu()

7f708931 · Jan H. Schönherr <[email protected]> · 2011-07-19 21:10:26 +02:00

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 <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
Commit
7f70893173b056df691b2ee7546bb44fd9abae6a
Parents
cefcb602

Changes

1 files changed · +1 −1

FileStatusAddDelContent
include/linux/rculist.hmodified+1−1View file

include/linux/rculist.h

View file
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))
return;
/* "first" and "last" tracking list, so initialize it. */