Re: [PATCH v2] HID: hid-sensor-hub: avoid lock inversion in sensor_hub_remove()
From: Arnav Kapoor
Date: Fri Nov 20 2026 - 16:10:43 EST
On Fri, Nov 20, 2026 at 05:42:56PM +0530, Ayaan Mirza Baig wrote:
> Changes in v2:
> - Pass 'data' instead of NUL to device_for_each_child() so
> sensor_hub_finalize_pending_fn() does not dereference a NULL sd pointer.
...
> device_for_each_child(&hdev->dev, NULL,
> sensor_hub_finalize_pending_fn);
This line is still unchanged context in v2, so NULL is still passed and
the callback still does spin_lock_irqsave(&sd->lock, flags) on a NULL
sd. The diffstat (4 insertions, 3 deletions) matches that: the only
removed lines are the lock/unlock pair and the flags variable. Perhaps
the change didn't make it into the commit before git format-patch?
Separately, Zheng Shuhao posted a fix for the same syzbot report:
https://lore.kernel.org/all/20261120135005.566-1-viennaoffh@xxxxxxxxx/
It passes the hub data to the callback and also skips children without
platform_data (e.g. the HID battery power_supply child with
CONFIG_HID_BATTERY_STRENGTH=y), which would otherwise still be
dereferenced in sensor_hub_finalize_pending_fn(). It might be worth
agreeing between you which version goes forward.
Thanks,
Arnav