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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1904170942530.27339-100000@netrider.rowland.org>
Date:   Wed, 17 Apr 2019 09:45:04 -0400 (EDT)
From:   Alan Stern <stern@...land.harvard.edu>
To:     "zhuyan (M)" <zhuyan34@...wei.com>
cc:     Greg KH <gregkh@...uxfoundation.org>,
        "anton@...msg.org" <anton@...msg.org>,
        "linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb:host: fix divide-by-zero in function fhci_queue_urb

On Wed, 17 Apr 2019, zhuyan (M) wrote:

> On Tue, 16 Apr 2019 11:07:56 -0400, Alan Stern wrote:
> 
> > On Tue, 16 Apr 2019, zhuyan (M) wrote:
> > > On Tue, 16 Apr 2019 at 11:45:45 +0200, Greg KH wrote:
> > > > On Tue, Apr 09, 2019 at 10:37:12PM +0800, zhuyan wrote:
> > > > > In function fhci_queue_urb, the divisor of expression 
> > > > > (urb->transfer_buffer_length % usb_maxpacket(urb->dev, urb->pipe,
> > > > > usb_pipeout(urb->pipe))) may be zero.
> > > > 
> > > > How can you hit that?
> > > > 
> > > > > When it is zero, unexpected results may occur, so it is necessary 
> > > > > to ensure that the divisor is not zero.
> > > > > 
> > > > > Signed-off-by: zhuyan <zhuyan34@...wei.com>
> > > > 
> > > > I need a "Full" name here, not just a single name.  Whatever you use to sign documents is good.
> > > > 
> > > > thanks,
> > > > 
> > > > greg k-h
> > > 
> > > In function usb_maxpacket, when ep is NULL, its return value is 0.  
> > 
> > fhci_queue_urb() shouldn't use urb->pipe to compute the maxpacket size 
> > anyway.  It should use usb_endpoint_maxp(&urb->ep->desc).
> 
> Currently, fhci_queue_urb(), call usb_maxpacket() multiple times to calculate
>  the maxpacket size. The usb_maxpacket() will call usb_endpoint_maxp() to 
> compute the maxpacket size.

I know that.  What fhci_queue_urb() is doing is wrong.  You should
change it: Make it call usb_endpoint_maxp directly instead of calling
usb_maxpacket.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ