linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: bugzilla-daemon@bugzilla.kernel.org
Cc: linux-usb@vger.kernel.org
Subject: Re: [Bug 212995] New: A possible divide by zero in qh_urb_transaction
Date: Sat, 8 May 2021 13:18:00 +0200	[thread overview]
Message-ID: <YJZzaGrRbGYLuWRj@kroah.com> (raw)
In-Reply-To: <bug-212995-208809@https.bugzilla.kernel.org/>

On Sat, May 08, 2021 at 11:14:25AM +0000, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=212995
> 
>             Bug ID: 212995
>            Summary: A possible divide by zero in qh_urb_transaction
>            Product: Drivers
>            Version: 2.5
>     Kernel Version: 5.12.2
>           Hardware: All
>                 OS: Linux
>               Tree: Mainline
>             Status: NEW
>           Severity: normal
>           Priority: P1
>          Component: USB
>           Assignee: drivers_usb@kernel-bugs.kernel.org
>           Reporter: yguoaz@gmail.com
>         Regression: No
> 
> In the file drivers/usb/host/ehci-q.c, the function qh_urb_transaction has the
> following code (link to the code location:
> https://github.com/torvalds/linux/blob/dd860052c99b1e088352bdd4fb7aef46f8d2ef47/drivers/usb/host/ehci-q.c#L715):
> 
> maxpacket = usb_maxpacket(urb->dev, urb->pipe, !is_input);
> ...
> if (usb_pipeout(urb->pipe) && (urb->transfer_flags & URB_ZERO_PACKET)
>                            && !(urb->transfer_buffer_length % maxpacket))
> 
> However, the function usb_maxpacket may retun 0, leading to a possible divide
> zero problem in the remainder operation:

Please feel free to submit a patch to the developers, but first see how
it could be possible for usb_maxpacket to ever return 0 for this.  Are
you sure it's not already sanitized by the time it gets here?

thanks,

greg k-h

  reply	other threads:[~2021-05-08 11:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-08 11:14 [Bug 212995] New: A possible divide by zero in qh_urb_transaction bugzilla-daemon
2021-05-08 11:18 ` Greg KH [this message]
2021-05-08 11:18 ` [Bug 212995] " bugzilla-daemon
2021-05-08 11:37 ` bugzilla-daemon
2021-05-08 14:36 ` bugzilla-daemon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YJZzaGrRbGYLuWRj@kroah.com \
    --to=greg@kroah.com \
    --cc=bugzilla-daemon@bugzilla.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).