Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
af65faf3 ccb8a3c0

+6 -1
+6 -1
block/blk-settings.c
··· 193 193 break; 194 194 } 195 195 196 - if (!bi->interval_exp) 196 + if (!bi->interval_exp) { 197 197 bi->interval_exp = ilog2(lim->logical_block_size); 198 + } else if (bi->interval_exp < SECTOR_SHIFT || 199 + bi->interval_exp > ilog2(lim->logical_block_size)) { 200 + pr_warn("invalid interval_exp %u\n", bi->interval_exp); 201 + return -EINVAL; 202 + } 198 203 199 204 /* 200 205 * The PI generation / validation helpers do not expect intervals to