From: sashiko-bot@kernel.org
To: "Christian Brauner" <brauner@kernel.org>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: Re: [PATCH] ext4: don't use the kiocb after a direct read was queued
Date: Fri, 13 Nov 2026 19:15:20 +0000 [thread overview]
Message-ID: <sashiko-outbox-213530@kernel.org> (raw)
In-Reply-To: <20261113-work-ext4-dio_read_kiocb-v1-1-172a88be803c@kernel.org>
> ext4_dio_read_iter() calls file_accessed(iocb->ki_filp) after it
> submitted the direct read. But once the read was queued the kiocb
> belongs to the completion handler. If the read completes before
> ext4_dio_read_iter() gets to file_accessed() and the completion handler
> frees the kiocb it reads freed memory.
>
> aio and io_uring hold a reference to the kiocb until the submission
> returned so they don't have that problem. The fileio backend of the
> scsi target with fd_async_io=1 frees the kiocb in the completion
> handler:
>
> BUG: KASAN: slab-use-after-free in ext4_dio_read_iter+0x5e1/0x690
> Workqueue: target_submission target_queued_submit_work
> Call Trace:
> <TASK>
> [ ... ]
> Remember the file before the read is submitted. xfs avoids the same
> problem by calling file_accessed() before it submits the read.
>
> Fixes: b1b4705d54ab ("ext4: introduce direct I/O read using iomap infrastructure")
> Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-work-ext4-dio_read_kiocb-v1-1-172a88be803c@kernel.org?part=1
prev parent reply other threads:[~2026-11-13 19:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 19:05 [PATCH] ext4: don't use the kiocb after a direct read was queued Christian Brauner
2026-11-13 19:15 ` sashiko-bot [this message]
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=sashiko-outbox-213530@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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.