[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YJF23p/IK1VzODIf@kroah.com>
Date: Tue, 4 May 2021 18:31:26 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Takashi Iwai <tiwai@...e.de>
Cc: Jaroslav Kysela <perex@...ex.cz>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 37/69] ALSA: usx2y: check for failure of usb_alloc_urb()
On Tue, May 04, 2021 at 10:27:34AM +0200, Takashi Iwai wrote:
> On Mon, 03 May 2021 22:33:52 +0200,
> Jaroslav Kysela wrote:
> >
> > Dne 03. 05. 21 v 13:57 Greg Kroah-Hartman napsal(a):
> > > While it is almost impossible to hit an error calling usb_alloc_urb(),
> > > to make systems like syzbot which does error injection, and some static
> > > analysis tools happy, properly handle errors on this path by unwinding
> > > the previously allocated urbs and freeing them.
> >
> > Perhaps, I miss something, but this revert and add the cleanup to the wrong
> > place makes things worse:
> >
> > The usb_stream_free() is called when init_urbs() fails (returns an error), so
> > all urbs are freed there and pointers are reset to NULL. Your code frees urbs
> > twice on an allocation error.
> >
> > The reverted code does the job better.
>
> Right, the suggested patch will cause the double-free, and the
> reverted code is fine in this regard.
That wasn't obvious at all, sorry about that.
> In anyway, the cleanup of this driver code is on my post-15.3 TODO
> list. So, Greg, could you drop the revert and the additional fix at
> this round for usx2y driver?
Ok, will drop the revert and this patch, thanks for the review and sorry
for the noise.
greg k-h
Powered by blists - more mailing lists