* [PATCH 4.14 0/1] media: em28xx: initialize refcount before kref_get
@ 2022-09-26 7:11 Dragos-Marian Panait
2022-09-26 7:11 ` [PATCH 1/1] " Dragos-Marian Panait
2022-09-26 7:24 ` [PATCH 4.14 0/1] " Greg KH
0 siblings, 2 replies; 3+ messages in thread
From: Dragos-Marian Panait @ 2022-09-26 7:11 UTC (permalink / raw)
To: stable
Cc: Dongliang Mu, Hans Verkuil, Mauro Carvalho Chehab,
Frank Schäfer, linux-media, linux-kernel
The following commit is needed to fix CVE-2022-3239:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c08eadca1bdfa099e20a32f8fa4b52b2f672236d
Dongliang Mu (1):
media: em28xx: initialize refcount before kref_get
drivers/media/usb/em28xx/em28xx-cards.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
base-commit: 4edbf74132a4c9b78dc2ee61d31abef15200a781
--
2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] media: em28xx: initialize refcount before kref_get
2022-09-26 7:11 [PATCH 4.14 0/1] media: em28xx: initialize refcount before kref_get Dragos-Marian Panait
@ 2022-09-26 7:11 ` Dragos-Marian Panait
2022-09-26 7:24 ` [PATCH 4.14 0/1] " Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Dragos-Marian Panait @ 2022-09-26 7:11 UTC (permalink / raw)
To: stable
Cc: Dongliang Mu, Hans Verkuil, Mauro Carvalho Chehab,
Frank Schäfer, linux-media, linux-kernel
From: Dongliang Mu <mudongliangabcd@gmail.com>
[ Upstream commit c08eadca1bdfa099e20a32f8fa4b52b2f672236d ]
The commit 47677e51e2a4("[media] em28xx: Only deallocate struct
em28xx after finishing all extensions") adds kref_get to many init
functions (e.g., em28xx_audio_init). However, kref_init is called too
late in em28xx_usb_probe, since em28xx_init_dev before will invoke
those init functions and call kref_get function. Then refcount bug
occurs in my local syzkaller instance.
Fix it by moving kref_init before em28xx_init_dev. This issue occurs
not only in dev but also dev->dev_next.
Fixes: 47677e51e2a4 ("[media] em28xx: Only deallocate struct em28xx after finishing all extensions")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[DP: drop changes related to dev->dev_next as second tuner functionality was added in 4.16]
Signed-off-by: Dragos-Marian Panait <dragos.panait@windriver.com>
---
drivers/media/usb/em28xx/em28xx-cards.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index b736c027a0bd..23a9fe8d9d1e 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -3644,6 +3644,8 @@ static int em28xx_usb_probe(struct usb_interface *interface,
goto err_free;
}
+ kref_init(&dev->ref);
+
dev->devno = nr;
dev->model = id->driver_info;
dev->alt = -1;
@@ -3730,8 +3732,6 @@ static int em28xx_usb_probe(struct usb_interface *interface,
dev->dvb_xfer_bulk ? "bulk" : "isoc");
}
- kref_init(&dev->ref);
-
request_modules(dev);
/*
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4.14 0/1] media: em28xx: initialize refcount before kref_get
2022-09-26 7:11 [PATCH 4.14 0/1] media: em28xx: initialize refcount before kref_get Dragos-Marian Panait
2022-09-26 7:11 ` [PATCH 1/1] " Dragos-Marian Panait
@ 2022-09-26 7:24 ` Greg KH
1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-09-26 7:24 UTC (permalink / raw)
To: Dragos-Marian Panait
Cc: stable, Dongliang Mu, Hans Verkuil, Mauro Carvalho Chehab,
Frank Schäfer, linux-media, linux-kernel
On Mon, Sep 26, 2022 at 10:11:27AM +0300, Dragos-Marian Panait wrote:
> The following commit is needed to fix CVE-2022-3239:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c08eadca1bdfa099e20a32f8fa4b52b2f672236d
>
> Dongliang Mu (1):
> media: em28xx: initialize refcount before kref_get
>
> drivers/media/usb/em28xx/em28xx-cards.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>
> base-commit: 4edbf74132a4c9b78dc2ee61d31abef15200a781
> --
> 2.37.3
>
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-26 7:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-26 7:11 [PATCH 4.14 0/1] media: em28xx: initialize refcount before kref_get Dragos-Marian Panait
2022-09-26 7:11 ` [PATCH 1/1] " Dragos-Marian Panait
2022-09-26 7:24 ` [PATCH 4.14 0/1] " Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox