Skip to content

block: fix BLKSECDISCARD zero-length range causing page cache invalidation#1030

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1121452=>linus-master
Open

block: fix BLKSECDISCARD zero-length range causing page cache invalidation#1030
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1121452=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown

Pull request for series with
subject: block: fix BLKSECDISCARD zero-length range causing page cache invalidation
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1121452

@blktests-ci

blktests-ci Bot commented Jul 4, 2026

Copy link
Copy Markdown
Author

Upstream branch: 87320be
series: https://patchwork.kernel.org/project/linux-block/list/?series=1121452
version: 1

…ation

Commit 697ba0b ("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().

Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
@blktests-ci

blktests-ci Bot commented Jul 5, 2026

Copy link
Copy Markdown
Author

Upstream branch: 87320be
series: https://patchwork.kernel.org/project/linux-block/list/?series=1121452
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1121452=>linus-master branch from f0d2741 to 6e4aca5 Compare July 5, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants