1. 18 12月, 2015 1 次提交
  2. 02 12月, 2015 1 次提交
    • I
      HID: usbhid: fix recursive deadlock · e470127e
      Ioan-Adrian Ratiu 提交于
      The critical section protected by usbhid->lock in hid_ctrl() is too
      big and because of this it causes a recursive deadlock. "Too big" means
      the case statement and the call to hid_input_report() do not need to be
      protected by the spinlock (no URB operations are done inside them).
      
      The deadlock happens because in certain rare cases drivers try to grab
      the lock while handling the ctrl irq which grabs the lock before them
      as described above. For example newer wacom tablets like 056a:033c try
      to reschedule proximity reads from wacom_intuos_schedule_prox_event()
      calling hid_hw_request() -> usbhid_request() -> usbhid_submit_report()
      which tries to grab the usbhid lock already held by hid_ctrl().
      
      There are two ways to get out of this deadlock:
          1. Make the drivers work "around" the ctrl critical region, in the
          wacom case for ex. by delaying the scheduling of the proximity read
          request itself to a workqueue.
          2. Shrink the critical region so the usbhid lock protects only the
          instructions which modify usbhid state, calling hid_input_report()
          with the spinlock unlocked, allowing the device driver to grab the
          lock first, finish and then grab the lock afterwards in hid_ctrl().
      
      This patch implements the 2nd solution.
      Signed-off-by: NIoan-Adrian Ratiu <adi@adirat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e470127e
  3. 27 11月, 2015 1 次提交
    • R
      HID: debug: improve hid_debug_event() · 92529623
      Rasmus Villemoes 提交于
      The code in hid_debug_event() causes horrible code generation. First,
      we do a strlen() call for every byte we copy (we're doing a store to
      global memory, so gcc has no way of proving that strlen(buf) doesn't
      change). Second, since both i, list->tail and HID_DEBUG_BUFSIZE have
      signed type, the modulo computation has to take into account the
      possibility that list->tail+i is negative, so it's not just a simple
      and.
      
      Fix the former by simply not doing strlen() at all (we have to load
      buf[i] anyway, so testing it is almost free) and the latter by
      changing i to unsigned. This cuts 29% (69 bytes) of the size of the
      function.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      92529623
  4. 23 11月, 2015 1 次提交
  5. 20 11月, 2015 2 次提交
  6. 18 11月, 2015 6 次提交
  7. 17 11月, 2015 18 次提交
  8. 16 11月, 2015 10 次提交