From: Armin Wolf <W_Armin@gmx.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: "Arnd Bergmann" <arnd@arndb.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Heiner Kallweit" <hkallweit1@gmail.com>,
"Guenter Roeck" <linux@roeck-us.net>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] eeprom: ee1004: Unlock on error path in probe()
Date: Fri, 12 Jul 2024 21:27:58 +0200 [thread overview]
Message-ID: <34a94b40-9532-45b0-b745-ba0c2e9846c3@gmx.de> (raw)
In-Reply-To: <b5c51026-a2de-434b-8f45-44a641ab1c82@stanley.mountain>
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@linaro.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);
>
prev parent reply other threads:[~2024-07-12 19:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 14:04 Dan Carpenter
2024-07-12 14:12 ` Arnd Bergmann
2024-07-12 15:42 ` Markus Elfring
2024-07-12 16:14 ` Greg Kroah-Hartman
2024-07-12 19:27 ` Armin Wolf [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=34a94b40-9532-45b0-b745-ba0c2e9846c3@gmx.de \
--to=w_armin@gmx.de \
--cc=arnd@arndb.de \
--cc=dan.carpenter@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hkallweit1@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®