mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 01:31:44 +00:00
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>
This commit is contained in:
parent
b7fc7f3777
commit
7409a6657a
@ -336,6 +336,11 @@ static int iblock_execute_unmap(struct se_cmd *cmd)
|
||||
bd_dl = get_unaligned_be16(&buf[2]);
|
||||
|
||||
size = min(size - 8, bd_dl);
|
||||
if (size / 16 > dev->se_sub_dev->se_dev_attrib.max_unmap_block_desc_count) {
|
||||
cmd->scsi_sense_reason = TCM_INVALID_PARAMETER_LIST;
|
||||
ret = -EINVAL;
|
||||
goto err;
|
||||
}
|
||||
|
||||
/* First UNMAP block descriptor starts at 8 byte offset */
|
||||
ptr = &buf[8];
|
||||
|
Loading…
Reference in New Issue
Block a user