From 7f70893173b056df691b2ee7546bb44fd9abae6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20H=2E=20Sch=C3=B6nherr?= Date: Tue, 19 Jul 2011 21:10:26 +0200 Subject: [PATCH] rcu: Fix wrong check in list_splice_init_rcu() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Paul E. McKenney --- include/linux/rculist.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/rculist.h b/include/linux/rculist.h index e3beb315517a..d079290843a9 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. */ -- 2.30.2