Skip to content

Commit 8a6ca54

Browse files
benzearichardweinberger
authored andcommitted
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: 68f5d3f ("um: add PCI over virtio emulation driver") Signed-off-by: Benjamin Berg <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent b99ddbe commit 8a6ca54

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/um/drivers/virt-pci.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ static int um_pci_send_cmd(struct um_pci_device *dev,
137137
out ? 1 : 0,
138138
posted ? cmd : HANDLE_NO_FREE(cmd),
139139
GFP_ATOMIC);
140-
if (ret)
140+
if (ret) {
141+
if (posted)
142+
kfree(cmd);
141143
goto out;
144+
}
142145

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

0 commit comments

Comments
 (0)