summarylogtreecommitdiffstats
path: root/0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch
diff options
context:
space:
mode:
Diffstat (limited to '0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch')
-rw-r--r--0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch b/0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch
new file mode 100644
index 000000000000..c53a8dd18ab8
--- /dev/null
+++ b/0011-media-pvrusb2-fix-memory-leak-in-pvr_probe.patch
@@ -0,0 +1,39 @@
+From c02d2a91a85c4c4d05826cd1ea74a9b8d42e4280 Mon Sep 17 00:00:00 2001
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+Date: Thu, 9 Jun 2022 08:35:28 +0100
+Subject: [PATCH 11/73] media: pvrusb2: fix memory leak in pvr_probe
+
+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>
+---
+ drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+index a9666373af6b..92d6db1ad00f 100644
+--- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
++++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c
+@@ -2610,6 +2610,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf,
+ del_timer_sync(&hdw->encoder_run_timer);
+ del_timer_sync(&hdw->encoder_wait_timer);
+ flush_work(&hdw->workpoll);
++ v4l2_device_unregister(&hdw->v4l2_dev);
+ usb_free_urb(hdw->ctl_read_urb);
+ usb_free_urb(hdw->ctl_write_urb);
+ kfree(hdw->ctl_read_buffer);
+--
+2.37.3
+