From: Bart Van Assche <bvanassche@acm.org>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
Markus Elfring <Markus.Elfring@web.de>,
linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-btrfs@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Damien Le Moal <dlemoal@kernel.org>, Jens Axboe <axboe@kernel.dk>
Cc: linux-kernel@vger.kernel.org, linux-next@vger.kernel.org,
lkp@intel.com, oe-lkp@lists.linux.dev,
Christian Brauner <brauner@kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Christoph Hellwig <hch@lst.de>, Hillf Danton <hdanton@sina.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Mark Brown <broonie@kernel.org>,
Oliver Sang <oliver.sang@intel.com>
Subject: Re: [PATCH v6] loop: Fix NULL pointer dereference in lo_rw_aio()
Date: Mon, 24 Aug 2026 16:24:00 -0700 [thread overview]
Message-ID: <27bcb147-bead-4432-8cd0-981489f36228@acm.org> (raw)
In-Reply-To: <372ca5f6-81a0-4f6c-8f55-ebeeada9f955@acm.org>
On 8/24/26 3:53 PM, Bart Van Assche wrote:
> On 8/24/26 3:06 PM, Tetsuo Handa wrote:
>> I still cannot catch why Bart's approach can become safe without
>> synchronize_rcu() and drain_workqueue().
>
> Agreed that drain_workqueue() or flush_workqueue() is necessary. I do
> not agree that an explicit synchronize_rcu() call is required. Waiting
> until the request queue is frozen includes this call implicitly.
> See also __percpu_ref_switch_to_atomic().
A correction: it is not safe to call drain_workqueue() nor to freeze the
request queue in __loop_clr_fd(). I'm considering to modify the comment
in that function as follows:
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1203,8 +1203,13 @@ static void __loop_clr_fd(struct loop_device *lo)
/*
* Reset the block size to the default.
*
- * No queue freezing needed because this is called from the final
- * ->release call only, so there can't be any outstanding I/O.
+ * Asynchronously submitted I/O may still be in progress.
Freezing the
+ * request queue is not possible without triggering lock inversion.
+ * Freezing a request queue must happen between the
+ * queue_limits_start_update() and queue_limits_commit_update
calls. If
+ * the request queue would be frozen between these two calls, a
deadlock
+ * can be triggered with the loop_clear_limits() call from the
I/O path
+ * since loop_clear_limits() also calls queue_limits_start_update().
*/
Thanks,
Bart.
prev parent reply other threads:[~2026-08-24 23:24 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260518174013.4b72dd50a5bcb89daaed1f62@linux-foundation.org>
[not found] ` <d43125ff-cc66-49b7-b16d-1b2650c68c23@I-love.SAKURA.ne.jp>
[not found] ` <ag0lS_CbKO9R5CV8@fedora>
[not found] ` <94076bc9-2c09-4bb6-8468-b6b8af419cb9@I-love.SAKURA.ne.jp>
[not found] ` <ag1nfIFcykmQHbkk@fedora>
[not found] ` <1ab8c579-eb76-4227-8a72-6ec819135219@I-love.SAKURA.ne.jp>
[not found] ` <ag1223nAa0wZ8ALC@fedora>
[not found] ` <fda8abc8-6aa2-463b-bf72-865f6b838034@I-love.SAKURA.ne.jp>
[not found] ` <ahRocb0Vs_m6RF_O@fedora>
[not found] ` <1a9f53d4-6f48-4df8-a3d8-2b0e442a163a@I-love.SAKURA.ne.jp>
2026-05-27 1:20 ` [PATCH v3] loop: Fix NULL pointer dereference in lo_rw_aio() Ming Lei
2026-05-27 1:35 ` Tetsuo Handa
2026-05-27 3:00 ` Ming Lei
2026-05-27 11:29 ` Tetsuo Handa
2026-05-27 18:11 ` Damien Le Moal
2026-05-28 8:38 ` Christoph Hellwig
2026-05-28 10:16 ` Qu Wenruo
2026-06-01 14:40 ` Christoph Hellwig
2026-06-01 16:29 ` Brian Foster
2026-06-01 22:27 ` Qu Wenruo
2026-06-01 15:29 ` Ming Lei
2026-06-01 21:51 ` Hillf Danton
2026-06-01 22:14 ` Ming Lei
2026-06-01 23:17 ` Hillf Danton
2026-06-01 23:36 ` Ming Lei
2026-06-02 2:02 ` Hillf Danton
2026-05-28 5:43 ` Hillf Danton
2026-05-28 23:00 ` Hillf Danton
2026-05-29 0:14 ` Tetsuo Handa
2026-05-29 7:04 ` Hillf Danton
2026-05-29 22:05 ` Hillf Danton
2026-05-30 23:57 ` Tetsuo Handa
2026-06-07 10:54 ` [PATCH v4] " Tetsuo Handa
2026-06-09 17:50 ` Al Viro
2026-06-13 11:00 ` Tetsuo Handa
2026-06-19 14:33 ` Tetsuo Handa
2026-06-20 7:39 ` Al Viro
2026-06-20 9:42 ` Tetsuo Handa
2026-07-13 3:04 ` Hillf Danton
2026-07-13 11:02 ` Tetsuo Handa
2026-07-14 4:38 ` Hillf Danton
2026-07-16 0:05 ` [PATCH v5] " Tetsuo Handa
2026-08-23 11:17 ` [PATCH v6] " Tetsuo Handa
2026-08-23 15:57 ` Markus Elfring
2026-08-24 22:06 ` Tetsuo Handa
2026-08-24 22:53 ` Bart Van Assche
2026-08-24 23:24 ` Bart Van Assche [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=27bcb147-bead-4432-8cd0-981489f36228@acm.org \
--to=bvanassche@acm.org \
--cc=Markus.Elfring@web.de \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=broonie@kernel.org \
--cc=dlemoal@kernel.org \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=hdanton@sina.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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