1. 01 5月, 2012 1 次提交
  2. 06 3月, 2012 1 次提交
  3. 28 2月, 2012 2 次提交
  4. 21 2月, 2012 1 次提交
  5. 02 2月, 2012 1 次提交
    • M
      HID: usbhid: fix dead lock between open and disconect · ba18311d
      Ming Lei 提交于
      There is no reason to hold hiddev->existancelock before
      calling usb_deregister_dev, so move it out of the lock.
      
      The patch fixes the lockdep warning below.
      
      [ 5733.386271] ======================================================
      [ 5733.386274] [ INFO: possible circular locking dependency detected ]
      [ 5733.386278] 3.2.0-custom-next-20120111+ #1 Not tainted
      [ 5733.386281] -------------------------------------------------------
      [ 5733.386284] khubd/186 is trying to acquire lock:
      [ 5733.386288]  (minor_rwsem){++++.+}, at: [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386311]
      [ 5733.386312] but task is already holding lock:
      [ 5733.386315]  (&hiddev->existancelock){+.+...}, at: [<ffffffffa0094d17>] hiddev_disconnect+0x26/0x87 [usbhid]
      [ 5733.386328]
      [ 5733.386329] which lock already depends on the new lock.
      [ 5733.386330]
      [ 5733.386333]
      [ 5733.386334] the existing dependency chain (in reverse order) is:
      [ 5733.386336]
      [ 5733.386337] -> #1 (&hiddev->existancelock){+.+...}:
      [ 5733.386346]        [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386357]        [<ffffffff813df961>] __mutex_lock_common+0x60/0x465
      [ 5733.386366]        [<ffffffff813dfe4d>] mutex_lock_nested+0x36/0x3b
      [ 5733.386371]        [<ffffffffa0094ad6>] hiddev_open+0x113/0x193 [usbhid]
      [ 5733.386378]        [<ffffffffa0011971>] usb_open+0x66/0xc2 [usbcore]
      [ 5733.386390]        [<ffffffff8111a8b5>] chrdev_open+0x12b/0x154
      [ 5733.386402]        [<ffffffff811159a8>] __dentry_open.isra.16+0x20b/0x355
      [ 5733.386408]        [<ffffffff811165dc>] nameidata_to_filp+0x43/0x4a
      [ 5733.386413]        [<ffffffff81122ed5>] do_last+0x536/0x570
      [ 5733.386419]        [<ffffffff8112300b>] path_openat+0xce/0x301
      [ 5733.386423]        [<ffffffff81123327>] do_filp_open+0x33/0x81
      [ 5733.386427]        [<ffffffff8111664d>] do_sys_open+0x6a/0xfc
      [ 5733.386431]        [<ffffffff811166fb>] sys_open+0x1c/0x1e
      [ 5733.386434]        [<ffffffff813e7c79>] system_call_fastpath+0x16/0x1b
      [ 5733.386441]
      [ 5733.386441] -> #0 (minor_rwsem){++++.+}:
      [ 5733.386448]        [<ffffffff8108255d>] __lock_acquire+0xa80/0xd74
      [ 5733.386454]        [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386458]        [<ffffffff813e01f5>] down_write+0x44/0x77
      [ 5733.386464]        [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386475]        [<ffffffffa0094d2d>] hiddev_disconnect+0x3c/0x87 [usbhid]
      [ 5733.386483]        [<ffffffff8132df51>] hid_disconnect+0x3f/0x54
      [ 5733.386491]        [<ffffffff8132dfb4>] hid_device_remove+0x4e/0x7a
      [ 5733.386496]        [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386502]        [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386507]        [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386512]        [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386519]        [<ffffffff8132def3>] hid_destroy_device+0x1e/0x3d
      [ 5733.386525]        [<ffffffffa00916b0>] usbhid_disconnect+0x36/0x42 [usbhid]
      [ 5733.386530]        [<ffffffffa000fb60>] usb_unbind_interface+0x57/0x11f [usbcore]
      [ 5733.386542]        [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386547]        [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386552]        [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386557]        [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386562]        [<ffffffffa000de61>] usb_disable_device+0xa8/0x1d8 [usbcore]
      [ 5733.386573]        [<ffffffffa0006bd2>] usb_disconnect+0xab/0x11f [usbcore]
      [ 5733.386583]        [<ffffffffa0008aa0>] hub_thread+0x73b/0x1157 [usbcore]
      [ 5733.386593]        [<ffffffff8105dc0f>] kthread+0x95/0x9d
      [ 5733.386601]        [<ffffffff813e90b4>] kernel_thread_helper+0x4/0x10
      [ 5733.386607]
      [ 5733.386608] other info that might help us debug this:
      [ 5733.386609]
      [ 5733.386612]  Possible unsafe locking scenario:
      [ 5733.386613]
      [ 5733.386615]        CPU0                    CPU1
      [ 5733.386618]        ----                    ----
      [ 5733.386620]   lock(&hiddev->existancelock);
      [ 5733.386625]                                lock(minor_rwsem);
      [ 5733.386630]                                lock(&hiddev->existancelock);
      [ 5733.386635]   lock(minor_rwsem);
      [ 5733.386639]
      [ 5733.386640]  *** DEADLOCK ***
      [ 5733.386641]
      [ 5733.386644] 6 locks held by khubd/186:
      [ 5733.386646]  #0:  (&__lockdep_no_validate__){......}, at: [<ffffffffa00084af>] hub_thread+0x14a/0x1157 [usbcore]
      [ 5733.386661]  #1:  (&__lockdep_no_validate__){......}, at: [<ffffffffa0006b77>] usb_disconnect+0x50/0x11f [usbcore]
      [ 5733.386677]  #2:  (hcd->bandwidth_mutex){+.+.+.}, at: [<ffffffffa0006bc8>] usb_disconnect+0xa1/0x11f [usbcore]
      [ 5733.386693]  #3:  (&__lockdep_no_validate__){......}, at: [<ffffffff812c09bb>] device_release_driver+0x18/0x2d
      [ 5733.386704]  #4:  (&__lockdep_no_validate__){......}, at: [<ffffffff812c09bb>] device_release_driver+0x18/0x2d
      [ 5733.386714]  #5:  (&hiddev->existancelock){+.+...}, at: [<ffffffffa0094d17>] hiddev_disconnect+0x26/0x87 [usbhid]
      [ 5733.386727]
      [ 5733.386727] stack backtrace:
      [ 5733.386731] Pid: 186, comm: khubd Not tainted 3.2.0-custom-next-20120111+ #1
      [ 5733.386734] Call Trace:
      [ 5733.386741]  [<ffffffff81062881>] ? up+0x34/0x3b
      [ 5733.386747]  [<ffffffff813d9ef3>] print_circular_bug+0x1f8/0x209
      [ 5733.386752]  [<ffffffff8108255d>] __lock_acquire+0xa80/0xd74
      [ 5733.386756]  [<ffffffff810808b4>] ? trace_hardirqs_on_caller+0x15d/0x1a3
      [ 5733.386763]  [<ffffffff81043a3f>] ? vprintk+0x3f4/0x419
      [ 5733.386774]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386779]  [<ffffffff81082d26>] lock_acquire+0xcb/0x10e
      [ 5733.386789]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386797]  [<ffffffff813e01f5>] down_write+0x44/0x77
      [ 5733.386807]  [<ffffffffa0011a04>] ? usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386818]  [<ffffffffa0011a04>] usb_deregister_dev+0x37/0x9e [usbcore]
      [ 5733.386825]  [<ffffffffa0094d2d>] hiddev_disconnect+0x3c/0x87 [usbhid]
      [ 5733.386830]  [<ffffffff8132df51>] hid_disconnect+0x3f/0x54
      [ 5733.386834]  [<ffffffff8132dfb4>] hid_device_remove+0x4e/0x7a
      [ 5733.386839]  [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386844]  [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386848]  [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386854]  [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386859]  [<ffffffff8132def3>] hid_destroy_device+0x1e/0x3d
      [ 5733.386865]  [<ffffffffa00916b0>] usbhid_disconnect+0x36/0x42 [usbhid]
      [ 5733.386876]  [<ffffffffa000fb60>] usb_unbind_interface+0x57/0x11f [usbcore]
      [ 5733.386882]  [<ffffffff812c0957>] __device_release_driver+0x81/0xcd
      [ 5733.386886]  [<ffffffff812c09c3>] device_release_driver+0x20/0x2d
      [ 5733.386890]  [<ffffffff812c0564>] bus_remove_device+0x114/0x128
      [ 5733.386895]  [<ffffffff812bdd6f>] device_del+0x131/0x183
      [ 5733.386905]  [<ffffffffa000de61>] usb_disable_device+0xa8/0x1d8 [usbcore]
      [ 5733.386916]  [<ffffffffa0006bd2>] usb_disconnect+0xab/0x11f [usbcore]
      [ 5733.386921]  [<ffffffff813dff82>] ? __mutex_unlock_slowpath+0x130/0x141
      [ 5733.386929]  [<ffffffffa0008aa0>] hub_thread+0x73b/0x1157 [usbcore]
      [ 5733.386935]  [<ffffffff8106a51d>] ? finish_task_switch+0x78/0x150
      [ 5733.386941]  [<ffffffff8105e396>] ? __init_waitqueue_head+0x4c/0x4c
      [ 5733.386950]  [<ffffffffa0008365>] ? usb_remote_wakeup+0x56/0x56 [usbcore]
      [ 5733.386955]  [<ffffffff8105dc0f>] kthread+0x95/0x9d
      [ 5733.386961]  [<ffffffff813e90b4>] kernel_thread_helper+0x4/0x10
      [ 5733.386966]  [<ffffffff813e24b8>] ? retint_restore_args+0x13/0x13
      [ 5733.386970]  [<ffffffff8105db7a>] ? __init_kthread_worker+0x55/0x55
      [ 5733.386974]  [<ffffffff813e90b0>] ? gs_change+0x13/0x13
      Signed-off-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ba18311d
  6. 04 1月, 2012 1 次提交
  7. 21 12月, 2011 4 次提交
    • D
      HID: usbhid: defer LED setting to a workqueue · 4371ea82
      Daniel Kurtz 提交于
      Defer LED setting action to a workqueue.
      This is more likely to send all LED change events in a single URB.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4371ea82
    • D
      HID: usbhid: hid-core: submit queued urbs before suspend · f0befcd6
      Daniel Kurtz 提交于
      If any userspace program has opened a keyboard device, the input core
      de-activates the keyboard's LEDs upon suspend().  It does this by sending
      individual EV_LED[LED_X]=0 events to the underlying device driver by
      directly calling the driver's registered event() handler.
      
      The usb-hid driver event() handler processes each request by immediately
      attempting to submit a CTRL URB to turn off the LED.  USB URB submission
      is asynchronous.  First the URB is added to the head of the ctrl queue.
      Then, if the CTRL_RUNNING flag is false, the URB is submitted immediately
      (and CTRL_RUNNING is set).  If the CTRL_RUNNING flag was already true,
      then the newly queued URB is submitted in the ctrl completion handler when
      all previously submitted URBs have completed.  When all queued URBs have
      been submitted, the completion handler clears the CTRL_RUNNING flag.
      
      In the 2-LED suspend case, at input suspend(), 2 LED event CTRL URBs get
      queued, with only the first actually submitted.  Soon after input
      suspend() handler finishes, the usb-hid suspend() handler gets called.
      Since this is NOT a PM_EVENT_AUTO suspend, the handler sets
      REPORTED_IDLE, then waits for io to complete.
      
      Unfortunately, this usually happens while the first LED request is
      actually still being processed.  Thus when the completion handler tries
      to submit the second LED request it fails, since REPORTED_IDLE is
      already set!  This REPORTED_IDLE check failure causes the completion
      handler to complete, however without clearing the CTRL_RUNNING flag.
      This, in turn, means that the suspend() handler's wait_io() condition
      is never satisfied, and instead it times out after 10 seconds, aborting
      the original system suspend.
      
      This patch changes the behavior to the following:
        (1) allow completion handler to finish submitting all queued URBs, even if
            REPORTED_IDLE is set.  This guarantees that all URBs queued before the
            hid-core suspend() call will be submitted before the system is
            suspended.
        (2) if REPORTED_IDLE is set and the URB queue is empty, queue, but
            don't submit, new URB submission requests.  These queued requests get
            submitted when resume() flushes the URB queue. This is similar to the
            existing behavior, however, any requests that arrive while the queue is
            not yet empty will still get submitted before suspend.
        (3) set the RUNNING flag when flushing the URB queue in resume().
            This keeps URBs that were queued in (2) from colliding with any new
            URBs that are being submitted during the resume process.  The new URB
            submission requests upon resume get properly queued behind the ones
            being flushed instead of the current situation where they collide,
            causing memory corruption and oopses.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f0befcd6
    • D
      HID: usbhid: remove LED_ON · ede6a8b2
      Daniel Kurtz 提交于
      LED_ON was defined in the original version of the hid-core autosuspend patch.
      However, during review, the setting and clearing of it was redone
      using ledcount.  The test was left in accidentally.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ede6a8b2
    • I
      HID: Enable HID_QUIRK_MULTI_INPUT for Trio Linker Plus II · cd07655e
      Ignaz Forster 提交于
      Add quirk for the Trio Linker Plus II - the adapter supports several
      controllers simultaneously, generating a new HID entry for each connected
      device.
      Signed-off-by: NIgnaz Forster <ignaz.forster@gmx.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      cd07655e
  8. 15 12月, 2011 1 次提交
  9. 23 11月, 2011 2 次提交
  10. 19 11月, 2011 1 次提交
  11. 01 11月, 2011 1 次提交
  12. 21 10月, 2011 1 次提交
  13. 14 10月, 2011 1 次提交
  14. 27 9月, 2011 1 次提交
    • D
      HID: hiddev: potential info leak in hiddev_ioctl() · 9561f7fa
      Dan Carpenter 提交于
      Smatch has a new check for Rosenberg type information leaks where
      structs are copied to the user with uninitialized stack data in them.
      
      In this case, the hiddev_devinfo struct has a two byte hole.
      
      struct hiddev_devinfo {
              __u32                      bustype;              /*     0     4 */
              __u32                      busnum;               /*     4     4 */
              __u32                      devnum;               /*     8     4 */
              __u32                      ifnum;                /*    12     4 */
              __s16                      vendor;               /*    16     2 */
              __s16                      product;              /*    18     2 */
              __s16                      version;              /*    20     2 */
      
              /* XXX 2 bytes hole, try to pack */
      
              __u32                      num_applications;     /*    24     4 */
      Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      9561f7fa
  15. 25 8月, 2011 1 次提交
  16. 23 8月, 2011 1 次提交
  17. 20 8月, 2011 1 次提交
  18. 16 8月, 2011 1 次提交
  19. 07 6月, 2011 1 次提交
    • T
      HID: yurex: recognize GeneralKeys wireless presenter as generic HID · 6dc1418e
      Tomoki Sekiyama 提交于
      Unfortunately, the device seems to have the same Vendor ID and Product ID
      as YUREX leg-shakes sensors, and the commit 6bc235a2 ("USB: add driver
      for Meywa-Denki & Kayac YUREX") added the ID to hid_ignore_list.
      
      I believe that we can distinguish YUREX and the Wireless Presenter by
      device type.  The patch below makes the driver ignore only YUREX
      (bInterfaceProtocol==0), and recognize Wireless Presenter
      (bInterfaceProtocol is keyboard or mouse) as generic HID.  (I don't have
      the Wireless Presenter, so not yet ested.)
      
      ** YUREX lsusb information:
      Bus 002 Device 007: ID 0c45:1010 Microdia
      Device Descriptor:
         bLength                18
         bDescriptorType         1
         bcdUSB               1.10
         bDeviceClass            0 (Defined at Interface level)
         bDeviceSubClass         0
         bDeviceProtocol         0
         bMaxPacketSize0         8
         idVendor           0x0c45 Microdia
         idProduct          0x1010
         bcdDevice            0.03
         iManufacturer           1 JESS
         iProduct                2 YUREX
         iSerial                 3 10000269
         bNumConfigurations      1
         Configuration Descriptor:
           bLength                 9
           bDescriptorType         2
           wTotalLength           34
           bNumInterfaces          1
           bConfigurationValue     1
           iConfiguration          0
           bmAttributes         0xa0
             (Bus Powered)
             Remote Wakeup
           MaxPower              100mA
           Interface Descriptor:
             bLength                 9
             bDescriptorType         4
             bInterfaceNumber        0
             bAlternateSetting       0
             bNumEndpoints           1
             bInterfaceClass         3 Human Interface Device
             bInterfaceSubClass      1 Boot Interface Subclass
             bInterfaceProtocol      0 None
             iInterface              0
               HID Device Descriptor:
                 bLength                 9
                 bDescriptorType        33
                 bcdHID               1.10
                 bCountryCode            0 Not supported
                 bNumDescriptors         1
                 bDescriptorType        34 Report
                 wDescriptorLength      31
                Report Descriptors:
                  ** UNAVAILABLE **
             Endpoint Descriptor:
               bLength                 7
               bDescriptorType         5
               bEndpointAddress     0x81  EP 1 IN
               bmAttributes            3
                 Transfer Type            Interrupt
                 Synch Type               None
                 Usage Type               Data
               wMaxPacketSize     0x0008  1x 8 bytes
               bInterval              10
      Device Status:     0x0002
         (Bus Powered)
         Remote Wakeup Enabled
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=26922Signed-off-by: NTomoki Sekiyama <tomoki.sekiyama@gmail.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
      Reported-by: NThomas B?chler <thomas@archlinux.org>
      Tested-by: NThomas B?chler <thomas@archlinux.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6dc1418e
  20. 26 5月, 2011 1 次提交
  21. 24 5月, 2011 2 次提交
    • J
      HID: add quirk for HyperPen 10000U · e23be0a2
      Jimmy Hon 提交于
      Add 5543:0064 UC-Logic Technology Corp. Aiptek HyperPen 10000U to quirks with
      HID_QUIRK_MULTI_INPUT.
      
      Originally the device is reporting the x,y coordinates on Z and RX. By adding
      this quirk, there will be two kernel devices. The first one is muted and the
      second device will report coordinates on X and Y.
      Signed-off-by: NJimmy Hon <honyuenkwun@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e23be0a2
    • J
      HID: hiddev: fix potential use-after-free · 7f77897e
      Jiri Kosina 提交于
      Commit 6cb4b040 ("HID: hiddev: fix race between hiddev_disconnect
      and hiddev_release") made it possible to access hiddev (for unlocking
      the existance mutex) once hiddev has been kfreed.
      
      Change the order so that this can not happen (always unlock the mutex first,
      it is needed only to protect access to ->exist and ->open).
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      7f77897e
  22. 20 5月, 2011 1 次提交
    • J
      HID: hiddev: fix race between hiddev_disconnect and hiddev_release · 6cb4b040
      Jiri Kosina 提交于
      When hiddev_disconnect() runs with chardev open, it will proceed with
      usbhid_close(). When userspace in parallel runs the hiddev_release(),
      it sees !hiddev->exists (as it has been already set so by
      hiddev_disconnect()) and kfrees hiddev while hiddev_disconnect() hasn't
      finished yet.
      
      Serialize the access to hiddev->exists and hiddev->open by existancelock.
      
      Reported-by: mike-@cinci.rr.com
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6cb4b040
  23. 18 5月, 2011 1 次提交
  24. 29 4月, 2011 1 次提交
  25. 26 4月, 2011 1 次提交
  26. 06 4月, 2011 1 次提交
  27. 27 3月, 2011 1 次提交
  28. 11 2月, 2011 1 次提交
  29. 21 1月, 2011 1 次提交
    • D
      kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT · 6a108a14
      David Rientjes 提交于
      The meaning of CONFIG_EMBEDDED has long since been obsoleted; the option
      is used to configure any non-standard kernel with a much larger scope than
      only small devices.
      
      This patch renames the option to CONFIG_EXPERT in init/Kconfig and fixes
      references to the option throughout the kernel.  A new CONFIG_EMBEDDED
      option is added that automatically selects CONFIG_EXPERT when enabled and
      can be used in the future to isolate options that should only be
      considered for embedded systems (RISC architectures, SLOB, etc).
      
      Calling the option "EXPERT" more accurately represents its intention: only
      expert users who understand the impact of the configuration changes they
      are making should enable it.
      Reviewed-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NDavid Woodhouse <david.woodhouse@intel.com>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Robin Holt <holt@sgi.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6a108a14
  30. 12 1月, 2011 1 次提交
  31. 23 12月, 2010 1 次提交
  32. 10 12月, 2010 1 次提交
    • J
      HID: Add and use hid_<level>: dev_<level> equivalents · 4291ee30
      Joe Perches 提交于
      Neaten current uses of dev_<level> by adding and using
      hid specific hid_<level> macros.
      
      Convert existing uses of dev_<level> uses to hid_<level>.
      Convert hid-pidff printk uses to hid_<level>.
      
      Remove err_hid and use hid_err instead.
      
      Add missing newlines to logging messages where necessary.
      Coalesce format strings.
      
      Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt
      
      Other miscellaneous changes:
      
      Add const struct hid_device * argument to hid-core functions
      extract() and implement() so hid_<level> can be used by them.
      Fix bad indentation in hid-core hid_input_field function
      that calls extract() function above.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4291ee30
  33. 07 12月, 2010 2 次提交
    • V
      HID: Consolidate device existence checks in hiddev_ioctl · 33d6eb57
      Valentine Barshak 提交于
      Currently, if the device has been removed before hiddev_ioctl(),
      the -EIO is returned. If it's removed while hiddev_ioctl() is in
      progress, some commands are still processed fine, others
      return -ENODEV. This change takes the "existancelock" before
      processing ioctl commands and releases it at the end.
      If the device has been removed, always returns -ENODEV.
      Signed-off-by: NValentine Barshak <vbarshak@mvista.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      33d6eb57
    • V
      HID: Fix race between disconnect and hiddev_ioctl · 1a8e8fab
      Valentine Barshak 提交于
      A USB HID device can be disconnected at any time.
      If this happens right before or while hiddev_ioctl is in progress,
      the hiddev_ioctl tries to access invalid hiddev->hid pointer.
      When the hid device is disconnected, the hiddev_disconnect()
      ends up with a call to hid_device_release() which frees
      hid_device, but doesn't set the hiddev->hid pointer to NULL.
      If the deallocated memory region has been re-used by the kernel,
      this can cause a crash or memory corruption.
      
      Since disconnect can happen at any time, we can't initialize
      struct hid_device *hid = hiddev->hid at the beginning of ioctl
      and then use it.
      
      This change checks hiddev->exist flag while holding
      the existancelock and uses hid_device only if it exists.
      Signed-off-by: NValentine Barshak <vbarshak@mvista.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      1a8e8fab