* [PATCH] media: usbvision: fix a potential NULL pointer dereference
@ 2019-03-09 7:42 Kangjie Lu
2019-03-23 3:07 ` Kangjie Lu
0 siblings, 1 reply; 2+ messages in thread
From: Kangjie Lu @ 2019-03-09 7:42 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Hans Verkuil, Mauro Carvalho Chehab, Colin Ian King,
Sebastian Andrzej Siewior, linux-media, linux-kernel
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>
---
drivers/media/usb/usbvision/usbvision-core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
index 31e0e98d6daf..1b0d0a0f0e87 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: usbvision: fix a potential NULL pointer dereference
2019-03-09 7:42 [PATCH] media: usbvision: fix a potential NULL pointer dereference Kangjie Lu
@ 2019-03-23 3:07 ` Kangjie Lu
0 siblings, 0 replies; 2+ messages in thread
From: Kangjie Lu @ 2019-03-23 3:07 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Hans Verkuil, Mauro Carvalho Chehab, Colin Ian King,
Sebastian Andrzej Siewior, linux-media, linux-kernel
> On Mar 9, 2019, at 1:42 AM, Kangjie Lu <kjlu@umn.edu> wrote:
>
> 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>
> ---
> drivers/media/usb/usbvision/usbvision-core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/usb/usbvision/usbvision-core.c b/drivers/media/usb/usbvision/usbvision-core.c
> index 31e0e98d6daf..1b0d0a0f0e87 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;
> +
Can someone review this patch?
> urb->dev = dev;
> urb->context = usbvision;
> urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp);
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-23 3:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 7:42 [PATCH] media: usbvision: fix a potential NULL pointer dereference Kangjie Lu
2019-03-23 3:07 ` Kangjie Lu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).