Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: rc: clean the freed urb pointer to avoid double free

After freed rx_urb, we should set the second interface urb to NULL,
otherwise a double free would happen when the driver is removed
from the first interface.

Signed-off-by: Nil Yi <teroincn@163.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Nil Yi and committed by
Mauro Carvalho Chehab
c9458c6f afae4ef7

+2
+2
drivers/media/rc/imon.c
··· 2358 2358 touch_setup_failed: 2359 2359 find_endpoint_failed: 2360 2360 usb_put_dev(ictx->usbdev_intf1); 2361 + ictx->usbdev_intf1 = NULL; 2361 2362 mutex_unlock(&ictx->lock); 2362 2363 usb_free_urb(rx_urb); 2364 + ictx->rx_urb_intf1 = NULL; 2363 2365 rx_urb_alloc_failed: 2364 2366 dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret); 2365 2367