diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-05-10 16:06:04 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-05-10 16:06:04 +0200 |
commit | 2e00fde5c6ed8535244332ebb55e881baa54ae46 (patch) | |
tree | f578e02ef1dc6e59630f09404bb2f58500876811 /drivers/usb/usbip/usbip_common.c | |
parent | 39f0ccde3624e7cf882faccf7f72a47b7a763bfb (diff) | |
parent | 3231e2053eaeee70bdfb216a78a30f11e88e2243 (diff) | |
download | linux-2e00fde5c6ed8535244332ebb55e881baa54ae46.tar.bz2 |
Merge branch 'for-linus' into for-next
Diffstat (limited to 'drivers/usb/usbip/usbip_common.c')
-rw-r--r-- | drivers/usb/usbip/usbip_common.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/usbip/usbip_common.c b/drivers/usb/usbip/usbip_common.c index facaaf003f19..e40da7759a0e 100644 --- a/drivers/usb/usbip/usbip_common.c +++ b/drivers/usb/usbip/usbip_common.c @@ -741,6 +741,17 @@ int usbip_recv_xbuff(struct usbip_device *ud, struct urb *urb) if (!(size > 0)) return 0; + if (size > urb->transfer_buffer_length) { + /* should not happen, probably malicious packet */ + if (ud->side == USBIP_STUB) { + usbip_event_add(ud, SDEV_EVENT_ERROR_TCP); + return 0; + } else { + usbip_event_add(ud, VDEV_EVENT_ERROR_TCP); + return -EPIPE; + } + } + ret = usbip_recv(ud->tcp_socket, urb->transfer_buffer, size); if (ret != size) { dev_err(&urb->dev->dev, "recv xbuf, %d\n", ret); |