FAILED: patch "[PATCH] io_uring/eventfd: ensure io_eventfd_signal() defers another" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x c9a40292a44e78f71258b8522655bffaf5753bdb
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025011244-expedited-clip-fd53@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From c9a40292a44e78f71258b8522655bffaf5753bdb Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Wed, 8 Jan 2025 10:28:05 -0700
Subject: [PATCH] io_uring/eventfd: ensure io_eventfd_signal() defers another
RCU period
io_eventfd_do_signal() is invoked from an RCU callback, but when dropping the reference to the io_ev_fd, it calls io_eventfd_free() directly if the refcount drops to zero. This isn't correct, as any potential freeing of the io_ev_fd should be deferred another RCU grace period.
Just call io_eventfd_put() rather than open-code the dec-and-test and free, which will correctly defer it another RCU grace period.
io_uring/eventfd.c +7 -9
@@ -33,20 +33,18 @@ static void io_eventfd_free(struct rcu_head *rcu)kfree (ev_fd); } +static void io_eventfd_put (struct io_ev_fd *ev_fd) +{ +if (refcount_dec_and_test (&ev_fd->refs)) +call_rcu (&ev_fd->rcu, io_eventfd_free); +} +static void io_eventfd_do_signal (struct rcu_head *rcu) { struct io_ev_fd *ev_fd = container_of(rcu, struct io_ev_fd, rcu);eventfd_signal_mask (ev_fd->cq_ev_fd,EPOLL_URING_WAKE ); - -if (refcount_dec_and_test (&ev_fd->refs)) -io_eventfd_free (rcu); -} - -static void io_eventfd_put (struct io_ev_fd *ev_fd) -{ -if (refcount_dec_and_test (&ev_fd->refs)) -call_rcu (&ev_fd->rcu, io_eventfd_free); +io_eventfd_put (ev_fd); }static void io_eventfd_release (struct io_ev_fd *ev_fd,bool put_ref)
Jens Axboe
maintainerQuoted 6 lines · On 1/12/25 2:16 AM, [email protected] wrote:
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Quoted 8 lines
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkoutFETCH_HEAD
git cherry-pick -xc9a40292a44e78f71258b8522655bffaf5753bdb
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025011244-expedited-clip-fd53@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Here's the 6.12 variant.
Signature · 1 line
Jens Axboe
From 5bf17fd4610dd0224652e6aa1d3ead093778ee4d Mon Sep 17 00:00:00 2001
From: Jens Axboe <[email protected]>
Date: Wed, 8 Jan 2025 10:28:05 -0700
Subject: [PATCH] io_uring/eventfd: ensure io_eventfd_signal() defers another
RCU period
Commit c9a40292a44e78f71258b8522655bffaf5753bdb upstream.
io_eventfd_do_signal() is invoked from an RCU callback, but when dropping the reference to the io_ev_fd, it calls io_eventfd_free() directly if the refcount drops to zero. This isn't correct, as any potential freeing of the io_ev_fd should be deferred another RCU grace period.
Just call io_eventfd_put() rather than open-code the dec-and-test and free, which will correctly defer it another RCU grace period.
--- io_uring/eventfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/eventfd.c +1 -1
@@ -38,7 +38,7 @@ static void io_eventfd_do_signal(struct rcu_head *rcu)eventfd_signal_mask (ev_fd->cq_ev_fd,EPOLL_URING_WAKE );if (refcount_dec_and_test (&ev_fd->refs)) -io_eventfd_free (rcu); +call_rcu (&ev_fd->rcu, io_eventfd_free); }void io_eventfd_signal (struct io_ring_ctx *ctx)
Signature · 1 line
2.47.1