Skip to content

Commit 3d9fd0a

Browse files
committed
eventpoll: use hlist_is_singular_node() in __ep_remove()
Replace the open-coded "epi is the only entry in file->f_ep" check with hlist_is_singular_node(). Same semantics, and the helper avoids the head-cacheline access in the common false case. Link: https://patch.msgid.link/20260423-work-epoll-uaf-v1-1-2470f9eec0f5@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
1 parent 9a46638 commit 3d9fd0a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/eventpoll.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static bool __ep_remove(struct eventpoll *ep, struct epitem *epi, bool force)
856856

857857
to_free = NULL;
858858
head = file->f_ep;
859-
if (head->first == &epi->fllink && !epi->fllink.next) {
859+
if (hlist_is_singular_node(&epi->fllink, head)) {
860860
/* See eventpoll_release() for details. */
861861
WRITE_ONCE(file->f_ep, NULL);
862862
if (!is_file_epoll(file)) {

0 commit comments

Comments
 (0)