From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B23F44AC143; Tue, 8 Sep 2026 08:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788857516; cv=none; b=IlQFjb58UZV4RZfrIftZkwbjUAbs1jTpuH3z/dbYSmjtUP5dXYU5J3+vmvWO15O/ik5B6GVuEOJS6fgtC2f++a6dC0siWYRxwALTmESebY9NsRATelpCjC1PvGVEL6xUwTKeBEJ+Zyc6cJtzCZiSX0Eg2KBNNXmXe80DrimFmwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788857516; c=relaxed/simple; bh=ZD7IcCJBs10eYQbTyHaHhiTBNML6END1vAJ2cSz1t9E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dBPccAWDF7oKZXiYI5oYXxyqlX11c817+vtHQSbM3PQAznieOe7t/hVVDDFihDVZmWfCQUxyDd7ZRfY3SL0nrfmPZ6Fy6RUrPrF5quEn+ZI1SbegxoP3YkRqkWF95EGWptfJPRVx8CiIYEo4t+3PqPPo6eYpscimPiYfMTL8FaY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=nRn+Y1Rx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nRn+Y1Rx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF741F00A3D; Tue, 8 Sep 2026 08:51:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788857504; bh=FcdyV9kRp09A/hxWyXgKMi9GMn+VqAj0OfpSLnJaOHg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=nRn+Y1Rx2OONd/IdjHwety/EXh1y8KJoIG7ILExxza/DRufEwmeY7692YpuuXvUeX 9zE2q6CMzCxdCHfFs5BtmloEfMyG/1jLJ3xYAvcYFVWYywD+vdF/261IYh23uAXacg 87bg2sZCTeEra7hkWaBdm76KBV/Z26bOqqUDy1Dx6Thr+sSe5DHoxvfwr/zr9nx/O/ 4+bbcPl3Qkpl/1XyuuJZoPh8G7frWLAkObxzRwOc3mZNa4Ycvv80rbg/QlzDNvx/Sl NN9VqxNAq0jhY1/hL9ptS93NqKLIq1uWojzUoRvjN+ufp/IacEXCSsE+x0qxvBBH9l HbmCpUJiRpbXg== From: Lee Jones To: lee@kernel.org, Alexander Viro , Greg Kroah-Hartman , Josef Bacik , Christian Brauner , Jeff Layton , Peter Zijlstra , Davidlohr Bueso , Paolo Abeni , Eric Dumazet , Andrew Morton , Soheil Hassas Yeganeh , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, Quentin Schulz , Wentao Guan Subject: [STABLE v5.15.y 6/8] eventpoll: rename ep_remove_safe() back to ep_remove() Date: Tue, 8 Sep 2026 09:51:02 +0100 Message-ID: <20260908085113.3960814-6-lee@kernel.org> X-Mailer: git-send-email 2.55.0.979.g7e5102b832-goog In-Reply-To: <20260908085113.3960814-1-lee@kernel.org> References: <20260908085113.3960814-1-lee@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Christian Brauner [ Upstream commit 0bade234723e40e4937be912e105785d6a51464e ] 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) Stable-dep-of: a6dc643c6931 ("eventpoll: fix ep_remove struct eventpoll / struct file UAF") Signed-off-by: Quentin Schulz Signed-off-by: Wentao Guan Signed-off-by: Greg Kroah-Hartman (cherry picked from commit 136e5900ea830dee549e3485c8931ec1c8f6c1b1) Signed-off-by: Lee Jones --- fs/eventpoll.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index cf00714afb4a..f6db6621bbee 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -764,7 +764,7 @@ static bool ep_remove_epi(struct eventpoll *ep, struct epitem *epi) /* * ep_remove variant for callers owing an additional reference to the ep */ -static void ep_remove_safe(struct eventpoll *ep, struct epitem *epi) +static void ep_remove(struct eventpoll *ep, struct epitem *epi) { struct file *file = epi->ffd.file; @@ -812,7 +812,7 @@ static void ep_clear_and_put(struct eventpoll *ep) /* * Walks through the whole tree and try to free each "struct epitem". - * Note that ep_remove_safe() will not remove the epitem in case of a + * Note that ep_remove() will not remove the epitem in case of a * racing eventpoll_release_file(); the latter will do the removal. * At this point we are sure no poll callbacks will be lingering around. * Since we still own a reference to the eventpoll struct, the loop can't @@ -821,7 +821,7 @@ static void ep_clear_and_put(struct eventpoll *ep) for (rbp = rb_first_cached(&ep->rbr); rbp; rbp = next) { next = rb_next(rbp); epi = rb_entry(rbp, struct epitem, rbn); - ep_remove_safe(ep, epi); + ep_remove(ep, epi); cond_resched(); } @@ -1588,21 +1588,21 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, mutex_unlock(&tep->mtx); /* - * ep_remove_safe() calls in the later error paths can't lead to + * ep_remove() calls in the later error paths can't lead to * ep_free() as the ep file itself still holds an ep reference. */ ep_get(ep); /* now check if we've created too many backpaths */ if (unlikely(full_check && reverse_path_check())) { - ep_remove_safe(ep, epi); + ep_remove(ep, epi); return -EINVAL; } if (epi->event.events & EPOLLWAKEUP) { error = ep_create_wakeup_source(epi); if (error) { - ep_remove_safe(ep, epi); + ep_remove(ep, epi); return error; } } @@ -1626,7 +1626,7 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, * high memory pressure. */ if (unlikely(!epq.epi)) { - ep_remove_safe(ep, epi); + ep_remove(ep, epi); return -ENOMEM; } @@ -2305,7 +2305,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds, * The eventpoll itself is still alive: the refcount * can't go to zero here. */ - ep_remove_safe(ep, epi); + ep_remove(ep, epi); error = 0; } else { error = -ENOENT; -- 2.55.0.979.g7e5102b832-goog