public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Németh Márton" <nm127@freemail.hu>
To: Greg Kroah-Hartman <gregkh@suse.de>, Pete Zaitcev <zaitcev@redhat.com>
Cc: linux-usb@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH, RFC] usbmon: correct computing of the ISO packets with mmap
Date: Sat, 13 Nov 2010 23:15:16 +0100	[thread overview]
Message-ID: <4CDF0DF4.4020405@freemail.hu> (raw)
In-Reply-To: <4CD9A96D.1010306@freemail.hu>

From: Márton Németh <nm127@freemail.hu>

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@freemail.hu>
---
--- 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 {


  parent reply	other threads:[~2010-11-13 22:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  6:40 usbmon: size of different fields? Németh Márton
2010-11-09 14:50 ` Pete Zaitcev
2010-11-09 20:05   ` Németh Márton
2010-11-09 21:23     ` [Wireshark-dev] " Guy Harris
2010-11-10 15:21       ` Pete Zaitcev
2010-11-10 17:36         ` Guy Harris
2010-11-13 22:15     ` Németh Márton [this message]
2010-11-14 19:40       ` [PATCH, RFC] usbmon: correct computing of the ISO packets with mmap Pete Zaitcev
2010-11-14 20:24         ` Németh Márton
2010-11-14 21:08           ` Pete Zaitcev
2010-11-14 23:25           ` Pete Zaitcev
2010-11-15  3:01             ` Alan Stern
2010-11-15  3:42               ` Pete Zaitcev
2010-11-15 15:01                 ` Alan Stern
2010-11-15  5:48             ` Németh Márton
2010-11-15  6:12               ` Pete Zaitcev
2010-11-15 15:06                 ` Alan Stern
2010-11-16  6:00               ` Németh Márton
2010-11-09 15:05 ` usbmon: size of different fields? Alan Stern

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=4CDF0DF4.4020405@freemail.hu \
    --to=nm127@freemail.hu \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=zaitcev@redhat.com \
    /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