Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b56d1003 authored by Eric Northup's avatar Eric Northup Committed by James Bottomley
Browse files

[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: default avatarEric Northup <digitaleric@google.com>
Acked-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 0b9d37ae
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;