1. 13 Dec, 2022 1 commit
  2. 08 Dec, 2022 2 commits
  3. 22 Nov, 2022 1 commit
  4. 21 Nov, 2022 2 commits
    • ZhangPeng's avatar
      HID: core: fix shift-out-of-bounds in hid_report_raw_event · ec61b419
      ZhangPeng authored
      Syzbot reported shift-out-of-bounds in hid_report_raw_event.
      
      microsoft 0003:045E:07DA.0001: hid_field_extract() called with n (128) >
      32! (swapper/0)
      ======================================================================
      UBSAN: shift-out-of-bounds in drivers/hid/hid-core.c:1323:20
      shift exponent 127 is too large for 32-bit type 'int'
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted
      6.1.0-rc4-syzkaller-00159-g4bbf3422 #0
      Hardware name: Google Compute Engine/Google Compute Engine, BIOS
      Google 10/26/2022
      Call Trace:
       <IRQ>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
       ubsan_epilogue lib/ubsan.c:151 [inline]
       __ubsan_handle_shift_out_of_bounds+0x3a6/0x420 lib/ubsan.c:322
       snto32 drivers/hid/hid-core.c:1323 [inline]
       hid_input_fetch_field drivers/hid/hid-core.c:1572 [inline]
       hid_process_report drivers/hid/hid-core.c:1665 [inline]
       hid_report_raw_event+0xd56/0x18b0 drivers/hid/hid-core.c:1998
       hid_input_report+0x408/0x4f0 drivers/hid/hid-core.c:2066
       hid_irq_in+0x459/0x690 drivers/hid/usbhid/hid-core.c:284
       __usb_hcd_giveback_urb+0x369/0x530 drivers/usb/core/hcd.c:1671
       dummy_timer+0x86b/0x3110 drivers/usb/gadget/udc/dummy_hcd.c:1988
       call_timer_fn+0xf5/0x210 kernel/time/timer.c:1474
       expire_timers kernel/time/timer.c:1519 [inline]
       __run_timers+0x76a/0x980 kernel/time/timer.c:1790
       run_timer_softirq+0x63/0xf0 kernel/time/timer.c:1803
       __do_softirq+0x277/0x75b kernel/softirq.c:571
       __irq_exit_rcu+0xec/0x170 kernel/softirq.c:650
       irq_exit_rcu+0x5/0x20 kernel/softirq.c:662
       sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1107
      ======================================================================
      
      If the size of the integer (unsigned n) is bigger than 32 in snto32(),
      shift exponent will be too large for 32-bit type 'int', resulting in a
      shift-out-of-bounds bug.
      Fix this by adding a check on the size of the integer (unsigned n) in
      snto32(). To add support for n greater than 32 bits, set n to 32, if n
      is greater than 32.
      
      Reported-by: syzbot+8b1641d2f14732407e23@syzkaller.appspotmail.com
      Fixes: dde5845a ("[PATCH] Generic HID layer - code split")
      Signed-off-by: default avatarZhangPeng <zhangpeng362@huawei.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      ec61b419
    • José Expósito's avatar
      HID: uclogic: Add HID_QUIRK_HIDINPUT_FORCE quirk · 3405a4be
      José Expósito authored
      Commit f7d8e387 ("HID: uclogic: Switch to Digitizer usage for
      styluses") changed the usage used in UCLogic from "Pen" to "Digitizer".
      
      However, the IS_INPUT_APPLICATION() macro evaluates to false for
      HID_DG_DIGITIZER causing issues with the XP-Pen Star G640 tablet.
      
      Add the HID_QUIRK_HIDINPUT_FORCE quirk to bypass the
      IS_INPUT_APPLICATION() check.
      Reported-by: default avatarTorge Matthies <openglfreak@googlemail.com>
      Reported-by: default avatarAlexander Zhang <alex@alexyzhang.dev>
      Tested-by: default avatarAlexander Zhang <alex@alexyzhang.dev>
      Signed-off-by: default avatarJosé Expósito <jose.exposito89@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      3405a4be
  5. 15 Nov, 2022 1 commit
  6. 14 Nov, 2022 4 commits
  7. 04 Nov, 2022 1 commit
  8. 02 Nov, 2022 4 commits
    • Yang Yingliang's avatar
      HID: hyperv: fix possible memory leak in mousevsc_probe() · b5bcb94b
      Yang Yingliang authored
      If hid_add_device() returns error, it should call hid_destroy_device()
      to free hid_dev which is allocated in hid_allocate_device().
      
      Fixes: 74c4fb05 ("HID: hv_mouse: Properly add the hid device")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarWei Liu <wei.liu@kernel.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      b5bcb94b
    • Colin Ian King's avatar
      HID: asus: Remove unused variable in asus_report_tool_width() · 7f9dbf54
      Colin Ian King authored
      Variable count is just being incremented and it's never used
      anywhere else. The variable and the increment are redundant so
      remove it.
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      7f9dbf54
    • Kerem Karabay's avatar
      HID: apple: enable APPLE_ISO_TILDE_QUIRK for the keyboards of Macs with the T2 chip · 084bc074
      Kerem Karabay authored
      The iso_layout parameter must be manually set to get the driver to
      swap KEY_102ND and KEY_GRAVE. This patch eliminates the need to do that.
      
      This is safe to do, as Macs with keyboards that do not need the quirk
      will keep working the same way as the value of hid->country will be
      different than HID_COUNTRY_INTERNATIONAL_ISO. This was tested by one
      person with a Mac with the WELLSPRINGT2_J152F keyboard with a layout
      that does not require the quirk to be set.
      Signed-off-by: default avatarKerem Karabay <kekrby@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      084bc074
    • Kerem Karabay's avatar
      HID: apple: fix key translations where multiple quirks attempt to translate the same key · 5476fcf7
      Kerem Karabay authored
      The hid-apple driver does not support chaining translations or
      dependencies on other translations. This creates two problems:
      
      1 - In Non-English keyboards of Macs, KEY_102ND and KEY_GRAVE are
      swapped and the APPLE_ISO_TILDE_QUIRK is used to work around this
      problem. The quirk is not set for the Macs where these bugs happen yet
      (see the 2nd patch for that), but this can be forced by setting the
      iso_layout parameter. Unfortunately, this only partially works.
      KEY_102ND gets translated to KEY_GRAVE, but KEY_GRAVE does not get
      translated to KEY_102ND, so both of them end up functioning as
      KEY_GRAVE. This is because the driver translates the keys as if Fn was
      pressed and the original is sent if it is not pressed, without any
      further translations happening on the key[#463]. KEY_GRAVE is present at
      macbookpro_no_esc_fn_keys[#195], so this is what happens:
      
          - KEY_GRAVE -> KEY_ESC (as if Fn is pressed)
          - KEY_GRAVE is returned (Fn isn't pressed, so translation is discarded)
          - KEY_GRAVE -> KEY_102ND (this part is not reached!)
          ...
      
      2 - In case the touchbar does not work, the driver supports sending
      Escape when Fn+KEY_GRAVE is pressed. As mentioned previously, KEY_102ND
      is actually KEY_GRAVE and needs to be translated before this happens.
      
      Normally, these are the steps that should happen:
      
          - KEY_102ND -> KEY_GRAVE
          - KEY_GRAVE -> KEY_ESC (Fn is pressed)
          - KEY_ESC is returned
      
      Though this is what happens instead, as dependencies on other
      translations are not supported:
      
          - KEY_102ND -> KEY_ESC (Fn is pressed)
          - KEY_ESC is returned
      
      This patch fixes both bugs by ordering the translations correctly and by
      making the translations continue and not return immediately after
      translating a key so that chained translations work and translations can
      depend on other ones.
      
      This patch also simplifies the implementation of the swap_fn_leftctrl
      option a little bit, as it makes it simply use a normal translation
      instead adding extra code to translate a key to KEY_FN[#381]. This change
      wasn't put in another patch as the code that translates the Fn key needs
      to be changed because of the changes in the patch, and those changes
      would be discarded with the next patch anyway (the part that originally
      translates KEY_FN to KEY_LEFTCTRL needs to be made an else-if branch of
      the part that transltes KEY_LEFTCTRL to KEY_FN).
      
      Note: Line numbers (#XYZ) are for drivers/hid/hid-apple.c at commit
      20afcc46 ("HID: apple: Add "GANSS" to the non-Apple list").
      
      Note: These bugs are only present on Macs with a keyboard with no
      dedicated escape key and a non-English layout.
      Signed-off-by: default avatarKerem Karabay <kekrby@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      5476fcf7
  9. 22 Oct, 2022 1 commit
    • Linus Torvalds's avatar
      Merge tag 'for-linus-2022102101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · 334fe5d3
      Linus Torvalds authored
      Pull HID fixes from Benjamin Tissoires:
      
       - a 12 year old bug fix for the Apple Magic Trackpad v1 (José Expósito)
      
       - a fix for a potential crash on removal of the Playstation controllers
         (Roderick Colenbrander)
      
       - a few new device IDs and device-specific quirks, most notably support
         of the new Playstation DualSense Edge controller
      
      * tag 'for-linus-2022102101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: lenovo: Make array tp10ubkbd_led static const
        HID: saitek: add madcatz variant of MMO7 mouse device ID
        HID: playstation: support updated DualSense rumble mode.
        HID: playstation: add initial DualSense Edge controller support
        HID: playstation: stop DualSense output work on remove.
        HID: magicmouse: Do not set BTN_MOUSE on double report
      334fe5d3
  10. 21 Oct, 2022 23 commits