From: Insu Yun Date: Tue, 29 Dec 2015 21:48:29 +0000 (-0200) Subject: [media] usbtv: correctly handling failed allocation X-Git-Tag: v5.15~14034^2^2~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e22a3b34a1f2ee53f89aef86b15d6f677de6bdc5;p=platform%2Fkernel%2Flinux-starfive.git [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 Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/usb/usbtv/usbtv-video.c b/drivers/media/usb/usbtv/usbtv-video.c index 4ecb27b..f6cfad4 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;