1. 14 10月, 2013 1 次提交
  2. 25 7月, 2013 2 次提交
  3. 22 7月, 2013 2 次提交
    • J
      HID: fix unused rsize usage · bc197eed
      Jiri Kosina 提交于
      27ce4050 ("HID: fix data access in implement()") by mistake removed
      a setting of buffer size in hidp. Fix that by putting it back.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      bc197eed
    • J
      HID: fix data access in implement() · 27ce4050
      Jiri Kosina 提交于
      implement() is setting bytes in LE data stream. In case the data is not
      aligned to 64bits, it reads past the allocated buffer. It doesn't really
      change any value there (it's properly bitmasked), but in case that this
      read past the boundary hits a page boundary, pagefault happens when
      accessing 64bits of 'x' in implement(), and kernel oopses.
      
      This happens much more often when numbered reports are in use, as the
      initial 8bit skip in the buffer makes the whole process work on values
      which are not aligned to 64bits.
      
      This problem dates back to attempts in 2005 and 2006 to make implement()
      and extract() as generic as possible, and even back then the problem
      was realized by Adam Kroperlin, but falsely assumed to be impossible
      to cause any harm:
      
        http://www.mail-archive.com/linux-usb-devel@lists.sourceforge.net/msg47690.html
      
      I have made several attempts at fixing it "on the spot" directly in
      implement(), but the results were horrible; the special casing for processing
      last 64bit chunk and switching to different math makes it unreadable mess.
      
      I therefore took a path to allocate a few bytes more which will never make
      it into final report, but are there as a cushion for all the 64bit math
      operations happening in implement() and extract().
      
      All callers of hid_output_report() are converted at the same time to allocate
      the buffer by newly introduced hid_alloc_report_buf() helper.
      
      Bruno noticed that the whole raw_size test can be dropped as well, as
      hid_alloc_report_buf() makes sure that the buffer is always of a proper
      size.
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Acked-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      27ce4050
  4. 23 6月, 2013 1 次提交
  5. 29 5月, 2013 1 次提交
    • D
      HID: Bluetooth: hidp: register HID devices async · 4e713cdf
      David Herrmann 提交于
      While l2cap_user callbacks are running, the whole hci_dev is locked. Even
      if we would add more fine-grained locking to HCI core, it would still be
      called from the non-reentrant rx work-queue and thus block the event
      processing.
      
      However, if we want to perform synchronous I/O during HID device
      registration (eg., to perform device-detection), we need the HCI core
      to be able to dispatch incoming data.
      
      Therefore, we now move device-registration to a separate worker. The HCI
      core can continue running and we add devices asynchronously in another
      kernel thread. Device removal is synchronized and waits for the worker
      to exit before calling the usual device removal functions.
      
      If l2cap_user->remove is called before the thread registered the devices,
      we set "terminate" to true and the thread will skip it. If
      l2cap_user->remove is called after it, we notice this as the device
      is no longer in HIDP_SESSION_PREPARING state and simply unregister the
      device as we did before.
      There is no new deadlock as we now call hidp_session_add_dev() with
      one lock less held (the HCI lock) and it cannot itself call back into
      HCI as it was called with the HCI-lock held before.
      
      One might wonder whether this can block during device unregistration.
      But we set "terminate" to true and wake the HIDP thread up _before_
      unregistering the HID/input devices. Therefore, all pending HID I/O
      operations are canceled. All further I/O attempts will fail with ENODEV
      or EIO. So all latency we can get are few context-switches, but no
      timeouts or blocking I/O waits!
      
      This change also prepares for a long standing HID bug. All HID devices
      that register power_supply devices need to be able to handle callbacks
      during registration (a power_supply oddity that cannot easily be fixed).
      So with this patch available, we can allow HID I/O during registration
      by calling the recently introduced hid_device_io_start/stop helpers,
      which currently are a no-op for bluetooth due to this locking.
      
      Note that we cannot do the same for input devices. input-core doesn't
      allow us to call input_event() asynchronously to input_register_device(),
      which HID-core kindly allows (for good reasons).
      Fixing input-core to allow this isn't as easy as it sounds and is,
      beside simplifying HIDP, not really an improvement. Hence, we still
      register input devices synchronously as we did before. Only HID devices
      are registered asynchronously.
      Signed-off-by: NDavid Herrmann <dh.herrmann@gmail.com>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Tested-by: NDaniel Nicoletti <dantti12@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4e713cdf
  6. 17 4月, 2013 11 次提交
  7. 06 4月, 2013 1 次提交
  8. 08 3月, 2013 1 次提交
  9. 10 1月, 2013 1 次提交
  10. 07 12月, 2012 1 次提交
  11. 28 9月, 2012 1 次提交
  12. 10 6月, 2012 1 次提交
  13. 05 6月, 2012 2 次提交
  14. 01 5月, 2012 2 次提交
  15. 19 12月, 2011 1 次提交
  16. 08 11月, 2011 3 次提交
  17. 07 10月, 2011 8 次提交