]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
media: pvrusb2: fix memory leak in pvr_probe
authorDongliang Mu <mudongliangabcd@gmail.com>
Thu, 9 Jun 2022 07:35:28 +0000 (08:35 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 23 Nov 2022 14:10:39 +0000 (15:10 +0100)
commit1e9c30f3170c35b5dc87d7b245fc791b44ef88b1
treeec8a76adbc38eff0bab737a97bfe17a5bd55bd15
parent25696ee67f39721022363152e62c94b7a4a382eb
media: pvrusb2: fix memory leak in pvr_probe

BugLink: https://bugs.launchpad.net/bugs/1991831
commit 945a9a8e448b65bec055d37eba58f711b39f66f0 upstream.

The error handling code in pvr2_hdw_create forgets to unregister the
v4l2 device. When pvr2_hdw_create returns back to pvr2_context_create,
it calls pvr2_context_destroy to destroy context, but mp->hdw is NULL,
which leads to that pvr2_hdw_destroy directly returns.

Fix this by adding v4l2_device_unregister to decrease the refcount of
usb interface.

Reported-by: syzbot+77b432d57c4791183ed4@syzkaller.appspotmail.com
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/media/usb/pvrusb2/pvrusb2-hdw.c