lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 16 Mar 2023 20:05:38 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     Valery Zabrovsky <valthebrewer@...dex.ru>,
        Guo Zhengkui <guozhengkui@...o.com>,
        Aaro Koskinen <aaro.koskinen@....fi>,
        Mian Yousaf Kaukab <yousaf.kaukab@...el.com>,
        Felipe Balbi <balbi@...com>,
        Alexey Khoroshilov <khoroshilov@...ras.ru>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        lvc-project@...uxtesting.org
Subject: Re: [PATCH] usb: gadget: net2280: fix NULL pointer dereference

On Thu, Mar 16, 2023 at 02:22:35PM -0400, Alan Stern wrote:
> On Thu, Mar 16, 2023 at 05:19:35PM +0100, Greg Kroah-Hartman wrote:
> > On Thu, Mar 16, 2023 at 06:53:55PM +0300, Valery Zabrovsky wrote:
> > > In net2280_free_request():
> > > If _ep is NULL, then ep is NULL and is dereferenced
> > > while trying to produce an error message.
> > 
> > How can that ever happen?  How did you test and hit this?
> > 
> > > The patch replaces dev_err() with pr_err() which works fine.
> > 
> > That's not a good idea for driver code to use, sorry.
> > 
> > > Found by Linux Verification Center (linuxtesting.org) with SVACE.
> > 
> > As I have said before, your testing framework needs a lot more work.
> > 
> > good luck!
> 
> In situations like this, it might be better to remove the check 
> entirely.  If a driver does pass a NULL pointer, it will lead to an 
> invalid pointer dereference which will certainly cause an oops and might 
> very well crash the system.  That would be a lot more noticeable than an 
> error message hidden in a kernel log!
> 
> Greg, is there any general policy about the need for sanity checks such 
> as this one?  Like, don't put them in whenever a failure would lead 
> to an immediate fault which would be easy to track down?

That's the policy, no need to check if a caller is abusing the code and
will find out instantly.  Otherwise we end up checking on every
function, and that way lies madness.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ