fuse_dev_do_read() returns -E2BIG when a SETXATTR does not fit the
server's buffer, since the value may legitimately be that large.  The
io-uring transport fails the copy with -EIO instead.  Map it so both
transports agree.

Assisted-by: Claude:claude-opus-4-8
Reviewed-by: Joanne Koong <[email protected]>
Signed-off-by: Xiang Mei <[email protected]>
---
v7: new patch, all that is left of the v6 bounds check
v8: comment on why -EIO is unambiguous here; add Reviewed-by

 fs/fuse/dev_uring.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index c6dd420c4034..460776cd69cd 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -893,6 +893,12 @@ static int fuse_uring_args_to_ring(struct fuse_req *req,
        fuse_copy_finish(&cs);
        if (err) {
                pr_info_ratelimited("%s fuse_copy_args failed\n", __func__);
+               /*
+                * fuse-uring does not use pipe buffers, so -EIO here can only
+                * mean the in-args did not fit ent->payload
+                */
+               if (err == -EIO && args->opcode == FUSE_SETXATTR)
+                       err = -E2BIG;
                return err;
        }
 
-- 
2.43.0


Reply via email to