mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 10:01:39 -05:00
block: validate interval_exp integrity limit
Various code assumes that the integrity interval is at least 1 sector and evenly divides the logical block size. Add these checks to blk_validate_integrity_limits(). This guards against block drivers that report invalid interval_exp values. Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
ccb8a3c08a
commit
af65faf34f
@@ -193,8 +193,13 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bi->interval_exp)
|
if (!bi->interval_exp) {
|
||||||
bi->interval_exp = ilog2(lim->logical_block_size);
|
bi->interval_exp = ilog2(lim->logical_block_size);
|
||||||
|
} else if (bi->interval_exp < SECTOR_SHIFT ||
|
||||||
|
bi->interval_exp > ilog2(lim->logical_block_size)) {
|
||||||
|
pr_warn("invalid interval_exp %u\n", bi->interval_exp);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The PI generation / validation helpers do not expect intervals to
|
* The PI generation / validation helpers do not expect intervals to
|
||||||
|
|||||||
Reference in New Issue
Block a user