Re: [PATCH v3] eeprom: at24: fix memory corruption race condition

From: Bartosz Golaszewski
Date: Tue Apr 23 2024 - 04:14:20 EST


On Mon, Apr 22, 2024 at 7:43 PM Daniel Okazaki <dtokazaki@xxxxxxxxxx> wrote:
>
> If the eeprom is not accessible, an nvmem device will be registered, the
> read will fail, and the device will be torn down. If another driver
> accesses the nvmem device after the teardown, it will reference
> invalid memory.
>
> Move the failure point before registering the nvmem device.
>
> Signed-off-by: Daniel Okazaki <dtokazaki@xxxxxxxxxx>
> Fixes: b20eb4c1f026 ("eeprom: at24: drop unnecessary label")
> ---

I will take this patch because it does make sense but for the record:
this doesn't fully fix the issue with the nvmem race when tearing down
the device.

Bart