[PATCH, RFC] usbmon: correct computing of the ISO packets with mmap

From: NÃmeth MÃrton
Date: Sat Nov 13 2010 - 17:15:56 EST


From: MÃrton NÃmeth <nm127@xxxxxxxxxxx>

The length of the isochronous packets were not computed correctly in case of memory
mapped operation because the gaps between the isodesc data were not taken into
account. The last data byte can be found at offset+actual_length of the
last ISO description.

This patch fixes the problem described at https://bugzilla.kernel.org/show_bug.cgi?id=22182 .

Signed-off-by: MÃrton NÃmeth <nm127@xxxxxxxxxxx>
---
--- linux-2.6.37-rc1/drivers/usb/mon/mon_bin.c.orig 2010-10-20 22:30:22.000000000 +0200
+++ linux-2.6.37-rc1/drivers/usb/mon/mon_bin.c 2010-11-13 22:29:09.000000000 +0100
@@ -515,6 +515,26 @@ static void mon_bin_event(struct mon_rea
}

if (rp->mmap_active) {
+ if (usb_endpoint_xfer_isoc(epd) &&
+ ((usb_urb_dir_in(urb) && ev_type == 'C') ||
+ (usb_urb_dir_out(urb) && ev_type == 'S'))) {
+ int i;
+
+ /* Search for the last ISO descritor with OK status
+ * and non-zero length
+ */
+ length = 0;
+ i = urb->number_of_packets - 1;
+ while (0 <= i &&
+ (urb->iso_frame_desc[i].status != 0 ||
+ urb->iso_frame_desc[i].actual_length == 0)) {
+ i--;
+ }
+ if (0 <= i) {
+ length = urb->iso_frame_desc[i].offset +
+ urb->iso_frame_desc[i].actual_length;
+ }
+ }
offset = mon_buff_area_alloc_contiguous(rp,
length + PKT_SIZE + lendesc);
} else {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/