Skip to content

Commit d4d8257

Browse files
asfacagregkh
authored andcommitted
usbip: Fix free of unallocated memory in vhci tx
iso_buffer should be set to NULL after use and free in the while loop. In the case of isochronous URB in the while loop, iso_buffer is allocated and after sending it to server, buffer is deallocated. And then, if the next URB in the while loop is not a isochronous pipe, iso_buffer still holds the previously deallocated buffer address and kfree tries to free wrong buffer address. Fixes: ea44d19 ("usbip: Implement SG support to vhci-hcd and stub driver") Reported-by: kbuild test robot <[email protected]> Reported-by: Julia Lawall <[email protected]> Signed-off-by: Suwan Kim <[email protected]> Reviewed-by: Julia Lawall <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 28df064 commit d4d8257

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/usb/usbip/vhci_tx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)
147147
}
148148

149149
kfree(iov);
150+
/* This is only for isochronous case */
150151
kfree(iso_buffer);
152+
iso_buffer = NULL;
153+
151154
usbip_dbg_vhci_tx("send txdata\n");
152155

153156
total_size += txsize;

0 commit comments

Comments
 (0)