Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Eric Northup and committed by
James Bottomley
b56d1003 0b9d37ae

+2
+2
drivers/scsi/virtio_scsi.c
··· 469 469 sizeof cmd->req.cmd, sizeof cmd->resp.cmd, 470 470 GFP_ATOMIC) >= 0) 471 471 ret = 0; 472 + else 473 + mempool_free(cmd, virtscsi_cmd_pool); 472 474 473 475 out: 474 476 return ret;