[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190309074228.5723-1-kjlu@umn.edu>
Date: Sat, 9 Mar 2019 01:42:26 -0600
From: Kangjie Lu <kjlu@....edu>
To: kjlu@....edu
Cc: pakki001@....edu, Hans Verkuil <hverkuil@...all.nl>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Colin Ian King <colin.king@...onical.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] 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@....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
Powered by blists - more mailing lists