Skip to content

Commit 0208eea

Browse files
longlimsftmartinkpetersen
authored andcommitted
scsi: storvsc: fix memory leak on ring buffer busy
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") Cc: <[email protected]> Signed-off-by: Long Li <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 1ae948f commit 0208eea

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/scsi/storvsc_drv.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,8 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd)
16401640
put_cpu();
16411641

16421642
if (ret == -EAGAIN) {
1643+
if (payload_sz > sizeof(cmd_request->mpb))
1644+
kfree(payload);
16431645
/* no more space */
16441646
return SCSI_MLQUEUE_DEVICE_BUSY;
16451647
}

0 commit comments

Comments
 (0)