usbip: Fix vhci_urb_enqueue() URB null transfer buffer error path
authorShuah Khan <shuah@kernel.org>
Thu, 24 Jan 2019 21:46:42 +0000 (14:46 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Jan 2019 09:02:49 +0000 (10:02 +0100)
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>
drivers/usb/usbip/vhci_hcd.c

index 1e592ec..f46ee1f 100644 (file)
@@ -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);