* [PATCH] USB: misc: uss720: unregister parport on probe failure
@ 2026-07-01 12:22 Myeonghun Pak
2026-07-02 0:46 ` Alex Henrie
0 siblings, 1 reply; 2+ messages in thread
From: Myeonghun Pak @ 2026-07-01 12:22 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Oliver Neukum, Alex Henrie, linux-usb, linux-kernel, stable,
Myeonghun Pak, Ijae Kim
uss720_probe() registers a parport before reading the 1284 register used
to detect unsupported Belkin F5U002 adapters. If get_1284_register()
fails, the error path drops the driver private data and the USB device
reference, but leaves the parport device registered.
Undo the pre-announce registration with parport_del_port(). Clear
priv->pp before unregistering the port, matching the disconnect path and
avoiding leaving a stale pointer in the private data.
This issue was identified during our ongoing static-analysis research while
reviewing kernel code.
Fixes: 3295f1b866bf ("usb: misc: uss720: check for incompatible versions of the Belkin F5U002")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
---
drivers/usb/misc/uss720.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index a8af7615b1..8a5ffb19a5 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -749,6 +749,10 @@ static int uss720_probe(struct usb_interface *intf,
return 0;
probe_abort:
+ if (pp) {
+ priv->pp = NULL;
+ parport_del_port(pp);
+ }
kill_all_async_requests_priv(priv);
kref_put(&priv->ref_count, destroy_priv);
return -ENODEV;
--
2.47.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] USB: misc: uss720: unregister parport on probe failure
2026-07-01 12:22 [PATCH] USB: misc: uss720: unregister parport on probe failure Myeonghun Pak
@ 2026-07-02 0:46 ` Alex Henrie
0 siblings, 0 replies; 2+ messages in thread
From: Alex Henrie @ 2026-07-02 0:46 UTC (permalink / raw)
To: Myeonghun Pak
Cc: Greg Kroah-Hartman, Oliver Neukum, linux-usb, linux-kernel,
stable, Ijae Kim
On Wed, Jul 1, 2026 at 6:23 AM Myeonghun Pak <mhun512@gmail.com> wrote:
>
> uss720_probe() registers a parport before reading the 1284 register used
> to detect unsupported Belkin F5U002 adapters. If get_1284_register()
> fails, the error path drops the driver private data and the USB device
> reference, but leaves the parport device registered.
> probe_abort:
> + if (pp) {
> + priv->pp = NULL;
> + parport_del_port(pp);
> + }
> kill_all_async_requests_priv(priv);
> kref_put(&priv->ref_count, destroy_priv);
> return -ENODEV;
I think it would make more sense to set priv->pp to NULL and call
parport_del_port(pp) right before the second `goto probe_abort`
instead of calling parport_del_port in probe_abort. That would avoid
the need for checking whether pp is null before cleaning it up.
Is this just a memory leak, or is there some visible negative
consequence to not cleaning up the struct parport on failure?
-Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-02 0:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-01 12:22 [PATCH] USB: misc: uss720: unregister parport on probe failure Myeonghun Pak
2026-07-02 0:46 ` Alex Henrie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.