1. 25 1月, 2016 3 次提交
  2. 23 12月, 2015 1 次提交
  3. 02 12月, 2015 2 次提交
    • A
      USB: add usbfs snooping for REAP and DISCARD · a016a816
      Alan Stern 提交于
      This patch improves the usbfs_snoop debugging facility by adding
      messages for a couple of significant events which, up to now, have not
      been logged.  The events are reaping and discarding (i.e.,
      cancelling) an URB.  The debugging messages include the userspace
      address of the URB being reaped or discarded.
      
      The reaping messages have to be added in four places, in order to
      handle blocking and non-blocking reaps in both normal and 32-bit
      compatibility mode.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a016a816
    • A
      USB: limit usbfs snooping of URB contents · 0290cc9f
      Alan Stern 提交于
      The usbfs_snoop facility can be very useful for debugging problems
      involving usbfs.  However, it always prints out the entire contents of
      every URB.  When dealing with large quantities of data, this can be
      less than helpful.
      
      This patch ameliorates the situation by adding a module parameter to
      usbcore for controlling the maximum number of bytes to print when
      snooping an URB.  This makes debugging much easier.  For backward
      compatibility, the default value is set unreasonably high.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0290cc9f
  4. 09 8月, 2015 1 次提交
  5. 06 8月, 2015 1 次提交
  6. 25 5月, 2015 1 次提交
  7. 10 4月, 2015 1 次提交
  8. 25 2月, 2015 1 次提交
  9. 01 2月, 2015 1 次提交
  10. 02 8月, 2014 1 次提交
  11. 11 3月, 2014 1 次提交
  12. 05 3月, 2014 5 次提交
  13. 25 2月, 2014 1 次提交
    • A
      USB: complain if userspace resets an active endpoint · f080a51b
      Alan Stern 提交于
      It is an error for a driver to call usb_clear_halt() or
      usb_reset_endpoint() while there are URBs queued for the endpoint,
      because the end result is not well defined.  At the time the endpoint
      gets reset, it may or may not be actively running.
      
      As far as I know, no kernel drivers do this.  But some userspace
      drivers do, and it seems like a good idea to bring this error to their
      attention.
      
      This patch adds a warning to the kernel log whenever a program invokes
      the USBDEVFS_CLEAR_HALT or USBDEVFS_RESETEP ioctls at an inappropriate
      time, and includes the name of the program.  This will make it clear
      that any subsequent errors are not due to the misbehavior of a kernel
      driver.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Suggested-by: NBjørn Mork <bjorn@mork.no>
      CC: Stanislaw Gruszka <sgruszka@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f080a51b
  14. 08 1月, 2014 1 次提交
  15. 17 10月, 2013 2 次提交
  16. 26 9月, 2013 1 次提交
    • K
      usb/core/devio.c: Don't reject control message to endpoint with wrong direction bit · 831abf76
      Kurt Garloff 提交于
      Trying to read data from the Pegasus Technologies NoteTaker (0e20:0101)
      [1] with the Windows App (EasyNote) works natively but fails when
      Windows is running under KVM (and the USB device handed to KVM).
      
      The reason is a USB control message
       usb 4-2.2: control urb: bRequestType=22 bRequest=09 wValue=0200 wIndex=0001 wLength=0008
      This goes to endpoint address 0x01 (wIndex); however, endpoint address
      0x01 does not exist. There is an endpoint 0x81 though (same number,
      but other direction); the app may have meant that endpoint instead.
      
      The kernel thus rejects the IO and thus we see the failure.
      
      Apparently, Linux is more strict here than Windows ... we can't change
      the Win app easily, so that's a problem.
      
      It seems that the Win app/driver is buggy here and the driver does not
      behave fully according to the USB HID class spec that it claims to
      belong to.  The device seems to happily deal with that though (and
      seems to not really care about this value much).
      
      So the question is whether the Linux kernel should filter here.
      Rejecting has the risk that somewhat non-compliant userspace apps/
      drivers (most likely in a virtual machine) are prevented from working.
      Not rejecting has the risk of confusing an overly sensitive device with
      such a transfer. Given the fact that Windows does not filter it makes
      this risk rather small though.
      
      The patch makes the kernel more tolerant: If the endpoint address in
      wIndex does not exist, but an endpoint with toggled direction bit does,
      it will let the transfer through. (It does NOT change the message.)
      
      With attached patch, the app in Windows in KVM works.
       usb 4-2.2: check_ctrlrecip: process 13073 (qemu-kvm) requesting ep 01 but needs 81
      
      I suspect this will mostly affect apps in virtual environments; as on
      Linux the apps would have been adapted to the stricter handling of the
      kernel. I have done that for mine[2].
      
      [1] http://www.pegatech.com/
      [2] https://sourceforge.net/projects/notetakerpen/Signed-off-by: NKurt Garloff <kurt@garloff.de>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      831abf76
  17. 18 9月, 2013 1 次提交
  18. 26 7月, 2013 1 次提交
    • H
      usbfs: Allow printer class 'get_device_id' without needing to claim the intf · 5dc50c35
      Hans de Goede 提交于
      For certain (HP) printers the printer device_id does not only contain a
      static part identifying the printer, but it also contains a dynamic part
      giving printer status, ink level, etc.
      
      To get to this info various userspace utilities need to be able to make a
      printer class 'get_device_id' request without first claiming the interface
      (as that is in use for the actual printer driver).
      
      Since the printer class 'get_device_id' request does not change interface
      settings in anyway, allowing this without claiming the interface should not
      cause any issues.
      
      CC: Sanjay Kumar <sanjay.kumar14@hp.com>
      CC: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5dc50c35
  19. 29 5月, 2013 1 次提交
  20. 18 5月, 2013 3 次提交
  21. 18 4月, 2013 1 次提交
  22. 23 2月, 2013 1 次提交
  23. 07 2月, 2013 1 次提交
  24. 18 10月, 2012 1 次提交
  25. 11 9月, 2012 1 次提交
    • H
      usbfs: Add a new disconnect-and-claim ioctl (v2) · 0837e7e5
      Hans de Goede 提交于
      Apps which deal with devices which also have a kernel driver, need to do
      the following:
      1) Check which driver is attached, so as to not detach the wrong driver
         (ie detaching usbfs while another instance of the app is using the device)
      2) Detach the kernel driver
      3) Claim the interface
      
      Where moving from one step to the next for both 1-2 and 2-3 consists of
      a (small) race window. So currently such apps are racy and people just live
      with it.
      
      This patch adds a new ioctl which makes it possible for apps to do this
      in a race free manner. For flexibility apps can choose to:
      1) Specify the driver to disconnect
      2) Specify to disconnect any driver except for the one named by the app
      3) Disconnect any driver
      
      Note that if there is no driver attached, the ioctl will just act like the
      regular claim-interface ioctl, this is by design, as returning an error for
      this condition would open a new bag of race-conditions.
      
      Changes in v2:
      -Fix indentation of if blocks where the condition spans multiple lines
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0837e7e5
  26. 07 7月, 2012 3 次提交
    • H
      usbdevfs: Use scatter-gather lists for large bulk transfers · 3d97ff63
      Hans de Goede 提交于
      When using urb->transfer_buffer we need to allocate physical contiguous buffers
      for the entire transfer, which is pretty much guaranteed to fail with large
      transfers.
      
      Currently userspace works around this by breaking large transfers into multiple
      urbs. For large bulk transfers this leads to all kind of complications.
      
      This patch makes it possible for userspace to reliable submit large bulk
      transfers to scatter-gather capable host controllers in one go, by using a
      scatterlist to break the transfer up in managable chunks.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d97ff63
    • H
      usbdevfs: Add a USBDEVFS_GET_CAPABILITIES ioctl · 19181bc5
      Hans de Goede 提交于
      There are a few (new) usbdevfs capabilities which an application cannot
      discover in any other way then checking the kernel version. There are 3
      problems with this:
      1) It is just not very pretty.
      2) Given the tendency of enterprise distros to backport stuff it is not
      reliable.
      3) As discussed in length on the mailinglist, USBDEVFS_URB_BULK_CONTINUATION
      does not work as it should when combined with USBDEVFS_URB_SHORT_NOT_OK
      (which is its intended use) on devices attached to an XHCI controller.
      So the availability of these features can be host controller dependent,
      making depending on them based on the kernel version not a good idea.
      
      This patch besides adding the new ioctl also adds flags for the following
      existing capabilities:
      
      USBDEVFS_CAP_ZERO_PACKET,        available since 2.6.31
      USBDEVFS_CAP_BULK_CONTINUATION,  available since 2.6.32, except for XHCI
      USBDEVFS_CAP_NO_PACKET_SIZE_LIM, available since 3.3
      
      Note that this patch only does not advertise the USBDEVFS_URB_BULK_CONTINUATION
      cap for XHCI controllers, bulk transfers with this flag set will still be
      accepted when submitted to XHCI controllers.
      
      Returning -EINVAL for them would break existing apps, and in most cases the
      troublesome scenario wrt USBDEVFS_URB_SHORT_NOT_OK urbs on XHCI controllers
      will never get hit, so this would break working use cases.
      
      The disadvantage of not returning -EINVAL is that cases were it is causing
      real trouble may go undetected / the cause of the trouble may be unclear,
      but this is the best we can do.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19181bc5
    • H
      usbdevfs: Correct amount of data copied to user in processcompl_compat · 2102e06a
      Hans de Goede 提交于
      iso data buffers may have holes in them if some packets were short, so for
      iso urbs we should always copy the entire buffer, just like the regular
      processcompl does.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      CC: stable@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2102e06a
  27. 19 5月, 2012 1 次提交
    • H
      USB: Remove races in devio.c · 4e09dcf2
      Huajun Li 提交于
      There exist races in devio.c, below is one case,
      and there are similar races in destroy_async()
      and proc_unlinkurb().  Remove these races.
      
       cancel_bulk_urbs()        async_completed()
      -------------------                -----------------------
       spin_unlock(&ps->lock);
      
                                 list_move_tail(&as->asynclist,
      		                    &ps->async_completed);
      
                                 wake_up(&ps->wait);
      
                                 Lead to free_async() be triggered,
                                 then urb and 'as' will be freed.
      
       usb_unlink_urb(as->urb);
       ===> refer to the freed 'as'
      Signed-off-by: NHuajun Li <huajun.li.lee@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oncaphillis <oncaphillis@snafu.de>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e09dcf2
  28. 30 4月, 2012 1 次提交