[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <34a94b40-9532-45b0-b745-ba0c2e9846c3@gmx.de>
Date: Fri, 12 Jul 2024 21:27:58 +0200
From: Armin Wolf <W_Armin@....de>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Heiner Kallweit <hkallweit1@...il.com>, Guenter Roeck <linux@...ck-us.net>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] eeprom: ee1004: Unlock on error path in probe()
Am 12.07.24 um 16:04 schrieb Dan Carpenter:
> Call mutex_unlock() before returning an error in ee1004_probe()
Good catch, but it seems that i messed up the locking part event more, sorry.
Because if devm_add_action_or_reset() does a reset operation, a deadlock
will occur since ee1004_cleanup_bus_data() will try to lock the mutex again.
I can provide a cleanup patch to fix both problems.
Thanks,
Armin Wolf
>
> Fixes: 55d57ef6fa97 ("eeprom: ee1004: Use devres for bus data cleanup")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
> drivers/misc/eeprom/ee1004.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/eeprom/ee1004.c b/drivers/misc/eeprom/ee1004.c
> index d4aeeb2b2169..adba67cef1e7 100644
> --- a/drivers/misc/eeprom/ee1004.c
> +++ b/drivers/misc/eeprom/ee1004.c
> @@ -272,8 +272,10 @@ static int ee1004_probe(struct i2c_client *client)
> }
>
> err = devm_add_action_or_reset(&client->dev, ee1004_cleanup_bus_data, bd);
> - if (err < 0)
> + if (err < 0) {
> + mutex_unlock(&ee1004_bus_lock);
> return err;
> + }
>
> i2c_set_clientdata(client, bd);
>
Powered by blists - more mailing lists