Skip to content

Commit

Permalink
rcu: Fix wrong check in list_splice_init_rcu()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jan H. Schönherr authored and Paul E. McKenney committed Jul 20, 2011
1 parent cefcb60 commit 7f70893
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/rculist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit 7f70893

Please sign in to comment.