mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Zizhi Wo <wozizhi@huaweicloud.com>,
	axboe@kernel.dk, linux-block@vger.kernel.org
Cc: 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: Fri, 24 Jul 2026 12:39:35 -0700	[thread overview]
Message-ID: <4ef6f2b4-57b9-40cc-a5cd-e34473e1cba3@acm.org> (raw)
In-Reply-To: <20260704073942.3760597-1-wozizhi@huaweicloud.com>

On 7/4/26 12:39 AM, Zizhi Wo wrote:
> 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().

A Fixes: tag is missing. Once this has been addressed, feel free to add:

Reviewed-by: Bart Van Assche <bvanassche@acm.org>


  parent reply	other threads:[~2026-07-24 19:39 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
2026-07-24 19:39 ` Bart Van Assche [this message]
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=4ef6f2b4-57b9-40cc-a5cd-e34473e1cba3@acm.org \
    --to=bvanassche@acm.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