mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] USB: serial: Fix use after free in debug printk
Date: Thu, 31 Oct 2024 14:21:47 +0100	[thread overview]
Message-ID: <ZyOEa9VuXVus79Ev@hovoldconsulting.com> (raw)
In-Reply-To: <490dc872-fc62-49da-89ff-4eba067df8c0@stanley.mountain>

On Thu, Oct 31, 2024 at 12:39:10PM +0300, Dan Carpenter wrote:
> On Thu, Oct 31, 2024 at 12:35:31PM +0300, Dan Carpenter wrote:
> > On Thu, Oct 31, 2024 at 10:07:42AM +0100, Johan Hovold wrote:
> > > On Thu, Oct 31, 2024 at 09:59:10AM +0300, Dan Carpenter wrote:
> > > > The dev_dbg() call dereferences "urb" but it was already freed on the
> > > > previous line.  Move the debug output earlier in the function.
> > > 
> > > Thanks for catching this, but please use a temporary variable for the
> > > struct device pointer instead of changing the flow.
> > 
> > Why?  The output is the same either way and this way is cleaner code.
> 
> Nah, you're right.  A temporary variable is nicer.  It avoids having two if
> statements.

Yeah, and the debug printk belongs with the return.

v2 now applied, thanks.

Johan

      reply	other threads:[~2024-10-31 13:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-31  6:59 Dan Carpenter
2024-10-31  9:07 ` Johan Hovold
2024-10-31  9:35   ` Dan Carpenter
2024-10-31  9:39     ` Dan Carpenter
2024-10-31 13:21       ` Johan Hovold [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=ZyOEa9VuXVus79Ev@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®