aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInsu Yun2015-12-29 16:53:35 -0200
committerMauro Carvalho Chehab2016-02-01 07:41:37 -0200
commitf8433226d1b3eb035693724dca786c4445221368 (patch)
treef4ea32dbd8475c3b9ad7580e358ccd2452661fc1
parentb68554cd76bfed57a3aac2fc4ac4c60478d90050 (diff)
[media] cx231xx: correctly handling failed allocation
Since kmalloc can be failed in memory pressure, if not properly handled, NULL dereference can be happend Signed-off-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-417.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index 48643b94e694..c9320d6c6131 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -1382,6 +1382,8 @@ static int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb)
buffer_size = urb->actual_length;
buffer = kmalloc(buffer_size, GFP_ATOMIC);
+ if (!buffer)
+ return -ENOMEM;
memcpy(buffer, dma_q->ps_head, 3);
memcpy(buffer+3, p_buffer, buffer_size-3);