1
0
Fork 0

[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>
hifive-unleashed-5.1
Eric Northup 2012-11-08 01:55:50 -08:00 committed by James Bottomley
parent 0b9d37aeb8
commit b56d100351
1 changed files with 2 additions and 0 deletions

View File

@ -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;