From: Sascha Hauer <[email protected]> The AT24 driver might register some i2c devices using i2c_new_dummy(). These are freed in the error path, but not unregistered which leads to memory corruptions later.
Link: https://lore.barebox.org/[email protected] Signed-off-by: Sascha Hauer <[email protected]> (cherry picked from commit ebd2558bf99b3758854ac2b104cff7cfbd2cebb9) Signed-off-by: Ahmad Fatoum <[email protected]> --- drivers/eeprom/at24.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/eeprom/at24.c b/drivers/eeprom/at24.c index 667d111b349d..feb11b1cbb18 100644 --- a/drivers/eeprom/at24.c +++ b/drivers/eeprom/at24.c @@ -492,8 +492,11 @@ static int at24_probe(struct device *dev) err_devfs_create: err_clients: - for (i = 1; i < num_addresses; i++) + for (i = 1; i < num_addresses; i++) { + if (at24->client[i]) + i2c_unregister_device(at24->client[i]); kfree(at24->client[i]); + } if (gpio_is_valid(at24->wp_gpio)) gpio_free(at24->wp_gpio); -- 2.47.3
