[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210729202333.21605-1-paskripkin@gmail.com>
Date: Thu, 29 Jul 2021 23:23:33 +0300
From: Pavel Skripkin <paskripkin@...il.com>
To: mchehab@...nel.org, hverkuil@...all.nl
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
Pavel Skripkin <paskripkin@...il.com>,
syzbot+a6969ef522a36d3344c9@...kaller.appspotmail.com
Subject: [PATCH v3] media: em28xx: add missing em28xx_close_extension
If em28xx dev has ->dev_next pointer, we need to delete ->dev_next list
node from em28xx_extension_devlist on disconnect to avoid UAF bugs and
corrupted list bugs, since driver frees this pointer on disconnect.
Fixes: 1a23f81b7dc3 ("V4L/DVB (9979): em28xx: move usb probe code to a proper place")
Reported-and-tested-by: syzbot+a6969ef522a36d3344c9@...kaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@...il.com>
---
Changes in v3:
Changed order of em28xx_close_extension() and
em28xx_release_resources() as Hans suggested
Changes in v2:
Previous patch was completely broken. I've done some debugging
again and found true root case of the reported bug.
---
drivers/media/usb/em28xx/em28xx-cards.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index c1e0dccb7408..948e22e29b42 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -4139,8 +4139,11 @@ static void em28xx_usb_disconnect(struct usb_interface *intf)
em28xx_close_extension(dev);
- if (dev->dev_next)
+ if (dev->dev_next) {
+ em28xx_close_extension(dev->dev_next);
em28xx_release_resources(dev->dev_next);
+ }
+
em28xx_release_resources(dev);
if (dev->dev_next) {
--
2.32.0
Powered by blists - more mailing lists