1. 12 12月, 2009 1 次提交
  2. 18 11月, 2009 1 次提交
    • A
      USB: usbmon: fix bug in mon_buff_area_shrink · fca94748
      Alan Stern 提交于
      This patch (as1299b) fixes a bug in an error-handling path of usbmon's
      binary interface.  The storage area for URB data is divided into
      fixed-size blocks.  If an URB's data can't be copied, the area
      reserved for it should be decreased to the size of the truncated
      information (rounded up to a block boundary).  Rounding up the amount
      to be removed and subtracting it from the reserved size is definitely
      the wrong thing to do.
      
      Also, when the data for an isochronous URB can't be copied, we can
      still copy the isoc packet descriptors.  In fact the current code does
      copy the descriptors, but then sets the capture length to 0 so they
      remain inaccessible.  The capture length should be reduced to the
      length of the descriptors, not set to 0.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NPete Zaitcev <zaitcev@redhat.com>
      CC: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      fca94748
  3. 28 9月, 2009 1 次提交
  4. 23 9月, 2009 1 次提交
    • P
      USB: usbmon: end ugly tricks with DMA peeking · 4e9e9200
      Pete Zaitcev 提交于
      This patch fixes crashes when usbmon attempts to access GART aperture.
      The old code attempted to take a bus address and convert it into a
      virtual address, which clearly was impossible on systems with actual
      IOMMUs. Let us not persist in this foolishness, and use transfer_buffer
      in all cases instead.
      
      I think downsides are negligible. The ones I see are:
       - A driver may pass an address of one buffer down as transfer_buffer,
         and entirely different entity mapped for DMA, resulting in misleading
         output of usbmon. Note, however, that PIO based controllers would
         do transfer the same data that usbmon sees here.
       - Out of tree drivers may crash usbmon if they store garbage in
         transfer_buffer. I inspected the in-tree drivers, and clarified
         the documentation in comments.
       - Drivers that use get_user_pages will not be possible to monitor.
         I only found one driver with this problem (drivers/staging/rspiusb).
       - Same happens with with usb_storage transferring from highmem, but
         it works fine on 64-bit systems, so I think it's not a concern.
         At least we don't crash anymore.
      
      Why didn't we do this in 2.6.10? That's because back in those days
      it was popular not to fill in transfer_buffer, so almost all
      traffic would be invisible (e.g. all of HID was like that).
      But now, the tree is almost 100% PIO friendly, so we can do the
      right thing at last.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4e9e9200
  5. 07 7月, 2009 1 次提交
    • K
      Fix virt_to_phys() warnings · 5bfd7560
      Kevin Cernekee 提交于
      These warnings were observed on MIPS32 using 2.6.31-rc1 and gcc-4.2.0:
      
      mm/page_alloc.c: In function 'alloc_pages_exact':
      mm/page_alloc.c:1986: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast
      
      drivers/usb/mon/mon_bin.c: In function 'mon_alloc_buff':
      drivers/usb/mon/mon_bin.c:1264: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast
      
      [akpm@linux-foundation.org: fix kernel/perf_counter.c too]
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5bfd7560
  6. 25 3月, 2009 1 次提交
  7. 28 1月, 2009 1 次提交
    • P
      USB: usbmon: Implement compat_ioctl · 7abce6be
      Pete Zaitcev 提交于
      Running a 32-bit usbmon(8) on 2.6.28-rc9 produces the following:
      ioctl32(usbmon:28563): Unknown cmd fd(3) cmd(400c9206){t:ffffff92;sz:12} arg(ffd3f458) on /dev/usbmon0
      
      It happens because the compatibility mode was implemented for 2.6.18
      and not updated for the fsops.compat_ioctl API.
      
      This patch relocates the pieces from under #ifdef CONFIG_COMPAT into
      compat_ioctl with no other changes except one new whitespace.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7abce6be
  8. 20 11月, 2008 1 次提交
    • P
      USB: usbmon: fix read(2) · f1c0a2a3
      Pete Zaitcev 提交于
      There's a bug in the usbmon binary reader: When using read() to fetch
      the packets and a packet's data is partially read, the next read call
      will once again return up to len_cap bytes of data. The b_read counter
      is not regarded when determining the remaining chunk size.
      
      So, when dumping USB data with "cat /dev/usbmon0 > usbmon.trace" while
      reading from a USB storage device and analyzing the dump file
      afterwards it will get out of sync after a couple of packets.
      Signed-off-by: NIngo van Lil <inguin@gmx.de>
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f1c0a2a3
  9. 17 10月, 2008 1 次提交
  10. 22 7月, 2008 1 次提交
  11. 21 6月, 2008 1 次提交
  12. 25 4月, 2008 1 次提交
  13. 02 2月, 2008 3 次提交
  14. 13 10月, 2007 4 次提交
  15. 13 7月, 2007 1 次提交
    • P
      usbmon: Add class for binary interface · ce7cd137
      Pete Zaitcev 提交于
      Add a class which allows for an easier integration with udev.
      
      This code was originally written by Paolo Abeni, and arrived to my tree
      as a part of big patch to add binary API on December 18. As I understand,
      Paolo always meant the class to be a part of the whole thing. This is his
      udev rule to go along with the patch:
      
      KERNEL=="usbmon[0-9]*", NAME="usbmon%n", MODE="0440",OWNER="root",GROUP="bin"
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ce7cd137
  16. 28 4月, 2007 1 次提交
    • P
      usbmon: bus zero · ecb658d3
      Pete Zaitcev 提交于
      Add the "bus zero" feature to the usbmon. If a user process specifies bus
      with number zero, it receives events from all buses. This is useful when
      we wish to see initial enumeration when a bus is created, typically after
      a modprobe. Until now, an application had to loop until a new bus could
      be open, then start capturing on it. This procedure was cumbersome and
      could lose initial events. Also, often it's too bothersome to find exactly
      to which bus a specific device is attached.
      
      Paolo Albeni provided the original concept implementation. I added the
      handling of "bus->monitored" flag and generally fixed it up.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ecb658d3
  17. 24 2月, 2007 1 次提交
  18. 08 2月, 2007 1 次提交
    • P
      USB: add binary API to usbmon · 6f23ee1f
      Pete Zaitcev 提交于
      This patch adds a new, "binary" API in addition to the old, text API usbmon
      had before. The new API allows for less CPU use, and it allows to capture
      all data from a packet where old API only captured 32 bytes at most. There
      are some limitations and conditions to this, e.g. in case someone constructs
      a URB with 1GB of data, it's not likely to be captured, because even the
      huge buffers of the new reader are finite. Nonetheless, I expect this new
      capability to capture all data for all real life scenarios.
      
      The downside is, a special user mode application is required where cat(1)
      worked before. I have sample code at http://people.redhat.com/zaitcev/linux/
      and Paolo Abeni is working on patching libpcap.
      
      This patch was initially written by Paolo and later I tweaked it, and
      we had a little back-and-forth. So this is a jointly authored patch, but
      I am submitting this I am responsible for the bugs.
      Signed-off-by: NPaolo Abeni <paolo.abeni@email.it>
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      6f23ee1f