usb: fix potential isoread overruns, error instead of panic on isoread in ohci

This commit is contained in:
cinap_lenrek 2012-09-03 04:23:02 +02:00
parent cfd25faa28
commit 0c52215ae3
3 changed files with 7 additions and 1 deletions

View file

@ -1660,7 +1660,7 @@ epread(Ep *ep, void *a, long count)
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);

View file

@ -1156,6 +1156,8 @@ episoread(Ep *ep, Isoio *iso, void *a, int count)
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;

View file

@ -1881,6 +1881,8 @@ episohscpy(Ctlr *ctlr, Ep *ep, Isoio* iso, uchar *b, long count)
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 @@ episofscpy(Ctlr *ctlr, Ep *ep, Isoio* iso, uchar *b, long count)
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);