public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* [PATCH] cxl: Unlock on error in probe
@ 2017-05-05  5:34 Dan Carpenter
  2017-05-05 15:29 ` Frederic Barrat
  2017-06-08  4:07 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-05-05  5:34 UTC (permalink / raw)
  To: Ian Munsie, Christophe Lombard
  Cc: Frederic Barrat, linuxppc-dev, kernel-janitors

We should unlock if get_cxl_adapter() fails.

Fixes: 594ff7d067ca ("cxl: Support to flash a new image on the adapter from a guest")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle•com>

diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c
index 7c61c70ba3f6..37475abea3e6 100644
--- a/drivers/misc/cxl/flash.c
+++ b/drivers/misc/cxl/flash.c
@@ -401,8 +401,10 @@ static int device_open(struct inode *inode, struct file *file)
 	if (down_interruptible(&sem) != 0)
 		return -EPERM;
 
-	if (!(adapter = get_cxl_adapter(adapter_num)))
-		return -ENODEV;
+	if (!(adapter = get_cxl_adapter(adapter_num))) {
+		rc = -ENODEV;
+		goto err_unlock;
+	}
 
 	file->private_data = adapter;
 	continue_token = 0;
@@ -446,6 +448,8 @@ static int device_open(struct inode *inode, struct file *file)
 		free_page((unsigned long) le);
 err:
 	put_device(&adapter->dev);
+err_unlock:
+	up(&sem);
 
 	return rc;
 }

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

* Re: [PATCH] cxl: Unlock on error in probe
  2017-05-05  5:34 [PATCH] cxl: Unlock on error in probe Dan Carpenter
@ 2017-05-05 15:29 ` Frederic Barrat
  2017-06-08  4:07 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Frederic Barrat @ 2017-05-05 15:29 UTC (permalink / raw)
  To: Dan Carpenter, Ian Munsie, Christophe Lombard
  Cc: linuxppc-dev, kernel-janitors



Le 05/05/2017 à 07:34, Dan Carpenter a écrit :
> We should unlock if get_cxl_adapter() fails.
>
> Fixes: 594ff7d067ca ("cxl: Support to flash a new image on the adapter from a guest")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle•com>
>

Acked-by: Frederic Barrat <fbarrat@linux•vnet.ibm.com>

Thanks!

   Fred



> diff --git a/drivers/misc/cxl/flash.c b/drivers/misc/cxl/flash.c
> index 7c61c70ba3f6..37475abea3e6 100644
> --- a/drivers/misc/cxl/flash.c
> +++ b/drivers/misc/cxl/flash.c
> @@ -401,8 +401,10 @@ static int device_open(struct inode *inode, struct file *file)
>  	if (down_interruptible(&sem) != 0)
>  		return -EPERM;
>
> -	if (!(adapter = get_cxl_adapter(adapter_num)))
> -		return -ENODEV;
> +	if (!(adapter = get_cxl_adapter(adapter_num))) {
> +		rc = -ENODEV;
> +		goto err_unlock;
> +	}
>
>  	file->private_data = adapter;
>  	continue_token = 0;
> @@ -446,6 +448,8 @@ static int device_open(struct inode *inode, struct file *file)
>  		free_page((unsigned long) le);
>  err:
>  	put_device(&adapter->dev);
> +err_unlock:
> +	up(&sem);
>
>  	return rc;
>  }
>

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

* Re: cxl: Unlock on error in probe
  2017-05-05  5:34 [PATCH] cxl: Unlock on error in probe Dan Carpenter
  2017-05-05 15:29 ` Frederic Barrat
@ 2017-06-08  4:07 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2017-06-08  4:07 UTC (permalink / raw)
  To: Dan Carpenter, Ian Munsie, Christophe Lombard
  Cc: kernel-janitors, linuxppc-dev, Frederic Barrat

On Fri, 2017-05-05 at 05:34:58 UTC, Dan Carpenter wrote:
> We should unlock if get_cxl_adapter() fails.
> 
> Fixes: 594ff7d067ca ("cxl: Support to flash a new image on the adapter from a guest")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle•com>
> Acked-by: Frederic Barrat <fbarrat@linux•vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/58d876fa7181f2f393190c1d32c056

cheers

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

end of thread, other threads:[~2017-06-08  4:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05  5:34 [PATCH] cxl: Unlock on error in probe Dan Carpenter
2017-05-05 15:29 ` Frederic Barrat
2017-06-08  4:07 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox