Thread (6 messages) 6 messages, 2 authors, 2026-02-25

Re: [PATCH net] net: mctp: usb: properly drop the usb interface on probe error

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2026-02-25 14:35:24
Also in: lkml

On Tue, Feb 24, 2026 at 02:31:03PM +0800, Jeremy Kerr wrote:
Hi Greg,
quoted
quoted
quoted
diff --git a/drivers/net/mctp/mctp-usb.c b/drivers/net/mctp/mctp-usb.c
index ef860cfc629f..eef17ae89298 100644
--- a/drivers/net/mctp/mctp-usb.c
+++ b/drivers/net/mctp/mctp-usb.c
@@ -355,6 +355,7 @@ static int mctp_usb_probe(struct usb_interface *intf,
        usb_free_urb(dev->tx_urb);
        usb_free_urb(dev->rx_urb);
        free_netdev(netdev);
+       usb_put_dev(dev->usbdev);
        return rc;
 }
Should we not do the usb_put_dev() before the free_netdev()?
Why?  The usb_put_dev() doesn't really do anything, except for the fact
that you have to do it because you did a usb_get_dev() earlier.
More that the dev-> dereference may be invalid at that point, since the
netdev (and hence dev) has been free_netdev()-ed.
Argh, I missed that, yes, you are right, let me make a v2 of this,
thanks for the review!

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help