OSDN Git Service
(root)
/
tomoyo
/
tomoyo-test1.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b68554c
)
[media] cx231xx: correctly handling failed allocation
author
Insu Yun
<wuninsu@gmail.com>
Tue, 29 Dec 2015 18:53:35 +0000
(16:53 -0200)
committer
Mauro Carvalho Chehab
<mchehab@osg.samsung.com>
Mon, 1 Feb 2016 09:41:37 +0000
(07:41 -0200)
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>
drivers/media/usb/cx231xx/cx231xx-417.c
patch
|
blob
|
history
diff --git
a/drivers/media/usb/cx231xx/cx231xx-417.c
b/drivers/media/usb/cx231xx/cx231xx-417.c
index
48643b9
..
c9320d6
100644
(file)
--- 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);