Skip to content

Commit d058696

Browse files
brauneropsiff
authored andcommitted
eventpoll: rename ep_remove_safe() back to ep_remove()
mainline inclusion from mainline-v7.1-rc1 category: bugfix CVE: CVE-2026-46242 The current name is just confusing and doesn't clarify anything. Link: https://patch.msgid.link/20260423-work-epoll-uaf-v1-4-2470f9eec0f5@kernel.org Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> (cherry picked from commit 0bade234723e40e4937be912e105785d6a51464e) Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
1 parent efea042 commit d058696

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

fs/eventpoll.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static bool ep_remove_epi(struct eventpoll *ep, struct epitem *epi)
770770
/*
771771
* ep_remove variant for callers owing an additional reference to the ep
772772
*/
773-
static void ep_remove_safe(struct eventpoll *ep, struct epitem *epi)
773+
static void ep_remove(struct eventpoll *ep, struct epitem *epi)
774774
{
775775
struct file *file = epi->ffd.file;
776776

@@ -817,7 +817,7 @@ static void ep_clear_and_put(struct eventpoll *ep)
817817

818818
/*
819819
* Walks through the whole tree and try to free each "struct epitem".
820-
* Note that ep_remove_safe() will not remove the epitem in case of a
820+
* Note that ep_remove() will not remove the epitem in case of a
821821
* racing eventpoll_release_file(); the latter will do the removal.
822822
* At this point we are sure no poll callbacks will be lingering around.
823823
* Since we still own a reference to the eventpoll struct, the loop can't
@@ -826,7 +826,7 @@ static void ep_clear_and_put(struct eventpoll *ep)
826826
for (rbp = rb_first_cached(&ep->rbr); rbp; rbp = next) {
827827
next = rb_next(rbp);
828828
epi = rb_entry(rbp, struct epitem, rbn);
829-
ep_remove_safe(ep, epi);
829+
ep_remove(ep, epi);
830830
cond_resched();
831831
}
832832

@@ -1496,21 +1496,21 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
14961496
mutex_unlock(&tep->mtx);
14971497

14981498
/*
1499-
* ep_remove_safe() calls in the later error paths can't lead to
1499+
* ep_remove() calls in the later error paths can't lead to
15001500
* ep_free() as the ep file itself still holds an ep reference.
15011501
*/
15021502
ep_get(ep);
15031503

15041504
/* now check if we've created too many backpaths */
15051505
if (unlikely(full_check && reverse_path_check())) {
1506-
ep_remove_safe(ep, epi);
1506+
ep_remove(ep, epi);
15071507
return -EINVAL;
15081508
}
15091509

15101510
if (epi->event.events & EPOLLWAKEUP) {
15111511
error = ep_create_wakeup_source(epi);
15121512
if (error) {
1513-
ep_remove_safe(ep, epi);
1513+
ep_remove(ep, epi);
15141514
return error;
15151515
}
15161516
}
@@ -1534,7 +1534,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
15341534
* high memory pressure.
15351535
*/
15361536
if (unlikely(!epq.epi)) {
1537-
ep_remove_safe(ep, epi);
1537+
ep_remove(ep, epi);
15381538
return -ENOMEM;
15391539
}
15401540

@@ -2226,7 +2226,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
22262226
* The eventpoll itself is still alive: the refcount
22272227
* can't go to zero here.
22282228
*/
2229-
ep_remove_safe(ep, epi);
2229+
ep_remove(ep, epi);
22302230
error = 0;
22312231
} else {
22322232
error = -ENOENT;

0 commit comments

Comments
 (0)