Re: [PATCH 4.4 49/72] media: usbtv: prevent double free in error case

From: Ben Hutchings
Date: Mon May 14 2018 - 13:41:25 EST


On Fri, 2018-04-06 at 15:23 +0200, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me know.
>
> ------------------
>
> From: Oliver Neukum <oneukum@xxxxxxxx>
>
> commit 50e7044535537b2a54c7ab798cd34c7f6d900bd2 upstream.
[...]
> --- a/drivers/media/usb/usbtv/usbtv-core.c
> +++ b/drivers/media/usb/usbtv/usbtv-core.c
> @@ -95,6 +95,8 @@ static int usbtv_probe(struct usb_interf
> > Â return 0;
> Â
> Âusbtv_audio_fail:
> + /* we must not free at this point */
> + usb_get_dev(usbtv->udev);

Shouldn't this bump the V4L2 device's reference count, i.e.:

v4l2_device_get(&usbtv->v4l2_dev);

?

Ben.

> Â usbtv_video_free(usbtv);
> Â
> Âusbtv_video_fail:
>
>
>
--
Ben Hutchings
Software Developer, Codethink Ltd.