Skip to content

Commit 605963b

Browse files
braunergregkh
authored andcommitted
eventpoll: use hlist_is_singular_node() in __ep_remove()
[ Upstream commit 3d9fd0a ] 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> Stable-dep-of: a6dc643 ("eventpoll: fix ep_remove struct eventpoll / struct file UAF") Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Signed-off-by: Wentao Guan <guanwentao@uniontech.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ac27593 commit 605963b

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
@@ -745,7 +745,7 @@ static bool __ep_remove(struct eventpoll *ep, struct epitem *epi, bool force)
745745

746746
to_free = NULL;
747747
head = file->f_ep;
748-
if (head->first == &epi->fllink && !epi->fllink.next) {
748+
if (hlist_is_singular_node(&epi->fllink, head)) {
749749
/* See eventpoll_release() for details. */
750750
WRITE_ONCE(file->f_ep, NULL);
751751
if (!is_file_epoll(file)) {

0 commit comments

Comments
 (0)