Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu: Fix wrong check in list_splice_init_rcu()

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>

authored by

Jan H. Schönherr and committed by
Paul E. McKenney
7f708931 cefcb602

+1 -1
+1 -1
include/linux/rculist.h
··· 183 183 struct list_head *last = list->prev; 184 184 struct list_head *at = head->next; 185 185 186 - if (list_empty(head)) 186 + if (list_empty(list)) 187 187 return; 188 188 189 189 /* "first" and "last" tracking list, so initialize it. */