Commit 8a6ca543 authored by Benjamin Berg's avatar Benjamin Berg Committed by Richard Weinberger
Browse files

um: virtio_uml: free command if adding to virtqueue failed



If adding the command fails (i.e. the virtqueue is broken) then free it
again if the function allocated a new buffer for it.

Fixes: 68f5d3f3 ("um: add PCI over virtio emulation driver")
Signed-off-by: default avatarBenjamin Berg <benjamin.berg@intel.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent b99ddbe8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -137,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
				out ? 1 : 0,
				posted ? cmd : HANDLE_NO_FREE(cmd),
				GFP_ATOMIC);
	if (ret)
	if (ret) {
		if (posted)
			kfree(cmd);
		goto out;
	}

	if (posted) {
		virtqueue_kick(dev->cmd_vq);