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 pi_offset integrity limit

The PI tuple must be contained within the metadata value, so validate
that pi_offset + pi_tuple_size <= metadata_size. This guards against
block drivers that report invalid pi_offset 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
ccb8a3c0 c9b5645f

+3 -4
+3 -4
block/blk-settings.c
··· 161 161 return -EINVAL; 162 162 } 163 163 164 - if (bi->pi_tuple_size > bi->metadata_size) { 165 - pr_warn("pi_tuple_size (%u) exceeds metadata_size (%u)\n", 166 - bi->pi_tuple_size, 167 - bi->metadata_size); 164 + if (bi->pi_offset + bi->pi_tuple_size > bi->metadata_size) { 165 + pr_warn("pi_offset (%u) + pi_tuple_size (%u) exceeds metadata_size (%u)\n", 166 + bi->pi_offset, bi->pi_tuple_size, bi->metadata_size); 168 167 return -EINVAL; 169 168 } 170 169