mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
[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>
This commit is contained in:
parent
f8433226d1
commit
e22a3b34a1
1 changed files with 4 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue