diff options
author | Kangjie Lu <kjlu@umn.edu> | 2019-03-09 02:42:26 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-03-29 07:42:56 -0400 |
commit | f8ee34c3e77afd8cfc13f98e326325f17494f1e5 (patch) | |
tree | f58d15f180a2c6a99146e0eb7cc16990254f8c13 /drivers/media/usb | |
parent | aeb0d0f581e2079868e64a2e5ee346d340376eae (diff) |
media: usbvision: fix a potential NULL pointer dereference
In case usb_alloc_coherent fails, the fix returns -ENOMEM to
avoid a potential NULL pointer dereference.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/usb')
-rw-r--r-- | drivers/media/usb/usbvision/usbvision-core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c index 92d166bf8c12..abc4eed832a3 100644 --- a/drivers/media/usb/usbvision/usbvision-core.c +++ b/drivers/media/usb/usbvision/usbvision-core.c @@ -2302,6 +2302,9 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) sb_size, GFP_KERNEL, &urb->transfer_dma); + if (!usbvision->sbuf[buf_idx].data) + return -ENOMEM; + urb->dev = dev; urb->context = usbvision; urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); |