From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Joanne Koong <joannelkoong@gmail.com>,
Bernd Schubert <bschubert@ddn.com>,
Jeff Layton <jlayton@kernel.org>,
Baokun Li <libaokun@linux.alibaba.com>,
Miklos Szeredi <mszeredi@redhat.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 7.1.y 2/6] fuse-uring: refactor io-uring header copying from ring
Date: Mon, 31 Aug 2026 17:10:01 -0400 [thread overview]
Message-ID: <20260831211005.1798781-2-sashal@kernel.org> (raw)
In-Reply-To: <20260831211005.1798781-1-sashal@kernel.org>
From: Joanne Koong <joannelkoong@gmail.com>
[ Upstream commit ba7d47897fd895533c19af436ca7fc4f6b171238 ]
Move header copying from ring logic into a new copy_header_from_ring()
function. This makes the copy_from_user() logic more clear and
centralizes error handling / rate-limited logging.
Reviewed-by: Bernd Schubert <bschubert@ddn.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Baokun Li <libaokun@linux.alibaba.com>
Signed-off-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Stable-dep-of: fd10f40af314 ("fuse: copy request headers via a stack buffer for io-uring")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/fuse/dev_uring.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index df19a580c200a..6468a72de6644 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -587,6 +587,18 @@ static __always_inline int copy_header_to_ring(void __user *ring,
return 0;
}
+static __always_inline int copy_header_from_ring(void *header,
+ const void __user *ring,
+ size_t header_size)
+{
+ if (copy_from_user(header, ring, header_size)) {
+ pr_info_ratelimited("Copying header from ring failed.\n");
+ return -EFAULT;
+ }
+
+ return 0;
+}
+
static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
struct fuse_req *req,
struct fuse_ring_ent *ent)
@@ -597,10 +609,10 @@ static int fuse_uring_copy_from_ring(struct fuse_ring *ring,
int err;
struct fuse_uring_ent_in_out ring_in_out;
- err = copy_from_user(&ring_in_out, &ent->headers->ring_ent_in_out,
- sizeof(ring_in_out));
+ err = copy_header_from_ring(&ring_in_out, &ent->headers->ring_ent_in_out,
+ sizeof(ring_in_out));
if (err)
- return -EFAULT;
+ return err;
err = import_ubuf(ITER_SOURCE, ent->payload, ring->max_payload_sz,
&iter);
@@ -836,8 +848,8 @@ static void fuse_uring_commit(struct fuse_ring_ent *ent, struct fuse_req *req,
struct fuse_conn *fc = ring->fc;
ssize_t err = -EFAULT;
- if (copy_from_user(&req->out.h, &ent->headers->in_out,
- sizeof(req->out.h)))
+ if (copy_header_from_ring(&req->out.h, &ent->headers->in_out,
+ sizeof(req->out.h)))
goto out;
err = fuse_uring_out_header_has_err(&req->out.h, req, fc);
--
2.53.0
next prev parent reply other threads:[~2026-08-31 21:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 12:23 FAILED: patch "[PATCH] fuse: copy request headers via a stack buffer for io-uring" failed to apply to 7.1-stable tree gregkh
2026-08-31 21:10 ` [PATCH 7.1.y 1/6] fuse-uring: refactor io-uring header copying to ring Sasha Levin
2026-08-31 21:10 ` Sasha Levin [this message]
2026-08-31 21:10 ` [PATCH 7.1.y 3/6] fuse-uring: use enum types for header copying Sasha Levin
2026-08-31 21:10 ` [PATCH 7.1.y 4/6] fuse-uring: refactor setting up copy state for payload copying Sasha Levin
2026-08-31 21:10 ` [PATCH 7.1.y 5/6] fuse-uring: use named constants for io-uring iovec indices Sasha Levin
2026-08-31 21:10 ` [PATCH 7.1.y 6/6] fuse: copy request headers via a stack buffer for io-uring Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831211005.1798781-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bschubert@ddn.com \
--cc=jlayton@kernel.org \
--cc=joannelkoong@gmail.com \
--cc=libaokun@linux.alibaba.com \
--cc=mszeredi@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.