diff options
Diffstat (limited to 'drivers/target')
-rw-r--r-- | drivers/target/target_core_iblock.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c index 2efd70ca0b1d..76db75e836ed 100644 --- a/drivers/target/target_core_iblock.c +++ b/drivers/target/target_core_iblock.c | |||
@@ -336,6 +336,11 @@ static int iblock_execute_unmap(struct se_cmd *cmd) | |||
336 | bd_dl = get_unaligned_be16(&buf[2]); | 336 | bd_dl = get_unaligned_be16(&buf[2]); |
337 | 337 | ||
338 | size = min(size - 8, bd_dl); | 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 | /* First UNMAP block descriptor starts at 8 byte offset */ | 345 | /* First UNMAP block descriptor starts at 8 byte offset */ |
341 | ptr = &buf[8]; | 346 | ptr = &buf[8]; |