Linux block layer
 help / color / mirror / Atom feed
From: Ming Lei <tom.leiming@gmail.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	syzbot+cd8a9a308e879a4e2c28@syzkaller.appspotmail.com,
	syzbot+bc273027d5643e48e5b3@syzkaller.appspotmail.com,
	Hongling Zeng <zenghongling@kylinos.cn>,
	Bart Van Assche <bvanassche@acm.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] loop: add sync_blockdev() in __loop_clr_fd() to prevent UAF
Date: Fri, 22 May 2026 11:45:41 +0800	[thread overview]
Message-ID: <ag_RZc908B64hTFG@fedora> (raw)
In-Reply-To: <e4deece5-d866-4a44-9097-eaa1e2727c0b@I-love.SAKURA.ne.jp>

On Fri, May 22, 2026 at 12:28:34PM +0900, Tetsuo Handa wrote:
> On 2026/05/22 11:54, Ming Lei wrote:
> > Fix this by adding sync_blockdev() in __loop_clr_fd() to flush all
> > pending writeback I/O before clearing lo->lo_backing_file. Since the
> > loop disk is already closed at this point, no new I/O can be submitted
> > — only writeback remains.
> 
> Why can you assume that synchronize_rcu() + drain_workqueue(lo->workqueue)
> is unnecessary? Since we don't know exact commit which is causing this
> problem, we don't know what has changed.

When sync_blockdev() returns, there can't be any inflight IO:

- no one can open this loop disk
- no dirty page cache any more

So why do you want to add rcu/drain_workqueue?

Fixes: 1fe0b1acb14d ("loop: only freeze the queue in __loop_clr_fd when needed")


Thanks,
Ming

  reply	other threads:[~2026-05-22  3:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22  2:54 [PATCH] loop: add sync_blockdev() in __loop_clr_fd() to prevent UAF Ming Lei
2026-05-22  3:28 ` Tetsuo Handa
2026-05-22  3:45   ` Ming Lei [this message]
2026-05-22  6:54     ` Tetsuo Handa
2026-05-22  9:33       ` Ming Lei
2026-05-22  9:54         ` Tetsuo Handa
2026-05-22 11:50           ` Ming Lei

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=ag_RZc908B64hTFG@fedora \
    --to=tom.leiming@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=syzbot+bc273027d5643e48e5b3@syzkaller.appspotmail.com \
    --cc=syzbot+cd8a9a308e879a4e2c28@syzkaller.appspotmail.com \
    --cc=zenghongling@kylinos.cn \
    /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