1. 11 11月, 2010 1 次提交
  2. 11 8月, 2010 1 次提交
  3. 21 5月, 2010 1 次提交
  4. 19 3月, 2010 1 次提交
  5. 03 3月, 2010 7 次提交
  6. 17 2月, 2010 2 次提交
    • L
      USB: usbfs: properly clean up the as structure on error paths · ddeee0b2
      Linus Torvalds 提交于
      I notice that the processcompl_compat() function seems to be leaking the
      'struct async *as' in the error paths. 
      
      I think that the calling convention is fundamentally buggered. The
      caller is the one that did the "reap_as()" to get the as thing, the
      caller should be the one to free it too. 
      
      Freeing it in the caller also means that it very clearly always gets
      freed, and avoids the need for any "free in the error case too".
      
      From: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Marcus Meissner <meissner@suse.de>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ddeee0b2
    • G
      USB: usbfs: only copy the actual data received · d4a4683c
      Greg KH 提交于
      We need to only copy the data received by the device to userspace, not
      the whole kernel buffer, which can contain "stale" data.
      
      Thanks to Marcus Meissner for pointing this out and testing the fix.
      Reported-by: NMarcus Meissner <meissner@suse.de>
      Tested-by: NMarcus Meissner <meissner@suse.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d4a4683c
  7. 11 12月, 2009 1 次提交
    • A
      usbdevfs: move compat_ioctl handling to devio.c · 637e8a60
      Arnd Bergmann 提交于
      Half the compat_ioctl handling is in devio.c, the other
      half is in fs/compat_ioctl.c. This moves everything into
      one place for consistency.
      
      As a positive side-effect, push down the BKL into the
      ioctl methods.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NGreg Kroah-Hartman <gregkh@suse.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alon Bar-Lev <alon.barlev@gmail.com>
      Cc: David Vrabel <david.vrabel@csr.com>
      Cc: linux-usb@vger.kernel.org
      637e8a60
  8. 23 9月, 2009 4 次提交
    • A
      USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag · 01c6460f
      Alan Stern 提交于
      This patch (as1283) adds a new flag, USBDEVFS_URB_BULK_CONTINUATION,
      to usbfs.  It is intended for userspace libraries such as libusb and
      openusb.  When they have to break up a single usbfs bulk transfer into
      multiple URBs, they will set the flag on all but the first URB of the
      series.
      
      If an error other than an unlink occurs, the kernel will automatically
      cancel all the following URBs for the same endpoint and refuse to
      accept new submissions, until an URB is encountered that is not marked
      as a BULK_CONTINUATION.  Such an URB would indicate the start of a new
      transfer or the presence of an older library, so the kernel returns to
      normal operation.
      
      This enables libraries to delimit bulk transfers correctly, even in
      the presence of early termination as indicated by short packets.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      
      01c6460f
    • M
      USB: increase usbdevfs max isoc buffer size · 5971897f
      Markus Rechberger 提交于
      The current limit only allows isochronous transfers up to 32kbyte/urb,
      updating this to 192 kbyte/urb improves the reliability of the
      transfer. USB 2.0 transfer is possible with 32kbyte but increases the
      chance of corrupted/incomplete data when the system is performing some
      other tasks in the background.
      
      http://www.spinics.net/lists/linux-usb/msg19955.htmlSigned-off-by: NMarkus Rechberger <mrechberger@gmail.com>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5971897f
    • A
      USB: make the "usbfs_snoop" log more pertinent · 4c6e8971
      Alan Stern 提交于
      This patch (as1261) reduces the amount of detailed URB information
      logged by usbfs when the usbfs_snoop parameter is enabled.
      
      Currently we don't display the final status value for a completed URB.
      But we do display the entire data buffer twice: both before submission
      and after completion.  The after-completion display doesn't limit
      itself to the actual_length value.  But since usbmon is readily
      available in virtually all distributions, there's no reason for usbfs
      to print out any buffer contents at all!
      
      So this patch restricts the information to: userspace buffer pointer,
      endpoint number, type, and direction, length or actual_length, and
      timeout value or status.  Now everything fits neatly into a single
      line.
      
      Along with those changes, the patch also fixes the snoop output for
      the REAPURBNDELAY and REAPURBNDELAY32 ioctls.  The current version
      omits the 'N' from the names.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4c6e8971
    • A
      USB: add API for userspace drivers to "claim" ports · 7cbe5dca
      Alan Stern 提交于
      This patch (as1258) implements a feature that users have been asking
      for: It gives programs the ability to "claim" a port on a hub, via a
      new usbfs ioctl.  A device plugged into a "claimed" port will not be
      touched by the kernel beyond the immediate necessities of
      initialization and enumeration.
      
      In particular, when a device is plugged into a "claimed" port, the
      kernel will not select and install a configuration.  And when a config
      is installed by usbfs or sysfs, the kernel will not probe any drivers
      for any of the interfaces.  (However the kernel will fetch various
      string descriptors during enumeration.  One could argue that this
      isn't really necessary, but the strings are exported in sysfs.)
      
      The patch does not guarantee exclusive access to these devices; it is
      still possible for more than one program to open the device file
      concurrently.  Programs are responsible for coordinating access among
      themselves.
      
      A demonstration program showing how to use the new interface can be 
      found in an attachment to
      
      	http://marc.info/?l=linux-usb&m=124345857431452&w=2
      
      The patch also makes a small simplification to the hub driver,
      replacing a bunch of more-or-less useless variants of "out of memory"
      with a single message.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7cbe5dca
  9. 08 8月, 2009 2 次提交
  10. 13 7月, 2009 3 次提交
    • A
      USB: handle zero-length usbfs submissions correctly · 9180135b
      Alan Stern 提交于
      This patch (as1262) fixes a bug in usbfs: It refuses to accept
      zero-length transfers, and it insists that the buffer pointer be valid
      even if there is no data being transferred.
      
      The patch also consolidates a bunch of repetitive access_ok() checks
      into a single check, which incidentally fixes the lack of such a check
      for Isochronous URBs.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9180135b
    • O
      USB: fix race leading to a write after kfree in usbfs · 516a1a07
      Oliver Neukum 提交于
      this fixes a race between async_completed() and proc_reapurbnonblock().
      
      CPU A                   CPU B
      
      spin_lock(&ps->lock);
      list_move_tail(&as->asynclist, &ps->async_completed);
      spin_unlock(&ps->lock);
      
                                      if (!(as = async_getcompleted(ps)))
                                              return -EAGAIN;
                                      return processcompl(as, (void __user * __user *)arg);
      
      processcompl() calls free_async() which calls kfree(as)
      
      as->status = urb->status;
      if (as->signr) {
              sinfo.si_signo = as->signr;
              sinfo.si_errno = as->status;
              sinfo.si_code = SI_ASYNCIO;
              sinfo.si_addr = as->userurb;
              kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
                                    as->euid, as->secid);
      }
      snoop(&urb->dev->dev, "urb complete\n");
      snoop_urb(urb, as->userurb);
      
      write after kfree
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      516a1a07
    • O
      USB: fix memleak in usbfs · d794a021
      Oliver Neukum 提交于
      This patch fixes a memory leak in devio.c::processcompl
      
      If writing to user space fails the packet must be discarded, as it
      already has been removed from the queue of completed packets.
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d794a021
  11. 18 4月, 2009 1 次提交
    • D
      USB: add reset endpoint operations · 3444b26a
      David Vrabel 提交于
      Wireless USB endpoint state has a sequence number and a current
      window and not just a single toggle bit.  So allow HCDs to provide a
      endpoint_reset method and call this or clear the software toggles as
      required (after a clear halt, set configuration etc.).
      
      usb_settoggle() and friends are then HCD internal and are moved into
      core/hcd.h and all device drivers call usb_reset_endpoint() instead.
      
      If the device endpoint state has been reset (with a clear halt) but
      the host endpoint state has not then subsequent data transfers will
      not complete. The device will only work again after it is reset or
      disconnected.
      Signed-off-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      3444b26a
  12. 25 3月, 2009 3 次提交
  13. 18 3月, 2009 1 次提交
    • A
      USB: usbfs: keep async URBs until the device file is closed · 6ff10464
      Alan Stern 提交于
      The usbfs driver manages a list of completed asynchronous URBs.  But
      it is too eager to free the entries on this list: destroy_async() gets
      called whenever an interface is unbound or a device is removed, and it
      deallocates the outstanding struct async entries for all URBs on that
      interface or device.  This is wrong; the user program should be able
      to reap an URB any time after it has completed, regardless of whether
      or not the interface is still bound or the device is still present.
      
      This patch (as1222) moves the code for deallocating the completed list
      entries from destroy_async() to usbdev_release().  The outstanding
      entries won't be freed until the user program has closed the device
      file, thereby eliminating any possibility that the remaining URBs
      might still be reaped.
      
      This fixes a bug in which a program can hang in the USBDEVFS_REAPURB
      ioctl when the device is unplugged.
      Reported-and-tested-by: NMartin Poupe <martin.poupe@upek.com>
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6ff10464
  14. 28 1月, 2009 1 次提交
    • A
      USB: fix char-device disconnect handling · 501950d8
      Alan Stern 提交于
      This patch (as1198) fixes a conceptual bug: Somewhere along the line
      we managed to confuse USB class devices with USB char devices.  As a
      result, the code to send a disconnect signal to userspace would not be
      built if both CONFIG_USB_DEVICE_CLASS and CONFIG_USB_DEVICEFS were
      disabled.
      
      The usb_fs_classdev_common_remove() routine has been renamed to
      usbdev_remove() and it is now called whenever any USB device is
      removed, not just when a class device is unregistered.  The notifier
      registration and unregistration calls are no longer conditionally
      compiled.  And since the common removal code will always be called as
      part of the char device interface, there's no need to call it again as
      part of the usbfs interface; thus the invocation of
      usb_fs_classdev_common_remove() has been taken out of
      usbfs_remove_device().
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Reported-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Tested-by: NAlon Bar-Lev <alon.barlev@gmail.com>
      Cc: stable <stable@kernel.org>
      
      501950d8
  15. 08 1月, 2009 2 次提交
    • M
      USB: fix minor nit in usbfs checking · ed0c7720
      Mark Lord 提交于
      One minor nit did show up, though.  The patch below
      seems to make more sense than the code does without it.
      Signed-off-by: NMark Lord <mlord@pobox.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ed0c7720
    • P
      USB: Remove restrictions on signal numbers in devio.c · ff8973d9
      Phil Endecott 提交于
      Just over a year ago (!) I had this brief exchange with Alan Stern:
      
      >> It seems that the signal that can be used with USBDEVFS_DISCSIGNAL and 
      >> in usbdevfs_urb.signr is limited to the real-time signals SIGRTMIN to 
      >> SIGRTMAX. What's the rationale for this restriction? I believe that a 
      >> process can kill() itself with any signal number, can't it? I was 
      >> planning to use SIGIO for usbdevfs_urb.signr and SIGTERM (uncaught) for 
      >> USBDEVFS_DISCSIGNAL. I don't think I'll have a problem with using 
      >> SIGRTMIN+n instead, but I'm curious to know if there's some subtle 
      >> problem with the non-real-time signals that I should be aware of.
      >
      > I don't know of any reason for this restriction.
      
      Since no-one else could think of a reason either, I offer the following 
      patch which allows any signal to be used with USBDEVFS_DISCSIGNAL and 
      usbdevfs_urb.signr.
      Signed-off-by: NPhil Endecott <usbpatch@chezphil.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      ff8973d9
  16. 14 11月, 2008 2 次提交
  17. 18 10月, 2008 3 次提交
  18. 17 10月, 2008 1 次提交
  19. 22 7月, 2008 3 次提交