mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 08:45:26 -05:00
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>
This commit is contained in:
committed by
Jens Axboe
parent
c9b5645fd8
commit
ccb8a3c08a
@@ -161,10 +161,9 @@ static int blk_validate_integrity_limits(struct queue_limits *lim)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (bi->pi_tuple_size > bi->metadata_size) {
|
||||
pr_warn("pi_tuple_size (%u) exceeds metadata_size (%u)\n",
|
||||
bi->pi_tuple_size,
|
||||
bi->metadata_size);
|
||||
if (bi->pi_offset + bi->pi_tuple_size > bi->metadata_size) {
|
||||
pr_warn("pi_offset (%u) + pi_tuple_size (%u) exceeds metadata_size (%u)\n",
|
||||
bi->pi_offset, bi->pi_tuple_size, bi->metadata_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user