Re: [PATCH] HID: mcp2221: always initialize and cancel init_work
From: Jiri Kosina
Date: Fri Oct 16 2026 - 05:54:32 EST
On Fri, 2 Oct 2026, Myeonghun Pak wrote:
> The writable gpio_mode_enforce parameter can change between probe and
> remove.
>
> If it changes from false to true after probe, remove skips cancellation
> of init_work. Pending or running work can then access devm-managed
> driver state after teardown. Changing it from true to false can make
> remove cancel an uninitialized delayed work item.
>
> Initialize init_work whenever IIO is reachable and cancel it
> unconditionally on remove. Keep the parameter check only for scheduling
> the initialization.
>
> The false-to-true cancellation gap was previously reported by Sashiko.
> We also encountered this issue during our static-analysis research.
>
> Fixes: 200e6c6e94fa ("HID: mcp2221: Add module parameter to enfoce GPIO mode")
> Reported-by: Sashiko <sashiko-bot@xxxxxxxxxx>
> Link: https://lore.kernel.org/linux-input/20260715143415.916A21F00A3A@xxxxxxxxxxxxxxx/
> Assisted-by: LLM
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>
Applied to hid.git#for-7.3/upstream-fixes, thanks.
--
Jiri Kosina
SUSE Labs