linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: fix a double-unlock issue
@ 2020-05-23  3:16 wu000273
  2020-06-25  8:26 ` Enric Balletbo i Serra
  2020-07-01  9:10 ` Enric Balletbo i Serra
  0 siblings, 2 replies; 4+ messages in thread
From: wu000273 @ 2020-05-23  3:16 UTC (permalink / raw)
  To: bleung; +Cc: enric.balletbo, groeck, linux-kernel, kjlu, wu000273

From: Qiushi Wu <wu000273@umn.edu>

In function cros_ec_ishtp_probe(), "up_write" is already called
before function "cros_ec_dev_init". But "up_write" will be called
again after the calling of the function "cros_ec_dev_init" failed.
Thus add a call of the function “down_write” in this if branch
for the completion of the exception handling.

Fixes: 26a14267aff2 ("platform/chrome: Add ChromeOS EC ISHTP driver")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
---
 drivers/platform/chrome/cros_ec_ishtp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
index 93a71e93a2f1..41d60af618c9 100644
--- a/drivers/platform/chrome/cros_ec_ishtp.c
+++ b/drivers/platform/chrome/cros_ec_ishtp.c
@@ -660,8 +660,10 @@ static int cros_ec_ishtp_probe(struct ishtp_cl_device *cl_device)
 
 	/* Register croc_ec_dev mfd */
 	rv = cros_ec_dev_init(client_data);
-	if (rv)
+	if (rv) {
+		down_write(&init_lock);
 		goto end_cros_ec_dev_init_error;
+	}
 
 	return 0;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: fix a double-unlock issue
  2020-05-23  3:16 [PATCH] platform/chrome: fix a double-unlock issue wu000273
@ 2020-06-25  8:26 ` Enric Balletbo i Serra
  2020-06-26 16:01   ` Mat King
  2020-07-01  9:10 ` Enric Balletbo i Serra
  1 sibling, 1 reply; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-06-25  8:26 UTC (permalink / raw)
  To: wu000273, bleung
  Cc: groeck, linux-kernel, kjlu, Jett Rink, Mathew King, Enrico Granata

Hi Qiushi,

Thank you for your patch.

On 23/5/20 5:16, wu000273@umn.edu wrote:
> From: Qiushi Wu <wu000273@umn.edu>
> 
> In function cros_ec_ishtp_probe(), "up_write" is already called
> before function "cros_ec_dev_init". But "up_write" will be called
> again after the calling of the function "cros_ec_dev_init" failed.
> Thus add a call of the function “down_write” in this if branch
> for the completion of the exception handling.
> 
> Fixes: 26a14267aff2 ("platform/chrome: Add ChromeOS EC ISHTP driver")
> Signed-off-by: Qiushi Wu <wu000273@umn.edu>

The change looks good to me, but I'd like someone having the hardware giving a
Tested-by tag, so cc'ing some chromeos people. They must be also interested on
backport this patch.

> ---
>  drivers/platform/chrome/cros_ec_ishtp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
> index 93a71e93a2f1..41d60af618c9 100644
> --- a/drivers/platform/chrome/cros_ec_ishtp.c
> +++ b/drivers/platform/chrome/cros_ec_ishtp.c
> @@ -660,8 +660,10 @@ static int cros_ec_ishtp_probe(struct ishtp_cl_device *cl_device)
>  
>  	/* Register croc_ec_dev mfd */
>  	rv = cros_ec_dev_init(client_data);
> -	if (rv)
> +	if (rv) {
> +		down_write(&init_lock);
>  		goto end_cros_ec_dev_init_error;
> +	}
>  
>  	return 0;
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: fix a double-unlock issue
  2020-06-25  8:26 ` Enric Balletbo i Serra
@ 2020-06-26 16:01   ` Mat King
  0 siblings, 0 replies; 4+ messages in thread
From: Mat King @ 2020-06-26 16:01 UTC (permalink / raw)
  To: Enric Balletbo i Serra
  Cc: wu000273, Benson Leung, Guenter Roeck, Linux Kernel Mailing List,
	kjlu, Jett Rink, Mathew King, Enrico Granata

On Thu, Jun 25, 2020 at 2:26 AM Enric Balletbo i Serra
<enric.balletbo@collabora.com> wrote:
>
> Hi Qiushi,
>
> Thank you for your patch.
>
> On 23/5/20 5:16, wu000273@umn.edu wrote:
> > From: Qiushi Wu <wu000273@umn.edu>
> >
> > In function cros_ec_ishtp_probe(), "up_write" is already called
> > before function "cros_ec_dev_init". But "up_write" will be called
> > again after the calling of the function "cros_ec_dev_init" failed.
> > Thus add a call of the function “down_write” in this if branch
> > for the completion of the exception handling.
> >
> > Fixes: 26a14267aff2 ("platform/chrome: Add ChromeOS EC ISHTP driver")
> > Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Tested-by: Mathew King <mathewk@chromium.org>
Signed-off-by: Mathew King <mathewk@chromium.org>

>
> The change looks good to me, but I'd like someone having the hardware giving a
> Tested-by tag, so cc'ing some chromeos people. They must be also interested on
> backport this patch.

Tested on a device with ish based cros EC. Looks good to me.
>
> > ---
> >  drivers/platform/chrome/cros_ec_ishtp.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
> > index 93a71e93a2f1..41d60af618c9 100644
> > --- a/drivers/platform/chrome/cros_ec_ishtp.c
> > +++ b/drivers/platform/chrome/cros_ec_ishtp.c
> > @@ -660,8 +660,10 @@ static int cros_ec_ishtp_probe(struct ishtp_cl_device *cl_device)
> >
> >       /* Register croc_ec_dev mfd */
> >       rv = cros_ec_dev_init(client_data);
> > -     if (rv)
> > +     if (rv) {
> > +             down_write(&init_lock);
> >               goto end_cros_ec_dev_init_error;
> > +     }
> >
> >       return 0;
> >
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] platform/chrome: fix a double-unlock issue
  2020-05-23  3:16 [PATCH] platform/chrome: fix a double-unlock issue wu000273
  2020-06-25  8:26 ` Enric Balletbo i Serra
@ 2020-07-01  9:10 ` Enric Balletbo i Serra
  1 sibling, 0 replies; 4+ messages in thread
From: Enric Balletbo i Serra @ 2020-07-01  9:10 UTC (permalink / raw)
  To: wu000273, bleung; +Cc: groeck, linux-kernel, kjlu

Hi Qiushi,

Thank you for the patch.

On 23/5/20 5:16, wu000273@umn.edu wrote:
> From: Qiushi Wu <wu000273@umn.edu>
> 
> In function cros_ec_ishtp_probe(), "up_write" is already called
> before function "cros_ec_dev_init". But "up_write" will be called
> again after the calling of the function "cros_ec_dev_init" failed.
> Thus add a call of the function “down_write” in this if branch
> for the completion of the exception handling.
> 
> Fixes: 26a14267aff2 ("platform/chrome: Add ChromeOS EC ISHTP driver")
> Signed-off-by: Qiushi Wu <wu000273@umn.edu>

Applied for 5.9

> ---
>  drivers/platform/chrome/cros_ec_ishtp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_ishtp.c b/drivers/platform/chrome/cros_ec_ishtp.c
> index 93a71e93a2f1..41d60af618c9 100644
> --- a/drivers/platform/chrome/cros_ec_ishtp.c
> +++ b/drivers/platform/chrome/cros_ec_ishtp.c
> @@ -660,8 +660,10 @@ static int cros_ec_ishtp_probe(struct ishtp_cl_device *cl_device)
>  
>  	/* Register croc_ec_dev mfd */
>  	rv = cros_ec_dev_init(client_data);
> -	if (rv)
> +	if (rv) {
> +		down_write(&init_lock);
>  		goto end_cros_ec_dev_init_error;
> +	}
>  
>  	return 0;
>  
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-07-01  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-23  3:16 [PATCH] platform/chrome: fix a double-unlock issue wu000273
2020-06-25  8:26 ` Enric Balletbo i Serra
2020-06-26 16:01   ` Mat King
2020-07-01  9:10 ` Enric Balletbo i Serra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).