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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200225202223.GA9154@lxhi-065.adit-jv.com>
Date:   Tue, 25 Feb 2020 21:22:23 +0100
From:   Eugeniu Rosca <erosca@...adit-jv.com>
To:     Alan Stern <stern@...land.harvard.edu>
CC:     <linux-usb@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
        "Lee, Chiasheng" <chiasheng.lee@...el.com>,
        Mathieu Malaterre <malat@...ian.org>,
        Kai-Heng Feng <kai.heng.feng@...onical.com>,
        Hardik Gajjar <hgajjar@...adit-jv.com>,
        <scan-admin@...erity.com>, Eugeniu Rosca <erosca@...adit-jv.com>,
        Eugeniu Rosca <roscaeugeniu@...il.com>
Subject: Re: [PATCH] usb: hub: Fix unhandled return value of
 usb_autopm_get_interface()

Hi Alan,

On Tue, Feb 25, 2020 at 02:39:23PM -0500, Alan Stern wrote:
> On Tue, 25 Feb 2020, Eugeniu Rosca wrote:
> > [1] (v5.6-rc3) git grep -En "[^=]\s+usb_autopm_get_interface\("
> >   drivers/input/touchscreen/usbtouchscreen.c:1788:  usb_autopm_get_interface(intf);
> >   drivers/media/usb/stkwebcam/stk-webcam.c:628:     usb_autopm_get_interface(dev->interface);
> >   drivers/net/usb/hso.c:1308:                       usb_autopm_get_interface(serial->parent->interface);
> >   drivers/net/usb/r8152.c:5231:                     usb_autopm_get_interface(tp->intf);
> >   sound/usb/usx2y/us122l.c:192:                     usb_autopm_get_interface(iface);
> 
> Your regular expression isn't right because it doesn't match lines
> where the usb_autopm_get_interface() is preceded only by one whitespace
> character (i.e., a tab).  It also will match lines where there are two
> space characters between the = sign and the function name.  I think
> what you want is more like "(^|[^=[:space:]])\s*" at the start of the
> RE.

Agreed. My version filters out some true positives.

> 
> A revised search finds line 997 in drivers/usb/core/hub.c and lines
> 216, 269 in drivers/usb/core/port.c.  (I didn't try looking in any
> other directories.)  AFAICT all three of these should check the return
> value, although a error message in the kernel log probably isn't
> needed.
> 
> Do you want to fix those instances up also, maybe merging them in with
> the existing patch?

I wonder if squashing all these fixes into one patch is the best option.

There are three commits fixed by the proposed changes in usb core:
 - v5.6-rc3 commit 1208f9e1d758c9 ("USB: hub: Fix the broken detection of USB3 device in SMSC hub")
 - v3.9-rc1 commit 971fcd492cebf5 ("usb: add runtime pm support for usb port device")
 - v2.6.33-rc1 commit 253e05724f9230 ("USB: add a "remove hardware" sysfs attribute")

I assume a single fix will create some pain when applying it to the
stable branches. Do you have any preference/inputs about that?

-- 
Best Regards
Eugeniu Rosca

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ