From: Edward Adam Davis <eadavis@qq.com>
To: syzbot+a2b9a4ed0d61b1efb3f5@syzkaller.appspotmail.com
Cc: brauner@kernel.org, djwong@kernel.org,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-xfs@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: [PATCH Next] iomap: Add sanity check for dio done workqueue
Date: Mon, 24 Nov 2025 16:53:04 +0800 [thread overview]
Message-ID: <tencent_734A1B432559BAF7BBA333429E581B034B08@qq.com> (raw)
In-Reply-To: <6923a05a.a70a0220.2ea503.0075.GAE@google.com>
The s_dio_done_wq was not allocated memory, leading to the null-ptr-deref
reported by syzbot in [1].
As shown in [1], we are currently in a soft interrupt context, and we cannot
use sb_init_dio_done_wq() to allocate memory for wq because it requires a
mutex lock.
Added a check to the workqueue; if it is empty, it switches to using a
synchronous method to end the dio.
[1]
KASAN: null-ptr-deref in range [0x00000000000001c0-0x00000000000001c7]
CPU: 1 UID: 0 PID: 23 Comm: ksoftirqd/1 Not tainted syzkaller #0 PREEMPT(full)
Call Trace:
iomap_dio_bio_end_io+0xf4/0x1c0 fs/iomap/direct-io.c:222
blk_update_request+0x57e/0xe60 block/blk-mq.c:1006
blk_mq_end_request+0x3e/0x70 block/blk-mq.c:1168
blk_complete_reqs block/blk-mq.c:1243 [inline]
blk_done_softirq+0x10a/0x160 block/blk-mq.c:1248
handle_softirqs+0x27d/0x880 kernel/softirq.c:626
run_ksoftirqd+0x9b/0x100 kernel/softirq.c:1067
smpboot_thread_fn+0x542/0xa60 kernel/smpboot.c:160
Reported-by: syzbot+a2b9a4ed0d61b1efb3f5@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=a2b9a4ed0d61b1efb3f5
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
---
fs/iomap/direct-io.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/iomap/direct-io.c b/fs/iomap/direct-io.c
index d4e2e328d893..6b0ef7e0f05b 100644
--- a/fs/iomap/direct-io.c
+++ b/fs/iomap/direct-io.c
@@ -202,10 +202,14 @@ static void iomap_dio_done(struct iomap_dio *dio)
* filesystem metadata changes or guarantee data integrity.
*/
INIT_WORK(&dio->aio.work, iomap_dio_complete_work);
+ if (!inode->i_sb->s_dio_done_wq)
+ goto done;
+
queue_work(inode->i_sb->s_dio_done_wq, &dio->aio.work);
return;
}
+done:
WRITE_ONCE(iocb->private, NULL);
iomap_dio_complete_work(&dio->aio.work);
}
--
2.43.0
next prev parent reply other threads:[~2025-11-24 8:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-24 0:01 [syzbot] [iomap?] general protection fault in iomap_dio_bio_end_io syzbot
2025-11-24 8:53 ` Edward Adam Davis [this message]
2025-11-24 9:18 ` [PATCH Next] iomap: Add sanity check for dio done workqueue Christoph Hellwig
2025-11-24 9:30 ` [syzbot] [iomap?] general protection fault in iomap_dio_bio_end_io Christoph Hellwig
2025-11-24 12:49 ` 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=tencent_734A1B432559BAF7BBA333429E581B034B08@qq.com \
--to=eadavis@qq.com \
--cc=brauner@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=syzbot+a2b9a4ed0d61b1efb3f5@syzkaller.appspotmail.com \
--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
all inboxes | Powered by JetHome®