1. 30 9月, 2018 1 次提交
  2. 24 9月, 2018 1 次提交
    • H
      HID: i2c-hid: Remove RESEND_REPORT_DESCR quirk and its handling · afbb1169
      Hans de Goede 提交于
      Commit 52cf93e6 ("HID: i2c-hid: Don't reset device upon system resume")
      removes the need for the RESEND_REPORT_DESCR quirk for Raydium devices, but
      kept it for the SIS device id 10FB touchscreens, as the author of that
      commit could not determine if the quirk is still necessary there.
      
      I've tested suspend/resume on a Toshiba Click Mini L9W-B which is the
      device for which this quirk was added in the first place and with the
      "Don't reset device upon system resume" fix the quirk is no longer
      necessary, so this commit removes it.
      
      Note even better I also had some other devices with SIS touchscreens which
      suspend/resume issues, where the RESEND_REPORT_DESCR quirk did not help.
      
      I've also tested these devices with the "Don't reset device upon system
      resume" fix and I'm happy to report that that fix also fixes touchscreen
      resume on the following devices:
      
      Asus T100HA
      Asus T200TA
      Peaq C1010
      
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      afbb1169
  3. 14 9月, 2018 1 次提交
  4. 06 9月, 2018 1 次提交
    • K
      HID: i2c-hid: Don't reset device upon system resume · 52cf93e6
      Kai-Heng Feng 提交于
      Raydium touchscreen triggers interrupt storm after system-wide suspend:
      
      	[ 179.085033] i2c_hid i2c-CUST0000:00: i2c_hid_get_input: incomplete report (58/65535)
      
      According to Raydium, Windows driver does not reset the device after system
      resume.
      
      The HID over I2C spec does specify a reset should be used at intialization, but
      it doesn't specify if reset is required for system suspend.
      
      Tested this patch on other i2c-hid touchpanels I have and those touchpanels do
      work after S3 without doing reset. If any regression happens to other
      touchpanel vendors, we can use quirk for Raydium devices.
      
      There's still one device uses I2C_HID_QUIRK_RESEND_REPORT_DESCR so keep it
      there.
      
      Cc: Aaron Ma <aaron.ma@canonical.com>
      Cc: AceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: NKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      52cf93e6
  5. 28 8月, 2018 1 次提交
  6. 09 7月, 2018 1 次提交
    • J
      HID: i2c-hid: Fix "incomplete report" noise · ef6eaf27
      Jason Andryuk 提交于
      Commit ac75a041 ("HID: i2c-hid: fix size check and type usage") started
      writing messages when the ret_size is <= 2 from i2c_master_recv.  However, my
      device i2c-DLL07D1 returns 2 for a short period of time (~0.5s) after I stop
      moving the pointing stick or touchpad.  It varies, but you get ~50 messages
      each time which spams the log hard.
      
      [  95.925055] i2c_hid i2c-DLL07D1:01: i2c_hid_get_input: incomplete report (83/2)
      
      This has also been observed with a i2c-ALP0017.
      
      [ 1781.266353] i2c_hid i2c-ALP0017:00: i2c_hid_get_input: incomplete report (30/2)
      
      Only print the message when ret_size is totally invalid and less than 2 to cut
      down on the log spam.
      
      Fixes: ac75a041 ("HID: i2c-hid: fix size check and type usage")
      Reported-by: NJohn Smith <john-s-84@gmx.net>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJason Andryuk <jandryuk@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ef6eaf27
  7. 25 6月, 2018 2 次提交
  8. 30 5月, 2018 1 次提交
  9. 15 5月, 2018 1 次提交
  10. 09 5月, 2018 1 次提交
  11. 19 4月, 2018 1 次提交
  12. 16 4月, 2018 2 次提交
  13. 12 4月, 2018 1 次提交
  14. 16 2月, 2018 2 次提交
  15. 21 11月, 2017 1 次提交
  16. 09 11月, 2017 1 次提交
    • H
      HID: i2c-hid: Add no-irq-after-reset quirk for 0911:5288 device · 402946a8
      Hans de Goede 提交于
      Several cheap Apollo Lake based laptops / 2-in-1s use an i2c-hid mt
      touchpad which is advertised by the DSDT with an ACPI HID of "SYNA3602",
      this touchpad can be found on e.g. the Cube Thinker and the EZBook 3 Pro.
      
      On my "T-bao Tbook air" the i2c-hid driver fails to bind to this touchpad:
      "i2c_hid i2c-SYNA3602:00: failed to reset device.".
      
      After some debuging this it seems that this touchpad simply never sends
      an interrupt after a reset as expected by the i2c hid driver. This commit
      adds a quirk for this device, making i2c_hid_command sleep 100ms after
      a reset instead of waiting for an irq, fixing i2c-hid failing to bind to
      this touchpad.
      Signed-off-by: NHans de Goede <hdegoede@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      402946a8
  17. 14 9月, 2017 1 次提交
  18. 27 7月, 2017 1 次提交
    • J
      HID: introduce hid_is_using_ll_driver · fc2237a7
      Jason Gerecke 提交于
      Although HID itself is transport-agnostic, occasionally a driver may
      want to interact with the low-level transport that a device is connected
      through. To do this, we need to know what kind of bus is in use. The
      first guess may be to look at the 'bus' field of the 'struct hid_device',
      but this field may be emulated in some cases (e.g. uhid).
      
      More ideally, we can check which ll_driver a device is using. This
      function introduces a 'hid_is_using_ll_driver' function and makes the
      'struct hid_ll_driver' of the four most common transports accessible
      through hid.h.
      Signed-off-by: NJason Gerecke <jason.gerecke@wacom.com>
      Acked-By: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      fc2237a7
  19. 08 6月, 2017 1 次提交
  20. 07 6月, 2017 1 次提交
  21. 29 5月, 2017 1 次提交
  22. 22 5月, 2017 1 次提交
  23. 21 3月, 2017 1 次提交
    • B
      HID: remove initial reading of reports at connect · 9143059f
      Benjamin Tissoires 提交于
      It looks like a bunch of devices do not like to be polled
      for their reports at init time. When you look into the details,
      it seems that for those that are requiring the quirk
      HID_QUIRK_NO_INIT_REPORTS, the driver fails to retrieve part
      of the features/inputs while others (more generic) work.
      
      IMO, it should be acceptable to remove the need for the quirk
      in the general case. On the small amount of cases where
      we actually need to read the current values, the driver
      in charge (hid-mt or wacom) already retrieves the features
      manually.
      
      There are 2 cases where we might need to retrieve the reports at
      init:
      1. hiddev devices with specific use-space tool
      2. a device that would require the driver to fetch a specific
         feature/input at plug
      
      For case 2, I have seen this a few time on hid-multitouch. It
      is solved in hid-multitouch directly by fetching the feature.
      I hope it won't be too common and this can be solved on a per-case
      basis (crossing fingers).
      
      For case 1, we moved the implementation of HID_QUIRK_NO_INIT_REPORTS
      in hiddev. When somebody starts calling ioctls that needs an initial
      update, the hiddev device will fetch the initial state of the reports
      to mimic the current behavior. This adds a small amount of time during
      the first HIDIOCGUSAGE(S), but it should be acceptable in
      most cases. To keep the currently known broken devices, we have to
      keep around HID_QUIRK_NO_INIT_REPORTS, but the scope will only be
      for hiddev.
      
      Note that I don't think hidraw would be affected and I checked that
      the FF drivers that need to interact with the report fields are all
      using output reports, which are not initialized by
      usbhid_init_reports().
      
      NO_INIT_INPUT_REPORTS is then replaced by HID_QUIRK_NO_INIT_REPORTS:
      there is no point keeping it for just one device.
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      9143059f
  24. 06 3月, 2017 2 次提交
  25. 12 1月, 2017 1 次提交
  26. 12 12月, 2016 3 次提交
    • B
      HID: fix missing irq field · 8cd16166
      Benjamin Tissoires 提交于
      commit ba18a931 ("Revert "HID: i2c-hid: Add support for ACPI GPIO
      interrupts"") removed the need for storing the irq in struct i2c_hid.
      
      But then commit de3c99488609 ("HID: i2c-hid: Disable IRQ before freeing
      buffers") forgot to update the location of the irq.
      
      Fix this by using the actual I2C client irq.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      8cd16166
    • J
      HID: i2c-hid: fix build · ba1660f1
      Jiri Kosina 提交于
      Add a forgotten include that I've by mistake omitted when resolving
      merge conflict in ead0687fe30 ("HID: i2c-hid: support regulator power
      on/off").
      
      Fixes: ead0687fe30 ("HID: i2c-hid: support regulator power on/off")
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ba1660f1
    • J
      HID: i2c-hid: Disable IRQ before freeing buffers · d46ddc59
      João Paulo Rechi Vita 提交于
      The HID report buffers that are initially allocated on i2c_hid_probe()
      might not be big enough to hold the HID reports from a specific device,
      in which case they will be freed and new ones will be allocated in
      i2c_hid_start(), at point which the device's report size is known. But
      at this point ihid->irq is already running, and may call
      i2c_hid_get_input() which passes ihid->inbuf to i2c_master_recv(). Since
      this handler runs in a separate thread, ihid->inbuf may be freed at this
      very moment, and i2c_master_recv() will write on memory which may be
      already owned by a different part of the kernel, corrupting its data.
      
      This problem has been observed on an Asus UX360UA laptop which has an
      I2C touchpad, and results in a complete system freeze or an unusable
      slowness with a lof of "BUG: unable to handle kernel paging request at
      <address>" warnings. Enabling SLUB debugging shows a use-after-free
      warning on memory allocated in i2c_hid_alloc_buffers() and freed in
      i2c_hid_free_buffers():
      
      =============================================================================
      BUG kmalloc-64 (Not tainted): Poison overwritten
      -----------------------------------------------------------------------------
      Disabling lock debugging due to kernel taint
      INFO: 0xffff880264083273-0xffff88026408329e. first byte 0x0 instead of 0x6b
      INFO: Allocated in i2c_hid_alloc_buffers+0x25/0xa0 [i2c_hid] age=35793 cpu=2 pid=430
      	___slab_alloc+0x41e/0x460
      	__slab_alloc+0x20/0x40
      	__kmalloc+0x210/0x280
      	i2c_hid_alloc_buffers+0x25/0xa0 [i2c_hid]
      	i2c_hid_probe+0x12f/0x5e0 [i2c_hid]
      	i2c_device_probe+0x10a/0x1b0
      	driver_probe_device+0x220/0x4a0
      	__device_attach_driver+0x71/0xa0
      	bus_for_each_drv+0x67/0xb0
      	__device_attach+0xdc/0x170
      	device_initial_probe+0x13/0x20
      	bus_probe_device+0x92/0xa0
      	device_add+0x4aa/0x670
      	device_register+0x1a/0x20
      	i2c_new_device+0x18e/0x230
      	acpi_i2c_add_device+0x1a0/0x210
      INFO: Freed in i2c_hid_free_buffers+0x16/0x60 [i2c_hid] age=7552 cpu=1 pid=1473
      	__slab_free+0x221/0x330
      	kfree+0x139/0x160
      	i2c_hid_free_buffers+0x16/0x60 [i2c_hid]
      	i2c_hid_start+0x2a9/0x2df [i2c_hid]
      	mt_probe+0x160/0x22e [hid_multitouch]
      	hid_device_probe+0xd7/0x150 [hid]
      	driver_probe_device+0x220/0x4a0
      	__driver_attach+0x84/0x90
      	bus_for_each_dev+0x6c/0xc0
      	driver_attach+0x1e/0x20
      	bus_add_driver+0x1c3/0x280
      	driver_register+0x60/0xe0
      	__hid_register_driver+0x53/0x90 [hid]
      	0xffffffffc004f01e
      	do_one_initcall+0xb3/0x1f0
      	do_init_module+0x5f/0x1d0
      INFO: Slab 0xffffea0009902080 objects=20 used=20 fp=0x          (null) flags=0x17fff8000004080
      INFO: Object 0xffff880264083260 @offset=4704 fp=0x          (null)
      Bytes b4 ffff880264083250: 8d e6 fe ff 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a  ........ZZZZZZZZ
      Object ffff880264083260: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b  kkkkkkkkkkkkkkkk
      Object ffff880264083270: 6b 6b 6b 00 00 00 00 00 00 00 00 00 00 00 00 00  kkk.............
      Object ffff880264083280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      Object ffff880264083290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
      Redzone ffff8802640832a0: bb bb bb bb bb bb bb bb                          ........
      Padding ffff8802640833e0: 5a 5a 5a 5a 5a 5a 5a 5a                          ZZZZZZZZ
      CPU: 1 PID: 1503 Comm: python3 Tainted: G    B           4.4.21+ #10
      Hardware name: ASUSTeK COMPUTER INC. UX360UA/UX360UA, BIOS UX360UA.200 05/05/2016
       0000000000000086 00000000622d48a2 ffff88026061ba38 ffffffff813f6044
       ffff880264082010 ffff880264083260 ffff88026061ba78 ffffffff811e8eab
       0000000000000008 ffff880200000001 ffff88026408329f ffff88026a007700
      Call Trace:
       [<ffffffff813f6044>] dump_stack+0x63/0x8f
       [<ffffffff811e8eab>] print_trailer+0x14b/0x1f0
       [<ffffffff811e94c1>] check_bytes_and_report+0xc1/0x100
       [<ffffffff811e96c4>] check_object+0x1c4/0x240
       [<ffffffff81293fde>] ? ext4_htree_store_dirent+0x3e/0x120
       [<ffffffff811e9b44>] alloc_debug_processing+0x104/0x180
       [<ffffffff811eb7be>] ___slab_alloc+0x41e/0x460
       [<ffffffff81293fde>] ? ext4_htree_store_dirent+0x3e/0x120
       [<ffffffff8124590b>] ? __getblk_gfp+0x2b/0x60
       [<ffffffff8129b969>] ? ext4_getblk+0xa9/0x190
       [<ffffffff811eb820>] __slab_alloc+0x20/0x40
       [<ffffffff811ed320>] __kmalloc+0x210/0x280
       [<ffffffff81293fde>] ? ext4_htree_store_dirent+0x3e/0x120
       [<ffffffff812c1602>] ? ext4fs_dirhash+0xc2/0x2a0
       [<ffffffff81293fde>] ext4_htree_store_dirent+0x3e/0x120
       [<ffffffff812a4f47>] htree_dirblock_to_tree+0x187/0x1b0
       [<ffffffff812a5fd2>] ext4_htree_fill_tree+0xb2/0x2e0
       [<ffffffff811ebb7a>] ? kmem_cache_alloc_trace+0x1fa/0x220
       [<ffffffff81293e45>] ? ext4_readdir+0x775/0x8b0
       [<ffffffff81293cb1>] ext4_readdir+0x5e1/0x8b0
       [<ffffffff81221c82>] iterate_dir+0x92/0x120
       [<ffffffff81222118>] SyS_getdents+0x98/0x110
       [<ffffffff81221d10>] ? iterate_dir+0x120/0x120
       [<ffffffff818157f2>] entry_SYSCALL_64_fastpath+0x16/0x71
      FIX kmalloc-64: Restoring 0xffff880264083273-0xffff88026408329e=0x6b
      FIX kmalloc-64: Marking all objects used
      Signed-off-by: NJoão Paulo Rechi Vita <jprvita@endlessm.com>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      d46ddc59
  27. 28 11月, 2016 1 次提交
  28. 10 11月, 2016 1 次提交
  29. 14 10月, 2016 2 次提交
  30. 21 6月, 2016 1 次提交
    • G
      HID: i2c-hid: set power sleep before shutdown · d9f448e3
      Guohua Zhong 提交于
      Add i2c_hid_shutdown for i2c-hid driver to send suspend cmd & free
      irq before device shutdown.
      
      Some HW design (i.e. Umaro, a chromebook model) is that the power to
      i2c hid device won't down after device shutdown. Also the i2c-hid driver
      do not send suspend cmd to the hid i2c device and free its irq before
      shutdown.So if We touch the touchscreen or some other i2c hid device,
      the power consumtion will be go up even when the device is in shutdown
      state.
      
      Though the root cause maybe a HW issue. But it seems that it is a
      good pratice to set power sleep for i2c-hid device before shutdown.
      Signed-off-by: NGuohua Zhong <ghzhong@yifangdigital.com>
      Acked-By: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      d9f448e3
  31. 06 6月, 2016 1 次提交
  32. 15 3月, 2016 1 次提交
    • D
      HID: i2c-hid: fix OOB write in i2c_hid_set_or_send_report() · 3b654288
      Dmitry Torokhov 提交于
      Even though hid_hw_* checks that passed in data_len is less than
      HID_MAX_BUFFER_SIZE it is not enough, as i2c-hid does not necessarily
      allocate buffers of HID_MAX_BUFFER_SIZE but rather checks all device
      reports and select largest size. In-kernel users normally just send as much
      data as report needs, so there is no problem, but hidraw users can do
      whatever they please:
      
      BUG: KASAN: slab-out-of-bounds in memcpy+0x34/0x54 at addr ffffffc07135ea80
      Write of size 4101 by task syz-executor/8747
      CPU: 2 PID: 8747 Comm: syz-executor Tainted: G    BU         3.18.0 #37
      Hardware name: Google Tegra210 Smaug Rev 1,3+ (DT)
      Call trace:
      [<ffffffc00020ebcc>] dump_backtrace+0x0/0x258 arch/arm64/kernel/traps.c:83
      [<ffffffc00020ee40>] show_stack+0x1c/0x2c arch/arm64/kernel/traps.c:172
      [<     inline     >] __dump_stack lib/dump_stack.c:15
      [<ffffffc001958114>] dump_stack+0x90/0x140 lib/dump_stack.c:50
      [<     inline     >] print_error_description mm/kasan/report.c:97
      [<     inline     >] kasan_report_error mm/kasan/report.c:278
      [<ffffffc0004597dc>] kasan_report+0x268/0x530 mm/kasan/report.c:305
      [<ffffffc0004592e8>] __asan_storeN+0x20/0x150 mm/kasan/kasan.c:718
      [<ffffffc0004594e0>] memcpy+0x30/0x54 mm/kasan/kasan.c:299
      [<ffffffc001306354>] __i2c_hid_command+0x2b0/0x7b4 drivers/hid/i2c-hid/i2c-hid.c:178
      [<     inline     >] i2c_hid_set_or_send_report drivers/hid/i2c-hid/i2c-hid.c:321
      [<ffffffc0013079a0>] i2c_hid_output_raw_report.isra.2+0x3d4/0x4b8 drivers/hid/i2c-hid/i2c-hid.c:589
      [<ffffffc001307ad8>] i2c_hid_output_report+0x54/0x68 drivers/hid/i2c-hid/i2c-hid.c:602
      [<     inline     >] hid_hw_output_report include/linux/hid.h:1039
      [<ffffffc0012cc7a0>] hidraw_send_report+0x400/0x414 drivers/hid/hidraw.c:154
      [<ffffffc0012cc7f4>] hidraw_write+0x40/0x64 drivers/hid/hidraw.c:177
      [<ffffffc0004681dc>] vfs_write+0x1d4/0x3cc fs/read_write.c:534
      [<     inline     >] SYSC_pwrite64 fs/read_write.c:627
      [<ffffffc000468984>] SyS_pwrite64+0xec/0x144 fs/read_write.c:614
      Object at ffffffc07135ea80, in cache kmalloc-512
      Object allocated with size 268 bytes.
      
      Let's check data length against the buffer size before attempting to copy
      data over.
      
      Cc: stable@vger.kernel.org
      Reported-by: NAlexander Potapenko <glider@google.com>
      Signed-off-by: NDmitry Torokhov <dtor@chromium.org>
      Reviewed-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      3b654288
  33. 10 3月, 2016 1 次提交
    • D
      HID: i2c-hid: Fix suspend/resume when already runtime suspended · 01714a6f
      Doug Anderson 提交于
      On ACPI-based systems ACPI power domain code runtime resumes device before
      calling suspend method, which ensures that i2c-hid suspend code starts with
      device not in low-power state and with interrupts enabled.
      
      On other systems, especially if device is not a part of any power domain,
      we may end up calling driver's system-level suspend routine while the
      device is runtime-suspended (with controller in presumably low power state
      and interrupts disabled). This will result in interrupts being essentially
      disabled twice, and we will only re-enable them after both system resume
      and runtime resume methods complete. Unfortunately i2c_hid_resume() calls
      i2c_hid_hwreset() and that only works properly if interrupts are enabled.
      
      Also if device is runtime-suspended driver's suspend code may fail if it
      tries to issue I/O requests.
      
      Let's fix it by runtime-resuming the device if we need to run HID driver's
      suspend code and also disabling interrupts only if device is not already
      runtime-suspended. Also on resume we mark the device as running at full
      power (since that is what resetting will do to it).
      Reviewed-by: NBenson Leung <bleung@chromium.org>
      Tested-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Signed-off-by: NDoug Anderson <dianders@chromium.org>
      Signed-off-by: NDmitry Torokhov <dtor@chromium.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      01714a6f