Commit e22a3b34 authored by Insu Yun's avatar Insu Yun Committed by Mauro Carvalho Chehab

[media] usbtv: correctly handling failed allocation

Since kzalloc can be failed,
if not properly handled, NULL dereference could be happened.
Signed-off-by: default avatarInsu Yun <wuninsu@gmail.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent f8433226
...@@ -393,6 +393,10 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv) ...@@ -393,6 +393,10 @@ static struct urb *usbtv_setup_iso_transfer(struct usbtv *usbtv)
ip->transfer_flags = URB_ISO_ASAP; ip->transfer_flags = URB_ISO_ASAP;
ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS, ip->transfer_buffer = kzalloc(size * USBTV_ISOC_PACKETS,
GFP_KERNEL); GFP_KERNEL);
if (!ip->transfer_buffer) {
usb_free_urb(ip);
return NULL;
}
ip->complete = usbtv_iso_cb; ip->complete = usbtv_iso_cb;
ip->number_of_packets = USBTV_ISOC_PACKETS; ip->number_of_packets = USBTV_ISOC_PACKETS;
ip->transfer_buffer_length = size * USBTV_ISOC_PACKETS; ip->transfer_buffer_length = size * USBTV_ISOC_PACKETS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment