* [PATCH] media: as102: drop device reference on probe failure
@ 2026-06-20 8:40 ` Jiawen Liu
2026-06-23 1:35 ` Bryan O'Donoghue
0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-06-20 8:40 UTC (permalink / raw)
To: mchehab; +Cc: hverkuil+cisco, kees, linux-media, linux-kernel, Jiawen Liu
as102_usb_probe() initializes the kref and takes a USB device
reference before registering the USB minor.
If stream allocation or DVB registration fails later, the error
path deregisters the minor but does not drop the initial kref.
Use kref_put() so as102_usb_release() drops the USB reference.
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
drivers/media/usb/as102/as102_usb_drv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c
index a11024451ceb..ad6c5837f1d7 100644
--- a/drivers/media/usb/as102/as102_usb_drv.c
+++ b/drivers/media/usb/as102/as102_usb_drv.c
@@ -405,6 +405,7 @@ static int as102_usb_probe(struct usb_interface *intf,
failed_stream:
usb_set_intfdata(intf, NULL);
usb_deregister_dev(intf, &as102_usb_class_driver);
+ kref_put(&as102_dev->kref, as102_usb_release);
return ret;
failed:
usb_put_dev(as102_dev->bus_adap.usb_dev);
base-commit: 9e7e6633458362db72427b48effad8d759131c35
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] media: as102: drop device reference on probe failure
2026-06-20 8:40 ` [PATCH] media: as102: drop device reference on probe failure Jiawen Liu
@ 2026-06-23 1:35 ` Bryan O'Donoghue
0 siblings, 0 replies; 2+ messages in thread
From: Bryan O'Donoghue @ 2026-06-23 1:35 UTC (permalink / raw)
To: Jiawen Liu, mchehab; +Cc: hverkuil+cisco, kees, linux-media, linux-kernel
On 20/06/2026 09:40, Jiawen Liu wrote:
> as102_usb_probe() initializes the kref and takes a USB device
> reference before registering the USB minor.
>
> If stream allocation or DVB registration fails later, the error
> path deregisters the minor but does not drop the initial kref.
>
> Use kref_put() so as102_usb_release() drops the USB reference.
>
> Signed-off-by: Jiawen Liu <1298662399@qq.com>
> ---
> drivers/media/usb/as102/as102_usb_drv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c
> index a11024451ceb..ad6c5837f1d7 100644
> --- a/drivers/media/usb/as102/as102_usb_drv.c
> +++ b/drivers/media/usb/as102/as102_usb_drv.c
> @@ -405,6 +405,7 @@ static int as102_usb_probe(struct usb_interface *intf,
> failed_stream:
> usb_set_intfdata(intf, NULL);
> usb_deregister_dev(intf, &as102_usb_class_driver);
> + kref_put(&as102_dev->kref, as102_usb_release);
> return ret;
> failed:
> usb_put_dev(as102_dev->bus_adap.usb_dev);
>
> base-commit: 9e7e6633458362db72427b48effad8d759131c35
> --
> 2.34.1
>
>
Missing a Fixes: and Cc: stable
But also why not:
➜ git diff
diff --git a/drivers/media/usb/as102/as102_usb_drv.c
b/drivers/media/usb/as102/as102_usb_drv.c
index a11024451cebd..8e480ab78f9b2 100644
--- a/drivers/media/usb/as102/as102_usb_drv.c
+++ b/drivers/media/usb/as102/as102_usb_drv.c
@@ -403,9 +403,7 @@ static int as102_usb_probe(struct usb_interface *intf,
failed_dvb:
as102_free_usb_stream_buffer(as102_dev);
failed_stream:
- usb_set_intfdata(intf, NULL);
usb_deregister_dev(intf, &as102_usb_class_driver);
- return ret;
failed:
usb_put_dev(as102_dev->bus_adap.usb_dev);
usb_set_intfdata(intf, NULL);
Which is the logical inversion of the setup ?
---
bod
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-23 1:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <EIs_sKzmYD0U2nVx0JkWTfmxd-qyd1OI76VEo5-EXp9MGGv7encWgH1IXessB0y3HS0EutO1_l9t58cBrEoH-Q==@protonmail.internalid>
2026-06-20 8:40 ` [PATCH] media: as102: drop device reference on probe failure Jiawen Liu
2026-06-23 1:35 ` Bryan O'Donoghue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome