From: Christoph Hellwig <hch@infradead.org>
To: Zizhi Wo <wozizhi@huaweicloud.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, yangerkun@huawei.com,
chengzhihao1@huawei.com, wozizhi@huawei.com
Subject: Re: [PATCH] block: fix BLKSECDISCARD zero-length range causing page cache invalidation
Date: Thu, 23 Jul 2026 21:52:42 -0700 [thread overview]
Message-ID: <amLvmjCNwF8Ftobe@infradead.org> (raw)
In-Reply-To: <20260704073942.3760597-1-wozizhi@huaweicloud.com>
On Sat, Jul 04, 2026 at 03:39:42PM +0800, Zizhi Wo wrote:
> From: Zizhi Wo <wozizhi@huawei.com>
>
> Commit 697ba0b6ec4a ("block: fix integer overflow in BLKSECDISCARD") fixed
> the start+len overflow via check_add_overflow() but did not handle the
> start=0, len=0 case. There, start + len = 0, so end = 0 passes all checks,
> and truncate_bdev_range()->truncate_inode_pages_range() is then called with
> lend=UINT64_MAX, whitch is the "truncate to the end of file" sentinel, so
> the entire page cache is invalidated.
>
> Fix this by replacing the validation with blk_validate_byte_range(), which
> already rejects a zero-length range and is what BLKDISCARD uses. This also
> switches the alignment check from a hardcoded 512 to
> bdev_logical_block_size().
I though I had reviewed this before? But either way it looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2026-07-24 4:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 7:39 Zizhi Wo
2026-07-05 15:56 ` yu kuai
2026-07-24 1:17 ` Zizhi Wo
2026-07-24 4:52 ` Christoph Hellwig [this message]
2026-07-24 19:39 ` Bart Van Assche
2026-07-25 0:28 ` Zizhi Wo
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=amLvmjCNwF8Ftobe@infradead.org \
--to=hch@infradead.org \
--cc=axboe@kernel.dk \
--cc=chengzhihao1@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wozizhi@huawei.com \
--cc=wozizhi@huaweicloud.com \
--cc=yangerkun@huawei.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