1. 30 3月, 2009 2 次提交
    • O
      HID: fix race between usb_register_dev() and hiddev_open() · e43bd67d
      Oliver Neukum 提交于
      upon further thought this code is still racy.
      
      	retval = usb_register_dev(usbhid->intf, &hiddev_class);
      
      here you open a window during which open can happen
      
      	if (retval) {
      		err_hid("Not able to get a minor for this device.");
      		hid->hiddev = NULL;
      		kfree(hiddev);
      		return -1;
      	} else {
      		hid->minor = usbhid->intf->minor;
      		hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
      
      and will fail because hiddev_table hasn't been updated
      
      The obvious fix of using a mutex to guard hiddev_table doesn't work because
      usb_open() and usb_register_dev() take minor_rwsem and we'd have an AB-BA
      deadlock. We need a lock usb_open() also takes in the right order and that leaves
      only one option, BKL. I don't like it but I see no alternative.
      
      Once the usb_open() implements something better than lock_kernel(), we could also
      do so.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e43bd67d
    • J
      HID: bring back possibility to specify vid/pid ignore on module load · 6f4303fb
      Jiri Kosina 提交于
      When hid quirks were converted to specialized driver, the HID_QUIRK_IGNORE
      has been moved completely, as the hid_ignore_list[] has been moved into the
      generic code.
      
      However userspace already got used to the possibility that modprobing
      usbhid with
      
      	'quirks=vid:pid:0x4'
      
      makes the device ignored by usbhid driver. So keep this quirk flag in place
      for backwards compatibility.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6f4303fb
  2. 26 3月, 2009 5 次提交
  3. 16 3月, 2009 1 次提交
    • J
      Rationalize fasync return values · 60aa4924
      Jonathan Corbet 提交于
      Most fasync implementations do something like:
      
           return fasync_helper(...);
      
      But fasync_helper() will return a positive value at times - a feature used
      in at least one place.  Thus, a number of other drivers do:
      
           err = fasync_helper(...);
           if (err < 0)
                   return err;
           return 0;
      
      In the interests of consistency and more concise code, it makes sense to
      map positive return values onto zero where ->fasync() is called.
      
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      60aa4924
  4. 11 3月, 2009 2 次提交
    • J
      HID: fix waitqueue usage in hiddev · 96fe2ab8
      Johannes Weiner 提交于
      DECLARE_WAITQUEUE doesn't initialize the wait descriptor's task_list
      to 'empty' but to zero.
      
      prepare_to_wait() will not enqueue the descriptor to the waitqueue and
      finish_wait() will do list_del_init() on a list head that contains
      NULL pointers, which oopses.
      
      This was introduced by 07903407 "HID: hiddev cleanup -- handle all
      error conditions properly".
      
      The prior code used an unconditional add_to_waitqueue() which didn't
      care about the wait descriptor's list head and enqueued the thing
      unconditionally.
      
      The new code uses prepare_to_wait() which DOES check the prior list
      state, so use DEFINE_WAIT instead.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      96fe2ab8
    • J
      HID: fix incorrect free in hiddev · 48e7a3c9
      Johannes Weiner 提交于
      If hiddev_open() fails, it wrongly frees the shared hiddev structure
      kept in hiddev_table instead of the hiddev_list structure allocated
      for the opened file descriptor.  Existing references to this structure
      will then accessed free memory.
      
      This was introduced by 07903407 "HID: hiddev cleanup -- handle all
      error conditions properly".
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      48e7a3c9
  5. 29 1月, 2009 1 次提交
  6. 08 1月, 2009 2 次提交
  7. 04 1月, 2009 8 次提交
  8. 23 11月, 2008 1 次提交
  9. 14 11月, 2008 1 次提交
  10. 13 11月, 2008 1 次提交
    • J
      HID: fix start/stop cycle in usbhid driver · e3e14de5
      Jiri Slaby 提交于
      `stop' left out usbhid->urb* pointers and so the next `start' thought
      it needs to allocate nothing and used the memory pointers previously
      pointed to. This led to memory corruption and device malfunction.
      
      Also don't forget to clear disconnect flag on start which was left set
      by the previous `stop'.
      
      This fixes
      
      	echo DEVICE > /sys/bus/hid/drivers/DRIVER/unbind
      	echo DEVICE > /sys/bus/hid/drivers/DRIVER/bind
      
      failures.
      Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e3e14de5
  11. 02 11月, 2008 1 次提交
    • A
      saner FASYNC handling on file close · 233e70f4
      Al Viro 提交于
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  12. 27 10月, 2008 2 次提交
  13. 23 10月, 2008 1 次提交
  14. 22 10月, 2008 1 次提交
  15. 18 10月, 2008 1 次提交
  16. 15 10月, 2008 10 次提交