summaryrefslogtreecommitdiff
path: root/drivers/scsi/virtio_scsi.c
diff options
context:
space:
mode:
authorEric Northup <digitaleric@google.com>2012-11-08 13:55:50 +0400
committerJames Bottomley <JBottomley@Parallels.com>2012-11-27 08:59:45 +0400
commitb56d1003512c33aa1752d84e3fa078bc76b15bf8 (patch)
treec3578ca43856c4f652d5425e238c4c01973308af /drivers/scsi/virtio_scsi.c
parent0b9d37aeb8bdf20ed2f994cd87eefb44e8ece382 (diff)
downloadlinux-b56d1003512c33aa1752d84e3fa078bc76b15bf8.tar.xz
[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/virtio_scsi.c')
-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;