Commit 7409a6657aebf8be74c21d0eded80709b27275cb
Committed by
Nicholas Bellinger
1 parent
b7fc7f3777
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
target: Check number of unmap descriptors against our limit
Fail UNMAP commands that have more than our reported limit on unmap descriptors. Signed-off-by: Roland Dreier <roland@purestorage.com> Cc: stable@vger.kernel.org Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Showing 1 changed file with 5 additions and 0 deletions Side-by-side Diff
drivers/target/target_core_iblock.c
... | ... | @@ -336,6 +336,11 @@ |
336 | 336 | bd_dl = get_unaligned_be16(&buf[2]); |
337 | 337 | |
338 | 338 | size = min(size - 8, bd_dl); |
339 | + if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) { | |
340 | + cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST; | |
341 | + ret = -EINVAL; | |
342 | + goto err; | |
343 | + } | |
339 | 344 | |
340 | 345 | /* First UNMAP block descriptor starts at 8 byte offset */ |
341 | 346 | ptr = &buf[8]; |