Skip to content

Commit 3b8c72d

Browse files
andrea-parrimartinkpetersen
authored andcommitted
scsi: storvsc: Validate length of incoming packet in storvsc_on_channel_callback()
Check that the packet is of the expected size at least, don't copy data past the packet. Link: https://lore.kernel.org/r/[email protected] Cc: "James E.J. Bottomley" <[email protected]> Cc: "Martin K. Petersen" <[email protected]> Cc: [email protected] Reported-by: Saruhan Karademir <[email protected]> Signed-off-by: Andrea Parri (Microsoft) <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6112ff4 commit 3b8c72d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/scsi/storvsc_drv.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,11 @@ static void storvsc_on_channel_callback(void *context)
12461246
request = (struct storvsc_cmd_request *)
12471247
((unsigned long)desc->trans_id);
12481248

1249+
if (hv_pkt_datalen(desc) < sizeof(struct vstor_packet) - vmscsi_size_delta) {
1250+
dev_err(&device->device, "Invalid packet len\n");
1251+
continue;
1252+
}
1253+
12491254
if (request == &stor_device->init_request ||
12501255
request == &stor_device->reset_request) {
12511256
memcpy(&request->vstor_packet, packet,

0 commit comments

Comments
 (0)