Skip to content
Permalink
F-A-Sulaiman/f…
Switch branches/tags

Commits on Aug 16, 2021

  1. fix slab-out-of-bounds Write in betop_probe

    This patch resolves the bug 'KASAN: slab-out-of-bounds Write in betop_probe' reported by Syzbot.
    This checkes hid_device's input is non empty before it's been used.
    
    Signed-off-by: F.A. SULAIMAN <asha.16@itfac.mrt.ac.lk>
    asha1234-cyber authored and intel-lab-lkp committed Aug 16, 2021

Commits on Jul 29, 2021

  1. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 29, 2021
  2. HID: ft260: fix device removal due to USB disconnect

    This commit fixes a functional regression introduced by the commit 82f09a6
    ("HID: ft260: improve error handling of ft260_hid_feature_report_get()")
    when upon USB disconnect, the FTDI FT260 i2c device is still available within
    the /dev folder.
    
    In my company's product, where the host USB to FT260 USB connection is
    hard-wired in the PCB, the issue is not reproducible. To reproduce it, I used
    the VirtualBox Ubuntu 20.04 VM and the UMFT260EV1A development module for the
    FTDI FT260 chip:
    
    Plug the UMFT260EV1A module into a USB port and attach it to VM.
    
    The VM shows 2 i2c devices under the /dev:
        michael@michael-VirtualBox:~$ ls /dev/i2c-*
        /dev/i2c-0  /dev/i2c-1
    
    The i2c-0 is not related to the FTDI FT260:
        michael@michael-VirtualBox:~$ cat /sys/bus/i2c/devices/i2c-0/name
        SMBus PIIX4 adapter at 4100
    
    The i2c-1 is created by hid-ft260.ko:
        michael@michael-VirtualBox:~$ cat /sys/bus/i2c/devices/i2c-1/name
        FT260 usb-i2c bridge on hidraw1
    
    Now, detach the FTDI FT260 USB device from VM. We expect the /dev/i2c-1
    to disappear, but it's still here:
        michael@michael-VirtualBox:~$ ls /dev/i2c-*
        /dev/i2c-0  /dev/i2c-1
    
    And the kernel log shows:
        [  +0.001202] usb 2-2: USB disconnect, device number 3
        [  +0.000109] ft260 0003:0403:6030.0002: failed to retrieve system status
        [  +0.000316] ft260 0003:0403:6030.0003: failed to retrieve system status
    
    It happens because the commit 82f09a6 changed the ft260_get_system_config()
    return logic. This caused the ft260_is_interface_enabled() to exit with error
    upon the FT260 device USB disconnect, which in turn, aborted the ft260_remove()
    before deleting the FT260 i2c device and cleaning its sysfs stuff.
    
    This commit restores the FT260 USB removal functionality and improves the
    ft260_is_interface_enabled() code to handle correctly all chip modes defined
    by the device interface configuration pins DCNF0 and DCNF1.
    
    Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
    Acked-by: Aaron Jones (FTDI-UK) <aaron.jones@ftdichip.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    MichaelZaidman authored and Jiri Kosina committed Jul 29, 2021

Commits on Jul 28, 2021

  1. Merge branches 'for-5.15/wacom', 'for-5.15/goodix', 'for-5.15/cmedia'…

    … and 'for-5.15/apple' into for-next
    Jiri Kosina committed Jul 28, 2021
  2. HID: apple: Add missing scan code event for keys handled by hid-apple

    When an EV_KEY event is generated by hid-apple due to special key
    mapping, the usual associated scan code event (EV_MSC) is missing.
    This issue can be seen with the evtest utility.
    
    Add the scan code event for these special keys.
    
    BugLink: https://bugs.debian.org/757356
    Co-developed-by: Daniel Lin <ephemient@gmail.com>
    Signed-off-by: Daniel Lin <ephemient@gmail.com>
    Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    vinc17fr authored and Jiri Kosina committed Jul 28, 2021
  3. HID: cmedia: add support for HS-100B mute button

    These chips report mute button events in bit 4 of their report without it
    being part of the report descriptor.
    Use a custom descriptor that maps this bit.
    
    Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    t-8ch authored and Jiri Kosina committed Jul 28, 2021
  4. HID: i2c-hid: goodix: Use the devm variant of regulator_register_noti…

    …fier()
    
    In commit 18eeef4 ("HID: i2c-hid: goodix: Tie the reset line to
    true state of the regulator") I added a call to
    regulator_register_notifier() but no call to unregister. That's a
    bug. Let's use the devm variant to handle the unregistering.
    
    Fixes: 18eeef4 ("HID: i2c-hid: goodix: Tie the reset line to true state of the regulator")
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    dianders authored and Jiri Kosina committed Jul 28, 2021
  5. HID: wacom: Refactor touch input mute checks into a common function

    We perform this same set of tests to see if touch input is muted in
    several places. We might as well replace these independent copies with
    an inline function.
    
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    jigpu authored and Jiri Kosina committed Jul 28, 2021
  6. HID: wacom: Avoid sending empty sync events

    Empty sync events clutter up logs and are a waste of CPU cycles. We can
    avoid sending mt_sync events if touch is disabled or a specific slot is
    unused. We can avoid sending full sync events if no events were generated.
    
    Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    jigpu authored and Jiri Kosina committed Jul 28, 2021
  7. HID: wacom: Short-circuit processing of touch when it is disabled

    Avoid doing unnecessary work when touch is disabled by detecting this
    condition and returning early. Note that the probe process sends GET
    FEATURE requests to discover e.g. HID_DG_CONTACTMAX, so we can't start
    ignoring touch reports until probe finishes.
    
    Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    jigpu authored and Jiri Kosina committed Jul 28, 2021
  8. HID: wacom: set initial hardware touch switch state to 'off'

    Wacom touch devices have two types of touch switches: softkey touch
    toggle and hardware touch switch. For softkey toggle, we assume
    touch is on by default in the driver. However the hardware touch
    switch is controlled by end users. We don't know if it's on or off
    before getting the status event.
    
    This patch sets touch off for devices with a hardware switch until we
    get the status. This is a bit safer for users who leave the switch "off"
    and don't want any accidental touches. The tradeoff is a slight delay
    between device connection and touch becoming enabled for users who
    leave the switch "on".
    
    Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
    Reviewed-by: Jason Gerecke <jason.gerecke@wacom.com>
    Tested-by: Jason Gerecke <jason.gerecke@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Ping Cheng authored and Jiri Kosina committed Jul 28, 2021
  9. HID: wacom: Skip processing of touches with negative slot values

    The `input_mt_get_slot_by_key` function may return a negative value
    if an error occurs (e.g. running out of slots). If this occurs we
    should really avoid reporting any data for the slot.
    
    Signed-off-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    jigpu authored and Jiri Kosina committed Jul 28, 2021
  10. HID: wacom: Re-enable touch by default for Cintiq 24HDT / 27QHDT

    Commit 670e909 ("HID: wacom: support named keys on older devices")
    added support for sending named events from the soft buttons on the
    24HDT and 27QHDT. In the process, however, it inadvertantly disabled the
    touchscreen of the 24HDT and 27QHDT by default. The
    `wacom_set_shared_values` function would normally enable touch by default
    but because it checks the state of the non-shared `has_mute_touch_switch`
    flag and `wacom_setup_touch_input_capabilities` sets the state of the
    /shared/ version, touch ends up being disabled by default.
    
    This patch sets the non-shared flag, letting `wacom_set_shared_values`
    take care of copying the value over to the shared version and setting
    the default touch state to "on".
    
    Fixes: 670e909 ("HID: wacom: support named keys on older devices")
    CC: stable@vger.kernel.org # 5.4+
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
    Reviewed-by: Ping Cheng <ping.cheng@wacom.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    jigpu authored and Jiri Kosina committed Jul 28, 2021
  11. HID: Kconfig: Fix spelling mistake "Uninterruptable" -> "Uninterrupti…

    …ble"
    
    There is a spelling mistake in the Kconfig text. Fix it.
    
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Colin Ian King authored and Jiri Kosina committed Jul 28, 2021
  12. HID: apple: Add support for Keychron K1 wireless keyboard

    The Keychron K1 wireless keyboard has a set of Apple-like function keys
    and an Fn key that works like on an Apple bluetooth keyboard. It
    identifies as an Apple Alu RevB ANSI keyboard (05ac:024f) over USB and
    BT. Use hid-apple for it so the Fn key and function keys work correctly.
    
    Signed-off-by: Haochen Tong <i@hexchain.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    hexchain authored and Jiri Kosina committed Jul 28, 2021
  13. Merge branch 'for-5.15/core' into for-next

    Jiri Kosina committed Jul 28, 2021
  14. HID: usbhid: free raw_report buffers in usbhid_stop

    Free the unsent raw_report buffers when the device is removed.
    
    Fixes a memory leak reported by syzbot at:
    https://syzkaller.appspot.com/bug?id=7b4fa7cb1a7c2d3342a2a8a6c53371c8c418ab47
    
    Reported-by: syzbot+47b26cd837ececfc666d@syzkaller.appspotmail.com
    Tested-by: syzbot+47b26cd837ececfc666d@syzkaller.appspotmail.com
    Signed-off-by: Anirudh Rayabharam <mail@anirudhrb.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    anirudhrb authored and Jiri Kosina committed Jul 28, 2021
  15. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 28, 2021
  16. HID: fix typo in Kconfig

    There is a missing space in "relyingon".
    Add it.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    tititiou36 authored and Jiri Kosina committed Jul 28, 2021

Commits on Jul 27, 2021

  1. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 27, 2021
  2. HID: ft260: fix format type warning in ft260_word_show()

    Fixes: 6a82582 ("HID: ft260: add usb hid to i2c host bridge driver")
    
    Fix warning reported by static analysis when built with W=1 for arm64 by
    clang version 13.0.0
    
    >> drivers/hid/hid-ft260.c:794:44: warning: format specifies type 'short' but
       the argument has type 'int' [-Wformat]
               return scnprintf(buf, PAGE_SIZE, "%hi\n", le16_to_cpu(*field));
                                                 ~~~     ^~~~~~~~~~~~~~~~~~~
                                                 %i
       include/linux/byteorder/generic.h:91:21: note: expanded from
                                                macro 'le16_to_cpu'
       #define le16_to_cpu __le16_to_cpu
                           ^
       include/uapi/linux/byteorder/big_endian.h:36:26: note: expanded from
                                                        macro '__le16_to_cpu'
       #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       include/uapi/linux/swab.h:105:2: note: expanded from macro '__swab16'
               (__builtin_constant_p((__u16)(x)) ?     \
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Any sprintf style use of %h or %hi for a sub-int sized value isn't useful
    since integer promotion is done on the value anyway. So, use %d instead.
    
    https://lore.kernel.org/lkml/CAHk-=wgoxnmsj8GEVFJSvTwdnWm8wVJthefNk2n6+4TC=20e0Q@mail.gmail.com/
    
    Signed-off-by: Michael Zaidman <michael.zaidman@gmail.com>
    Suggested-by: Joe Perches <joe@perches.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    MichaelZaidman authored and Jiri Kosina committed Jul 27, 2021

Commits on Jul 15, 2021

  1. Merge branch 'for-5.15/goodix' into for-next

    Jiri Kosina committed Jul 15, 2021
  2. HID: i2c-hid: goodix: Tie the reset line to true state of the regulator

    The regulator for the touchscreen could be:
    * A dedicated regulator just for the touchscreen.
    * A regulator shared with something else in the system.
    * An always-on regulator.
    
    How we want the "reset" line to behave depends a bit on which of those
    three cases we're in. Currently the code is written with the
    assumption that it has a dedicated regulator, but that's not really
    guaranteed to be the case.
    
    The problem we run into is that if we leave the touchscreen powered on
    (because someone else is requesting the regulator or it's an always-on
    regulator) and we assert reset then we apparently burn an extra 67 mW
    of power. That's not great.
    
    Let's instead tie the control of the reset line to the true state of
    the regulator as reported by regulator notifiers. If we have an
    always-on regulator our notifier will never be called. If we have a
    shared regulator then our notifier will be called when the touchscreen
    is truly turned on or truly turned off.
    
    Using notifiers like this nicely handles all the cases without
    resorting to hacks like pretending that there is no "reset" GPIO if we
    have an always-on regulator.
    
    NOTE: if the regulator is on a shared line it's still possible that
    things could be a little off. Specifically, this case is not handled
    even after this patch:
    1. Suspend goodix (send "sleep", goodix stops requesting regulator on)
    2. Other regulator user turns off (regulator fully turns off).
    3. Goodix driver gets notified and asserts reset.
    4. Other regulator user turns on.
    5. Goodix driver gets notified and deasserts reset.
    6. Nobody resumes goodix.
    
    With that set of steps we'll have reset deasserted but we will have
    lost the results of the I2C_HID_PWR_SLEEP from the suspend path. That
    means we might be in higher power than we could be even if the goodix
    driver thinks things are suspended. Presumably, however, we're still
    in better shape than if we were asserting "reset" the whole time. If
    somehow the above situation is actually affecting someone and we want
    to do better we can deal with it when we have a real use case.
    
    Signed-off-by: Douglas Anderson <dianders@chromium.org>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    dianders authored and Jiri Kosina committed Jul 15, 2021
  3. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 15, 2021
  4. HID: amd_sfh: Use correct MMIO register for DMA address

    amd_stop_sensor_v2 accidentally used a different MMIO register than
    amd_start_sensor_v2 for the DMA address.
    
    Fixes: f264481 ("HID: amd_sfh: Extend driver capabilities for multi-generation support")
    Signed-off-by: Dylan MacKenzie <ecstaticmorse@gmail.com>
    Acked-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    ecstatic-morse authored and Jiri Kosina committed Jul 15, 2021
  5. Merge branch 'for-5.15/magicmouse' into for-next

    Jiri Kosina committed Jul 15, 2021
  6. HID: magicmouse: high-resolution scroll threshold

    In order to avoid triggering involuntary high-resolution scroll events
    due to tiny touch movement deltas, add a movement threshold.
    
    The value chosen for the threshold, about 1.5 ~ 2 mm, is similar to the
    threshold used on touchpads by libinput (see libinput
    evdev-mt-touchpad-gestures.c) to try to keep the scroll experience
    consistent.
    
    Signed-off-by: José Expósito <jose.exposito89@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    JoseExposito authored and Jiri Kosina committed Jul 15, 2021
  7. HID: magicmouse: enable high-resolution scroll

    The Magic Mouse, generations 1 and 2, doesn't have a physical scroll
    wheel, instead, the REL_WHEEL and REL_HWHEEL events are emulated
    when sliding a finger on the surface of the mouse.
    However, the smooth movement of the finger is transformed into a step
    based scroll on the screen, leading to a suboptimal user experience.
    
    Emulate high-resolution scroll by sending REL_WHEEL_HI_RES and
    REL_HWHEEL_HI_RES events so the scroll on the screen is closer to the
    finger movement.
    
    Signed-off-by: José Expósito <jose.exposito89@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    JoseExposito authored and Jiri Kosina committed Jul 15, 2021
  8. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 15, 2021
  9. HID: asus: Remove check for same LED brightness on set

    Remove the early return on LED brightness set so that any controller
    application, daemon, or desktop may set the same brightness at any stage.
    
    This is required because many ASUS ROG keyboards will default to max
    brightness on laptop resume if the LEDs were set to off before sleep.
    
    Signed-off-by: Luke D Jones <luke@ljones.dev>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    flukejones authored and Jiri Kosina committed Jul 15, 2021
  10. Merge branch 'for-5.15/core' into for-next

    Jiri Kosina committed Jul 15, 2021
  11. HID: input: do not report stylus battery state as "full"

    The power supply states of discharging, charging, full, etc, represent
    state of charging, not the capacity level of the battery (for which
    we have a separate property). Current HID usage tables to not allow
    for expressing charging state of the batteries found in generic
    styli, so we should simply assume that the battery is discharging
    even if current capacity is at 100% when battery strength reporting
    is done via HID interface. In fact, we were doing just that before
    commit 581c448.
    
    This change helps UIs to not mis-represent fully charged batteries in
    styli as being charging/topping-off.
    
    Fixes: 581c448 ("HID: input: map digitizer battery usage")
    Reported-by: Kenneth Albanowski <kenalba@google.com>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    dtor authored and Jiri Kosina committed Jul 15, 2021
  12. Merge branch 'for-5.14/upstream-fixes' into for-next

    Jiri Kosina committed Jul 15, 2021
  13. HID: intel-ish-hid: use async resume function

    ISH IPC driver uses asynchronous workqueue to do resume now, but there is
    a potential timing issue: when child devices resume before bus driver, it
    will cause child devices resume failed and cannot be recovered until
    reboot. The current implementation in this case do wait for IPC to resume
    but fail to accommodate for a case when there is no ISH reboot and soft
    resume is taking time. This issue is apparent on Tiger Lake platform with
    5.11.13 kernel when doing suspend to idle then resume(s0ix) test. To
    resolve this issue, we change ISHTP HID client to use asynchronous resume
    callback too. In the asynchronous resume callback, it waits for the ISHTP
    resume done event, and then notify ISHTP HID client link ready.
    
    Signed-off-by: Ye Xiang <xiang.ye@intel.com>
    Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    yeapa authored and Jiri Kosina committed Jul 15, 2021

Commits on Jun 30, 2021

  1. Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…

    …/git/hid/hid
    
    Pull HID updates from Jiri Kosina:
    
     - patch series that ensures that hid-multitouch driver disables touch
       and button-press reporting on hid-mt devices during suspend when the
       device is not configured as a wakeup-source, from Hans de Goede
    
     - support for ISH DMA on Intel EHL platform, from Even Xu
    
     - support for Renoir and Cezanne SoCs, Ambient Light Sensor and Human
       Presence Detection sensor for amd-sfh driver, from Basavaraj Natikar
    
     - other assorted code cleanups and device-specific fixes/quirks
    
    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid: (45 commits)
      HID: thrustmaster: Switch to kmemdup() when allocate change_request
      HID: multitouch: Disable event reporting on suspend when the device is not a wakeup-source
      HID: logitech-dj: Implement may_wakeup ll-driver callback
      HID: usbhid: Implement may_wakeup ll-driver callback
      HID: core: Add hid_hw_may_wakeup() function
      HID: input: Add support for Programmable Buttons
      HID: wacom: Correct base usage for capacitive ExpressKey status bits
      HID: amd_sfh: Add initial support for HPD sensor
      HID: amd_sfh: Extend ALS support for newer AMD platform
      HID: amd_sfh: Extend driver capabilities for multi-generation support
      HID: surface-hid: Fix get-report request
      HID: sony: fix freeze when inserting ghlive ps3/wii dongles
      HID: usbkbd: Avoid GFP_ATOMIC when GFP_KERNEL is possible
      HID: amd_sfh: change in maintainer
      HID: intel-ish-hid: ipc: Specify that EHL no cache snooping
      HID: intel-ish-hid: ishtp: Add dma_no_cache_snooping() callback
      HID: intel-ish-hid: Set ISH driver depends on x86
      HID: hid-input: add Surface Go battery quirk
      HID: intel-ish-hid: Fix minor typos in comments
      HID: usbmouse: Avoid GFP_ATOMIC when GFP_KERNEL is possible
      ...
    torvalds committed Jun 30, 2021
Older