Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] media: rc: clean the freed urb pointer to avoid double free
@ 2021-08-14 10:29 Nil Yi
  0 siblings, 0 replies; only message in thread
From: Nil Yi @ 2021-08-14 10:29 UTC (permalink / raw)
  To: sean, linux-media

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>
---
 drivers/media/rc/imon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 2ca4e86c7..54da6f600 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -2358,8 +2358,10 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf,
 touch_setup_failed:
 find_endpoint_failed:
 	usb_put_dev(ictx->usbdev_intf1);
+	ictx->usbdev_intf1 = NULL;
 	mutex_unlock(&ictx->lock);
 	usb_free_urb(rx_urb);
+	ictx->rx_urb_intf1 = NULL;
 rx_urb_alloc_failed:
 	dev_err(ictx->dev, "unable to initialize intf1, err %d\n", ret);
 
-- 
2.17.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-14 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-14 10:29 [PATCH] media: rc: clean the freed urb pointer to avoid double free Nil Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox