Commit f8ee34c3 authored by Kangjie Lu's avatar Kangjie Lu Committed by Mauro Carvalho Chehab

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: default avatarKangjie Lu <kjlu@umn.edu>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent aeb0d0f5
...@@ -2302,6 +2302,9 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) ...@@ -2302,6 +2302,9 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision)
sb_size, sb_size,
GFP_KERNEL, GFP_KERNEL,
&urb->transfer_dma); &urb->transfer_dma);
if (!usbvision->sbuf[buf_idx].data)
return -ENOMEM;
urb->dev = dev; urb->dev = dev;
urb->context = usbvision; urb->context = usbvision;
urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment