diff options
author | Eric Northup <digitaleric@google.com> | 2012-11-08 01:55:50 -0800 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-11-27 08:59:45 +0400 |
commit | b56d1003512c33aa1752d84e3fa078bc76b15bf8 (patch) | |
tree | c3578ca43856c4f652d5425e238c4c01973308af /drivers/scsi | |
parent | 0b9d37aeb8bdf20ed2f994cd87eefb44e8ece382 (diff) | |
download | linux-b56d1003512c33aa1752d84e3fa078bc76b15bf8.tar.gz linux-b56d1003512c33aa1752d84e3fa078bc76b15bf8.tar.bz2 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.c | 2 |
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; |