Skip to content

Commit c9ced3e

Browse files
committed
scsi: storvsc: Set correct data length for sending SCSI command without payload
JIRA: https://issues.redhat.com/browse/RHEL-82537 In StorVSC, payload->range.len is used to indicate if this SCSI command carries payload. This data is allocated as part of the private driver data by the upper layer and may get passed to lower driver uninitialized. For example, the SCSI error handling mid layer may send TEST_UNIT_READY or REQUEST_SENSE while reusing the buffer from a failed command. The private data section may have stale data from the previous command. If the SCSI command doesn't carry payload, the driver may use this value as is for communicating with host, resulting in possible corruption. Fix this by always initializing this value. Fixes: be0cf6c ("scsi: storvsc: Set the tablesize based on the information given by the host") Cc: [email protected] Tested-by: Roman Kisel <[email protected]> Reviewed-by: Roman Kisel <[email protected]> Reviewed-by: Michael Kelley <[email protected]> Signed-off-by: Long Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]> (cherry picked from commit 87c4b5e) Signed-off-by: Cathy Avery <[email protected]>
1 parent 15b5887 commit c9ced3e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/storvsc_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
17941794

17951795
length = scsi_bufflen(scmnd);
17961796
payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb;
1797+
payload->range.len = 0;
17971798
payload_sz = 0;
17981799

17991800
if (scsi_sg_count(scmnd)) {

0 commit comments

Comments
 (0)