Re: [PATCH 5/6] w1: ds28e04: Always allocate family data to avoid NULL dereference

From: Krzysztof Kozlowski

Date: Wed Dec 02 2026 - 05:45:42 EST


On 02/12/2026 10:36, Lee Jones wrote:
> w1_f1C_add_slave() only allocates sl->family_data when
> w1_enable_crccheck is enabled at attach time. Because
> w1_enable_crccheck can be toggled at runtime through the crccheck sysfs
> attribute, enabling it after a slave has attached causes subsequent
> EEPROM reads and writes to dereference a NULL sl->family_data pointer.
> Conversely, writing while crccheck is disabled skips invalidating
> f1C->validcrc, leaving stale cached pages if crccheck is later
> re-enabled.
>
> Unconditionally allocate sl->family_data in w1_f1C_add_slave() and
> always invalidate the page CRC cache entry in w1_f1C_write().
>
> Fixes: fbf7f7b4e2ae ("w1: Add 1-wire slave device driver for DS28E04-100")
> Closes: https://sashiko.dev/#/bug/linux-2eaa9a0e-9abb-4060-9da4-7d85a0bb8f0a
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Lee Jones <lee@xxxxxxxxxx>

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@xxxxxxxxxxxxxxxx>

Best regards,
Krzysztof