Re: [PATCH] usb: host: ehci-sched: avoid possible NULL dereference

Alan Stern <[email protected]> Tue, 6 Oct 2020 13:58:45 -0400
Newsgroups tech.elisa.lists.linux-safety,org.kernel.vger.linux-kernel,org.kernel.vger.linux-usb
Message-ID <[email protected]>
On Mon, Oct 05, 2020 at 09:25:44PM -0400, [email protected] wrote:
> On Mon, Oct 05, 2020 at 11:19:02PM +0000, Harley A.W. Lorenzo wrote:
> > On Monday, October 5, 2020 5:31 PM, Sudip Mukherjee <[email protected]> wrote:
> > 
> > > find_tt() can return NULL or the error value in ERR_PTR() and
> > > dereferencing the return value without checking for the error can
> > > lead to a possible dereference of NULL pointer or ERR_PTR().
> > 
> > Looks fine to me. There is in fact no checks of the return value
> > before a dereference here, and this solves that.
> > 
> > Reviewed-by: Harley A.W. Lorenzo <[email protected]
> 
> No, this patch is wrong.  In fact, these calls to find_tt() cannot 
> return NULL or an ERR_PTR value.

Sudip, if you would prefer to submit a patch that adds comments to those 
call sites explaining that find_tt() will not return NULL or an error, 
that would be okay.

Alan Stern