From: syzbot <syzbot+3c74b1f0c372e98efc32@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: #syz test
Date: Fri, 29 May 2026 19:13:30 -0700 [thread overview]
Message-ID: <6a1a47ca.fd5edf16.2e7427.0004.GAE@google.com> (raw)
In-Reply-To: <6a19f098.abb04025.19af7b.0003.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: #syz test
Author: hongao@uniontech.com
From 57d3537f407aaf4229abc9b78513c6222cbfb799 Mon Sep 17 00:00:00 2001
From: hongao <hongao@uniontech.com>
Date: Sat, 30 May 2026 09:08:24 +0800
Subject: [PATCH] netfs: Fix UAF in netfs_unbuffered_write() on failed
preparation
#syz test
If write subrequest preparation fails, netfs_unbuffered_write() calls
netfs_write_subrequest_terminated() and then reads subreq->error to set
wreq->error.
However, netfs_write_subrequest_terminated() consumes a reference to the
subrequest through netfs_put_subrequest(), so the subrequest may be freed
before netfs_unbuffered_write() reads subreq->error again. This can
trigger a slab-use-after-free.
Save the error locally before terminating the subrequest, and use the
saved value afterwards.
Fixes: a0b4c7a49137 ("netfs: Fix unbuffered/DIO writes to dispatch subrequests in strict sequence")
Reported-by: syzbot+3c74b1f0c372e98efc32@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3c74b1f0c372e98efc32
Signed-off-by: hongao <hongao@uniontech.com>
---
fs/netfs/direct_write.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/fs/netfs/direct_write.c b/fs/netfs/direct_write.c
index 25f8ceb15fad..2d5361702076 100644
--- a/fs/netfs/direct_write.c
+++ b/fs/netfs/direct_write.c
@@ -115,8 +115,9 @@ static int netfs_unbuffered_write(struct netfs_io_request *wreq)
/* Check if (re-)preparation failed. */
if (unlikely(test_bit(NETFS_SREQ_FAILED, &subreq->flags))) {
- netfs_write_subrequest_terminated(subreq, subreq->error);
- wreq->error = subreq->error;
+ ret = subreq->error;
+ wreq->error = ret;
+ netfs_write_subrequest_terminated(subreq, ret);
break;
}
--
2.51.0
next prev parent reply other threads:[~2026-05-30 2:13 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-29 20:01 [syzbot] [netfs?] KASAN: slab-use-after-free Read in netfs_unbuffered_write syzbot
2026-05-30 2:13 ` syzbot [this message]
2026-05-31 3:44 ` Edward Adam Davis
2026-05-31 4:04 ` syzbot
2026-05-31 4:37 ` Edward Adam Davis
2026-05-31 5:02 ` syzbot
2026-06-24 11:04 ` David Howells
2026-06-24 11:35 ` syzbot
2026-06-25 12:50 ` David Howells
2026-06-25 13:16 ` syzbot
-- strict thread matches above, loose matches on Subject: below --
2026-04-09 18:30 [syzbot] [fuse?] BUG: scheduling while atomic in __synchronize_srcu syzbot
2026-04-13 4:40 ` Forwarded: #syz test syzbot
2026-04-13 4:49 ` syzbot
2026-04-13 4:50 ` syzbot
2026-04-13 4:52 ` syzbot
2026-04-13 5:08 ` syzbot
2026-04-13 6:04 ` syzbot
2026-04-30 16:06 ` syzbot
2026-04-30 17:26 ` syzbot
2026-04-30 17:41 ` syzbot
2026-04-30 18:27 ` syzbot
2026-04-30 18:53 ` syzbot
2025-09-30 20:29 [syzbot] [rdma?] KMSAN: uninit-value in ib_nl_handle_ip_res_resp syzbot
2025-11-06 19:45 ` Forwarded: syz test syzbot
2025-11-07 20:06 ` syzbot
2025-11-07 22:53 ` syzbot
2025-08-27 21:55 [syzbot] [mm?] [usb?] WARNING in __alloc_skb (4) syzbot
2025-09-20 10:59 ` Forwarded: syz test syzbot
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=6a1a47ca.fd5edf16.2e7427.0004.GAE@google.com \
--to=syzbot+3c74b1f0c372e98efc32@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome