block: fix BLKSECDISCARD zero-length range causing page cache invalidation#1030
Open
blktests-ci[bot] wants to merge 1 commit into
Open
block: fix BLKSECDISCARD zero-length range causing page cache invalidation#1030blktests-ci[bot] wants to merge 1 commit into
blktests-ci[bot] wants to merge 1 commit into
Conversation
Author
|
Upstream branch: 87320be |
…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>
Author
|
Upstream branch: 87320be |
f0d2741 to
6e4aca5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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