summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/usbtv
diff options
context:
space:
mode:
authorInsu Yun <wuninsu@gmail.com>2015-12-29 22:48:29 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-02-01 10:42:00 +0100
commite22a3b34a1f2ee53f89aef86b15d6f677de6bdc5 (patch)
treea82d3e1b8b40003ff7a5fd9bfa80156fa33d735a /drivers/media/usb/usbtv
parent[media] cx231xx: correctly handling failed allocation (diff)
downloadlinux-e22a3b34a1f2ee53f89aef86b15d6f677de6bdc5.tar.xz
linux-e22a3b34a1f2ee53f89aef86b15d6f677de6bdc5.zip
[media] usbtv: correctly handling failed allocation
Since kzalloc can be failed, if not properly handled, NULL dereference could be happened. 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>
Diffstat (limited to 'drivers/media/usb/usbtv')
-rw-r--r--drivers/media/usb/usbtv/usbtv-video.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c
index 4ecb27b2d619..f6cfad46547e 100644
--- a/drivers/media/usb/usbtv/usbtv-video.c
+++ b/drivers/media/usb/usbtv/usbtv-video.c
@@ -393,6 +393,10 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
ip->transfer_flags = URB_ISO_ASAP;
ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS,
GFP_KERNEL);
+ if (!ip->transfer_buffer) {
+ usb_free_urb(ip);
+ return NULL;
+ }
ip->complete = usbtv_iso_cb;
ip->number_of_packets = USBTV_ISOC_PACKETS;
ip->transfer_buffer_length = size * USBTV_ISOC_PACKETS;