ref: 19ef151c50242ec11608fbe2a793fd6205978c42
parent: 234d8ff34a5defef6022853b090f0692a45bcded
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Mon Sep 3 00:23:02 EDT 2012
usb: fix potential isoread overruns, error instead of panic on isoread in ohci
--- a/sys/src/9/pc/usbohci.c
+++ b/sys/src/9/pc/usbohci.c
@@ -1660,7 +1660,7 @@
clrhalt(ep);
return epio(ep, &io[OREAD], a, count, 1);
case Tiso:
- panic("ohci: iso read not implemented");+ error("iso read not implemented");break;
default:
panic("epread: bad ep ttype %d", ep->ttype);--- a/sys/src/9/pc/usbuhci.c
+++ b/sys/src/9/pc/usbuhci.c
@@ -1156,6 +1156,8 @@
iunlock(ctlr); /* We could page fault here */
memmove(b+tot, tdu->data, nr);
ilock(ctlr);
+ if(iso->tdu != tdu)
+ continue;
if(nr < tdu->ndata)
memmove(tdu->data, tdu->data+nr, tdu->ndata - nr);
tdu->ndata -= nr;
--- a/sys/src/9/port/usbehci.c
+++ b/sys/src/9/port/usbehci.c
@@ -1881,6 +1881,8 @@
iunlock(ctlr); /* We could page fault here */
memmove(b+tot, tdu->data, nr);
ilock(ctlr);
+ if(iso->tdu != tdu)
+ continue;
if(nr < tdu->ndata)
memmove(tdu->data, tdu->data+nr, tdu->ndata - nr);
tdu->ndata -= nr;
@@ -1917,6 +1919,8 @@
iunlock(ctlr); /* We could page fault here */
memmove(b+tot, stdu->data, nr);
ilock(ctlr);
+ if(iso->stdu != stdu)
+ continue;
if(nr < stdu->ndata)
memmove(stdu->data, stdu->data+nr,
stdu->ndata - nr);
--
⑨