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:   Wed, 09 Feb 2022 17:30:24 +0100
From:   "Fabio M. De Francesco" <fmdefrancesco@...il.com>
To:     Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzbot+60df062e1c41940cae0f@...kaller.appspotmail.com
Subject: Re: [PATCH] usb: core: Unregister device on component_add() failure

On mercoled? 9 febbraio 2022 15:00:09 CET Heikki Krogerus wrote:
> On Tue, Feb 08, 2022 at 06:00:48PM +0100, Fabio M. De Francesco wrote:
> > Commit 8c67d06f3fd9 ("usb: Link the ports to the connectors they are
> > attached to") creates a link to the USB Type-C connector for every new
> > port that is added when possible. If component_add() fails,
> > usb_hub_create_port_device() prints a warning but does not unregister
> > the device and does not return errors to the callers.
> > 
> > Syzbot reported a "WARNING in component_del()".
> > 
> > Fix this issue in usb_hub_create_port_device by calling device_unregister()
> > and returning the errors from component_add().
> > 
> > Reported-by: syzbot+60df062e1c41940cae0f@...kaller.appspotmail.com
> > Fixes: 8c67d06f3fd9 ("usb: Link the ports to the connectors they are attached to")
> > Signed-off-by: Fabio M. De Francesco <fmdefrancesco@...il.com>
> > ---
> >  drivers/usb/core/port.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > [...]
> >
> You didn't remove the peer links. Either remove them here separately,
> or alternatively you can also just shuffle the code so that you only
> create those links after the component_add() call:
>
> [...]
> 

Hello Heikki,

Thanks for your review and suggestion. I think that I'll use the second of the
two possible solutions (shuffle the code).

I had to spend some time to understand the code of usb_hub_create_port_device(),
component_add() and component_del(). Unfortunately, the USB core is very far from
the usual things I look at or care of. Therefore I missed that find_and_link_peer()
does some work that must be either unwound or simply postponed. I agree with you 
that the latter is the best solution.

I need some minutes to submit v2.

Again, thanks,

Fabio

> thanks,
> 
> -- 
> heikki
> 




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ