All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Jeremy Kerr <jk@codeconstruct.com.au>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Matt Johnston <matt@codeconstruct.com.au>,
	stable <stable@kernel.org>
Subject: Re: [PATCH net] net: mctp: usb: properly drop the usb interface on probe error
Date: Wed, 25 Feb 2026 06:35:16 -0800	[thread overview]
Message-ID: <2026022539-punch-supper-884c@gregkh> (raw)
In-Reply-To: <53bc468db1fe156cf949cb1774b701d209935a83.camel@codeconstruct.com.au>

On Tue, Feb 24, 2026 at 02:31:03PM +0800, Jeremy Kerr wrote:
> Hi Greg,
> 
> > > > 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

      reply	other threads:[~2026-02-25 14:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23 11:33 [PATCH net] net: mctp: usb: properly drop the usb interface on probe error Greg Kroah-Hartman
2026-02-24  1:41 ` Jeremy Kerr
2026-02-24  1:50 ` Jeremy Kerr
2026-02-24  6:18   ` Greg Kroah-Hartman
2026-02-24  6:31     ` Jeremy Kerr
2026-02-25 14:35       ` Greg Kroah-Hartman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026022539-punch-supper-884c@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=jk@codeconstruct.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.