提交 eb4459ff 编写于 作者: T Tilman Schmidt 提交者: David S. Miller

gigaset: handle isoc frame errors more gracefully

Don't drop the remainder of an URB if an isochronous frame has an error.

Impact: error handling improvement
Signed-off-by: NTilman Schmidt <tilman@imap.cc>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ee239d99
...@@ -1331,28 +1331,24 @@ static void read_iso_tasklet(unsigned long data) ...@@ -1331,28 +1331,24 @@ static void read_iso_tasklet(unsigned long data)
rcvbuf = urb->transfer_buffer; rcvbuf = urb->transfer_buffer;
totleft = urb->actual_length; totleft = urb->actual_length;
for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) { for (frame = 0; totleft > 0 && frame < BAS_NUMFRAMES; frame++) {
if (unlikely(urb->iso_frame_desc[frame].status)) { numbytes = urb->iso_frame_desc[frame].actual_length;
if (unlikely(urb->iso_frame_desc[frame].status))
dev_warn(cs->dev, dev_warn(cs->dev,
"isochronous read: frame %d: %s\n", "isochronous read: frame %d[%d]: %s\n",
frame, frame, numbytes,
get_usb_statmsg( get_usb_statmsg(
urb->iso_frame_desc[frame].status)); urb->iso_frame_desc[frame].status));
break; if (unlikely(numbytes > BAS_MAXFRAME))
}
numbytes = urb->iso_frame_desc[frame].actual_length;
if (unlikely(numbytes > BAS_MAXFRAME)) {
dev_warn(cs->dev, dev_warn(cs->dev,
"isochronous read: frame %d: " "isochronous read: frame %d: "
"numbytes (%d) > BAS_MAXFRAME\n", "numbytes (%d) > BAS_MAXFRAME\n",
frame, numbytes); frame, numbytes);
break;
}
if (unlikely(numbytes > totleft)) { if (unlikely(numbytes > totleft)) {
dev_warn(cs->dev, dev_warn(cs->dev,
"isochronous read: frame %d: " "isochronous read: frame %d: "
"numbytes (%d) > totleft (%d)\n", "numbytes (%d) > totleft (%d)\n",
frame, numbytes, totleft); frame, numbytes, totleft);
break; numbytes = totleft;
} }
offset = urb->iso_frame_desc[frame].offset; offset = urb->iso_frame_desc[frame].offset;
if (unlikely(offset + numbytes > BAS_INBUFSIZE)) { if (unlikely(offset + numbytes > BAS_INBUFSIZE)) {
...@@ -1361,7 +1357,7 @@ static void read_iso_tasklet(unsigned long data) ...@@ -1361,7 +1357,7 @@ static void read_iso_tasklet(unsigned long data)
"offset (%d) + numbytes (%d) " "offset (%d) + numbytes (%d) "
"> BAS_INBUFSIZE\n", "> BAS_INBUFSIZE\n",
frame, offset, numbytes); frame, offset, numbytes);
break; numbytes = BAS_INBUFSIZE - offset;
} }
gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs); gigaset_isoc_receive(rcvbuf + offset, numbytes, bcs);
totleft -= numbytes; totleft -= numbytes;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册