Skip to content

Commit cf22210

Browse files
longlimsftgregkh
authored andcommitted
scsi: storvsc: fix memory leak on ring buffer busy
commit 0208eeaa650c5c866a3242201678a19e6dc4a14e upstream. When storvsc is sending I/O to Hyper-v, it may allocate a bigger buffer descriptor for large data payload that can't fit into a pre-allocated buffer descriptor. This bigger buffer is freed on return path. If I/O request to Hyper-v fails due to ring buffer busy, the storvsc allocated buffer descriptor should also be freed. [mkp: applied by hand] Fixes: be0cf6c ("scsi: storvsc: Set the tablesize based on the information given by the host") Signed-off-by: Long Li <longli@microsoft.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b4730f4 commit cf22210

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/scsi/storvsc_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,6 +1511,8 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
15111511
ret = storvsc_do_io(dev, cmd_request);
15121512

15131513
if (ret == -EAGAIN) {
1514+
if (payload_sz > sizeof(cmd_request->mpb))
1515+
kfree(payload);
15141516
/* no more space */
15151517
return SCSI_MLQUEUE_DEVICE_BUSY;
15161518
}

0 commit comments

Comments
 (0)