Re: [PATCH] USB: serial: Fix use after free in debug printk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux