qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Gonglei <arei.gonglei@huawei.com>
Cc: qemu-devel@nongnu.org, peter.huangpeng@huawei.com
Subject: Re: [Qemu-devel] [PATCH v2] usb: drop active assert when pid is invalid
Date: Tue, 16 Feb 2016 14:54:03 +0100	[thread overview]
Message-ID: <1455630843.7504.100.camel@redhat.com> (raw)
In-Reply-To: <1455541449-5008-1-git-send-email-arei.gonglei@huawei.com>

  Hi,

> diff --git a/hw/usb/core.c b/hw/usb/core.c
> index bea5e1e..6fbcf00 100644
> --- a/hw/usb/core.c
> +++ b/hw/usb/core.c
> @@ -716,7 +716,6 @@ struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)
>      if (ep == 0) {
>          return &dev->ep_ctl;
>      }
> -    assert(pid == USB_TOKEN_IN || pid == USB_TOKEN_OUT);

Please keep this.

>      assert(ep > 0 && ep <= USB_MAX_ENDPOINTS);
>      return eps + ep - 1;
>  }
> diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
> index 5ccfb83..ff66397 100644
> --- a/hw/usb/hcd-uhci.c
> +++ b/hw/usb/hcd-uhci.c
> @@ -883,6 +883,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr,
>          /* invalid pid : frame interrupted */
>          uhci_async_free(async);
>          s->status |= UHCI_STS_HCPERR;
> +        s->cmd &= ~UHCI_CMD_RS;

When clearing RS in cmd we should also set HALTED in status I think.

How do we reach the assert above?  Maybe it is enough to move this pid
check to the start of the uhci_handle_td function to avoid triggering
the assert?

cheers,
  Gerd

  reply	other threads:[~2016-02-16 13:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 13:04 [Qemu-devel] [PATCH v2] usb: drop active assert when pid is invalid Gonglei
2016-02-16 13:54 ` Gerd Hoffmann [this message]
2016-02-16 14:30   ` Gonglei (Arei)
2016-02-16 14:38     ` Gerd Hoffmann

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=1455630843.7504.100.camel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.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).