Skip to content

Commit

Permalink
media: em28xx: add missing em28xx_close_extension
Browse files Browse the repository at this point in the history
[ Upstream commit 2c98b8a ]

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.

Reported-and-tested-by: syzbot+a6969ef522a36d3344c9@syzkaller.appspotmail.com

Fixes: 1a23f81 ("V4L/DVB (9979): em28xx: move usb probe code to a proper place")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
pskrgag authored and gregkh committed Nov 18, 2021
1 parent 375150b commit 4303b39
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/media/usb/em28xx/em28xx-cards.c
Expand Up @@ -4089,8 +4089,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) {
Expand Down

0 comments on commit 4303b39

Please sign in to comment.