diff options
author | Shuah Khan <shuah@kernel.org> | 2019-01-24 14:46:42 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-12 19:20:51 +0100 |
commit | f865ae473c16fb2b8b8601fa04f4f6517ad557b3 (patch) | |
tree | daaf407e3f1daf55633f6547174cb85640d0922d | |
parent | e9c0fc4a7ccd9fc28e78685d17c1943839c5579a (diff) | |
download | linux-stable-f865ae473c16fb2b8b8601fa04f4f6517ad557b3.tar.gz linux-stable-f865ae473c16fb2b8b8601fa04f4f6517ad557b3.tar.bz2 linux-stable-f865ae473c16fb2b8b8601fa04f4f6517ad557b3.zip |
usbip: Fix vhci_urb_enqueue() URB null transfer buffer error path
commit 2c904963b1dd2acd4bc785b6c72e10a6283c2081 upstream.
Fix vhci_urb_enqueue() to print debug msg and return error instead of
failing with BUG_ON.
Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/usbip/vhci_hcd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c index 1e592ec94ba4..f46ee1fefe02 100644 --- a/drivers/usb/usbip/vhci_hcd.c +++ b/drivers/usb/usbip/vhci_hcd.c @@ -702,8 +702,10 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag } vdev = &vhci_hcd->vdev[portnum-1]; - /* patch to usb_sg_init() is in 2.5.60 */ - BUG_ON(!urb->transfer_buffer && urb->transfer_buffer_length); + if (!urb->transfer_buffer && urb->transfer_buffer_length) { + dev_dbg(dev, "Null URB transfer buffer\n"); + return -EINVAL; + } spin_lock_irqsave(&vhci->lock, flags); |