Re: [PATCH net] net: mctp: usb: properly drop the usb interface on probe error
From: Jeremy Kerr <jk@codeconstruct.com.au>
Date: 2026-02-24 06:31:05
Also in:
lkml
From: Jeremy Kerr <jk@codeconstruct.com.au>
Date: 2026-02-24 06:31:05
Also in:
lkml
Hi Greg,
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. Cheers, Jeremy