diff options
author | Insu Yun <wuninsu@gmail.com> | 2015-12-29 22:48:29 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2016-02-01 10:42:00 +0100 |
commit | e22a3b34a1f2ee53f89aef86b15d6f677de6bdc5 (patch) | |
tree | a82d3e1b8b40003ff7a5fd9bfa80156fa33d735a /drivers/media/usb | |
parent | [media] cx231xx: correctly handling failed allocation (diff) | |
download | linux-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')
-rw-r--r-- | drivers/media/usb/usbtv/usbtv-video.c | 4 |
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; |