usb: usbip: set buffer pointers to NULL after free
authorMichael Grzeschik <m.grzeschik@pengutronix.de>
Mon, 22 May 2017 11:02:44 +0000 (13:02 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jul 2017 13:01:03 +0000 (15:01 +0200)
commit19adf93ccd555ac499ec160b4c4e181185b0c1c3
treedc1fa1d83c5018f3498a654be41b0fe220ccde1f
parent3d1056874295540e42290da8411f7b7720c45894
usb: usbip: set buffer pointers to NULL after free

commit b3b51417d0af63fb9a06662dc292200aed9ea53f upstream.

The usbip stack dynamically allocates the transfer_buffer and
setup_packet of each urb that got generated by the tcp to usb stub code.
As these pointers are always used only once we will set them to NULL
after use. This is done likewise to the free_urb code in vudc_dev.c.
This patch fixes double kfree situations where the usbip remote side
added the URB_FREE_BUFFER.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Shuah Khan <shuahkh@osg.samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/usbip/stub_main.c
drivers/usb/usbip/stub_tx.c