mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] llist: Make llist_del_first return only the first node
@ 2024-02-02 11:50 liqiang
  0 siblings, 0 replies; only message in thread
From: liqiang @ 2024-02-02 11:50 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

Set the next of the returned node of llist_del_first
to NULL, which can prevent subsequent nodes in llist
from being exposed, and is more consistent with the
logic of this interface.

Signed-off-by: liqiang <liqiang64@huawei.com>
---
 lib/llist.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/llist.c b/lib/llist.c
index f21d0cf..c33fff5 100644
--- a/lib/llist.c
+++ b/lib/llist.c
@@ -61,6 +61,7 @@ struct llist_node *llist_del_first(struct llist_head *head)
 		next = READ_ONCE(entry->next);
 	} while (!try_cmpxchg(&head->first, &entry, next));
 
+	entry->next = NULL;
 	return entry;
 }
 EXPORT_SYMBOL_GPL(llist_del_first);
-- 
2.23.0.windows.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-02 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 11:50 [PATCH] llist: Make llist_del_first return only the first node liqiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®