summaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEric Northup <digitaleric@google.com>2012-11-08 10:55:50 +0100
committerJames Bottomley <JBottomley@Parallels.com>2012-11-27 05:59:45 +0100
commitb56d1003512c33aa1752d84e3fa078bc76b15bf8 (patch)
treec3578ca43856c4f652d5425e238c4c01973308af /drivers/scsi
parent[SCSI] lpfc 8.3.36: Update lpfc version for 8.3.36 driver release (diff)
downloadlinux-b56d1003512c33aa1752d84e3fa078bc76b15bf8.tar.xz
linux-b56d1003512c33aa1752d84e3fa078bc76b15bf8.zip
[SCSI] virtio_scsi: fix memory leak on full queue condition.
virtscsi_queuecommand was leaking memory when the virtio queue was full. Tested: Guest operates correctly even with very small queue sizes, validated we're not leaking kmalloc-192 sized allocations anymore. Signed-off-by: Eric Northup <digitaleric@google.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/virtio_scsi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 595af1ae4421..dd8dc27fa32c 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -469,6 +469,8 @@ static int virtscsi_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *sc)
sizeof cmd->req.cmd, sizeof cmd->resp.cmd,
GFP_ATOMIC) >= 0)
ret = 0;
+ else
+ mempool_free(cmd, virtscsi_cmd_pool);
out:
return ret;