From: David Ahern <daahern@cisco.com>
To: qemu-devel@nongnu.org
Cc: jan.kiszka@web.de, David Ahern <daahern@cisco.com>
Subject: [Qemu-devel] [PATCH] ehci: catch invalid qTD earlier - avoid reset
Date: Fri, 9 Jul 2010 15:17:53 -0600 [thread overview]
Message-ID: <1278710273-19639-1-git-send-email-daahern@cisco.com> (raw)
Catch invalid qTD earlier.
Signed-off-by: David Ahern <daahern@cisco.com>
---
hw/usb-ehci.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/hw/usb-ehci.c b/hw/usb-ehci.c
index 53ee1fb..47f3a54 100644
--- a/hw/usb-ehci.c
+++ b/hw/usb-ehci.c
@@ -838,11 +838,6 @@ static int ehci_qh_do_overlay(EHCIState *ehci, EHCIqh *qh, EHCIqtd *qtd)
int eps;
int reload;
- if (ehci->qtdaddr < 0x1000) {
- fprintf(stderr, "invalid address for qTD. resetting\n");
- return USB_RET_PROCERR;
- }
-
// remember values in fields to preserve in qh after overlay
dtoggle = qh->token & QTD_TOKEN_DTOGGLE;
@@ -1455,6 +1450,7 @@ static int ehci_state_advqueue(EHCIState *ehci, int async, int *state)
* want data and alt-next qTD is valid
*/
if (((ehci->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) &&
+ (ehci->qh.altnext_qtd > 0x1000) &&
(NLPTR_TBIT(ehci->qh.altnext_qtd) == 0)) {
DPRINTF_ST("ADVQUEUE: goto alt next qTD. "
"curr 0x%08x next 0x%08x alt 0x%08x (next qh %x)\n",
@@ -1466,8 +1462,10 @@ static int ehci_state_advqueue(EHCIState *ehci, int async, int *state)
/*
* next qTD is valid
*/
- } else if (NLPTR_TBIT(ehci->qh.next_qtd) == 0) {
- DPRINTF_ST("ADVQUEUE: next qTD. curr 0x%08x next 0x%08x alt 0x%08x (next qh %x)\n",
+ } else if ((ehci->qh.next_qtd > 0x1000) &&
+ (NLPTR_TBIT(ehci->qh.next_qtd) == 0)) {
+ DPRINTF_ST("ADVQUEUE: next qTD. "
+ "curr 0x%08x next 0x%08x alt 0x%08x (next qh %x)\n",
ehci->qh.current_qtd, ehci->qh.altnext_qtd,
ehci->qh.next_qtd, ehci->qh.next);
ehci->qtdaddr = ehci->qh.next_qtd;
--
1.7.1.1
reply other threads:[~2010-07-09 21:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1278710273-19639-1-git-send-email-daahern@cisco.com \
--to=daahern@cisco.com \
--cc=jan.kiszka@web.de \
--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).