[PATCH -next] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait()

Subsystems: char and misc drivers, ocxl (open coherent accelerator processor interface opencapi) driver, the rest

STALE2980d

4 messages, 4 authors, 2018-06-05 · open the first message on its own page

[PATCH -next] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait()

From: Wei Yongjun <hidden>
Date: 2018-06-05 09:10:07

Add the missing unlock before return from function
afu_ioctl_enable_p9_wait() in the error handling case.

Fixes: e948e06fc63a ("ocxl: Expose the thread_id needed for wait on POWER9")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/misc/ocxl/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 33ae46c..e6a6074 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -139,8 +139,10 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx,
 		// Locks both status & tidr
 		mutex_lock(&ctx->status_mutex);
 		if (!ctx->tidr) {
-			if (set_thread_tidr(current))
+			if (set_thread_tidr(current)) {
+				mutex_unlock(&ctx->status_mutex);
 				return -ENOENT;
+			}
 
 			ctx->tidr = current->thread.tidr;
 		}

RE: [PATCH -next] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait()

From: Alastair D'Silva <hidden>
Date: 2018-06-05 09:41:25

quoted hunk
-----Original Message-----
From: Wei Yongjun <redacted>
Sent: Tuesday, 5 June 2018 7:16 PM
To: Frederic Barrat <redacted>; Andrew Donnellan
[off-list ref]; Arnd Bergmann [off-list ref];
Greg Kroah-Hartman [off-list ref]; Alastair D'Silva
[off-list ref]
Cc: Wei Yongjun <redacted>; linuxppc-
dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; kernel-
janitors@vger.kernel.org
Subject: [PATCH -next] ocxl: Fix missing unlock on error in
afu_ioctl_enable_p9_wait()

Add the missing unlock before return from function
afu_ioctl_enable_p9_wait() in the error handling case.

Fixes: e948e06fc63a ("ocxl: Expose the thread_id needed for wait on
POWER9")
Signed-off-by: Wei Yongjun <redacted>
---
 drivers/misc/ocxl/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index
33ae46c..e6a6074 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -139,8 +139,10 @@ static long afu_ioctl_enable_p9_wait(struct
ocxl_context *ctx,
 		// Locks both status & tidr
 		mutex_lock(&ctx->status_mutex);
 		if (!ctx->tidr) {
-			if (set_thread_tidr(current))
+			if (set_thread_tidr(current)) {
+				mutex_unlock(&ctx->status_mutex);
 				return -ENOENT;
+			}

 			ctx->tidr = current->thread.tidr;
 		}

Thanks for picking that up!

Reviewed-by: Alastair D'Silva <redacted>

-- 
Alastair D'Silva           mob: 0423 762 819
skype: alastair_dsilva     msn: alastair@d-silva.org
blog: http://alastair.d-silva.org    Twitter: @EvilDeece

Re: [PATCH -next] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait()

From: Frederic Barrat <hidden>
Date: 2018-06-05 12:57:11


Le 05/06/2018 à 11:16, Wei Yongjun a écrit :
quoted hunk
Add the missing unlock before return from function
afu_ioctl_enable_p9_wait() in the error handling case.

Fixes: e948e06fc63a ("ocxl: Expose the thread_id needed for wait on POWER9")
Signed-off-by: Wei Yongjun <redacted>
---
  drivers/misc/ocxl/file.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c
index 33ae46c..e6a6074 100644
--- a/drivers/misc/ocxl/file.c
+++ b/drivers/misc/ocxl/file.c
@@ -139,8 +139,10 @@ static long afu_ioctl_enable_p9_wait(struct ocxl_context *ctx,
  		// Locks both status & tidr
  		mutex_lock(&ctx->status_mutex);
  		if (!ctx->tidr) {
-			if (set_thread_tidr(current))
+			if (set_thread_tidr(current)) {
+				mutex_unlock(&ctx->status_mutex);
  				return -ENOENT;
+			}
O_o   Thanks for fixing it

Acked-by: Frederic Barrat <redacted>

  			ctx->tidr = current->thread.tidr;
  		}

Re: [-next] ocxl: Fix missing unlock on error in afu_ioctl_enable_p9_wait()

From: Michael Ellerman <hidden>
Date: 2018-06-05 15:19:53

On Tue, 2018-06-05 at 09:16:21 UTC, Wei Yongjun wrote:
Add the missing unlock before return from function
afu_ioctl_enable_p9_wait() in the error handling case.

Fixes: e948e06fc63a ("ocxl: Expose the thread_id needed for wait on POWER9")
Signed-off-by: Wei Yongjun <redacted>
Reviewed-by: Alastair D'Silva <redacted>
Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/2e5c93d6bb2f7bc17eb82748943a1b

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help