Re: [PATCH 05/10] Input: stinger - zero-initialise driver state in stinger_connect()
From: Dmitry Torokhov
Date: Mon Nov 23 2026 - 15:19:45 EST
On Mon, Nov 23, 2026 at 06:31:11PM +0000, Lee Jones wrote:
> stinger_connect() allocates struct stinger with kmalloc_obj() without
> initialising the signed packet index stinger->idx.
>
> When serial bytes arrive in stinger_interrupt(), negative values of
> stinger->idx pass the stinger->idx < STINGER_MAX_LENGTH check and cause
> stinger->data[stinger->idx++] to write before the start of stinger->data
> on the heap, corrupting stinger->dev or adjacent slab memory. Initial
> values of 4 or greater never match the stinger->idx == 4 reset check and
> permanently wedge packet assembly.
>
> Allocate struct stinger with kzalloc_obj() so stinger->idx and the
> packet buffer start zeroed.
>
> Fixes: 17dd3f0f7aa7 ("[PATCH] drivers/input/joystick: convert to dynamic input_dev allocation")
> Closes: https://sashiko.dev/#/bug/linux-bad333c0-5b62-4ca5-ad93-204400bcba3a
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
Applied, thank you.
--
Dmitry