Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] s390/diag324: Preserve -EBUSY return code
@ 2026-08-11 14:23 Sumanth Korikkar
  2026-08-11 14:57 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Sumanth Korikkar @ 2026-08-11 14:23 UTC (permalink / raw)
  To: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Ilya Leoshkevich, Christian Borntraeger
  Cc: sumanthk

When diag324 reports -EBUSY, the error code is
overwritten by the result of copy_to_user() and put_user(). As a result,
the ioctl may incorrectly return success instead of -EBUSY.

Preserve the original diag324 return code and only return -EFAULT when
copying data to userspace fails.

Fixes: 90e6f191e1ee ("s390/diag324: Retrieve power readings via diag 0x324")
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
---
 arch/s390/kernel/diag/diag324.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/s390/kernel/diag/diag324.c b/arch/s390/kernel/diag/diag324.c
index fe325c2a2d0d..3eec0cc8fb9e 100644
--- a/arch/s390/kernel/diag/diag324.c
+++ b/arch/s390/kernel/diag/diag324.c
@@ -182,8 +182,7 @@ long diag324_pibbuf(unsigned long arg)
 		goto out;
 	rc = copy_to_user((void __user *)address, data->pib, data->pib->len);
 	rc |= put_user(data->sequence, &udata->sequence);
-	if (rc)
-		rc = -EFAULT;
+	rc = rc ? -EFAULT : data->rc;
 out:
 	mutex_unlock(&pibmutex);
 	return rc;
-- 
2.54.0


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

* Re: [PATCH] s390/diag324: Preserve -EBUSY return code
  2026-08-11 14:23 [PATCH] s390/diag324: Preserve -EBUSY return code Sumanth Korikkar
@ 2026-08-11 14:57 ` Heiko Carstens
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2026-08-11 14:57 UTC (permalink / raw)
  To: Sumanth Korikkar
  Cc: linux-s390, Vasily Gorbik, Alexander Gordeev, Ilya Leoshkevich,
	Christian Borntraeger

On Tue, Aug 11, 2026 at 04:23:06PM +0200, Sumanth Korikkar wrote:
> When diag324 reports -EBUSY, the error code is
> overwritten by the result of copy_to_user() and put_user(). As a result,
> the ioctl may incorrectly return success instead of -EBUSY.
> 
> Preserve the original diag324 return code and only return -EFAULT when
> copying data to userspace fails.
> 
> Fixes: 90e6f191e1ee ("s390/diag324: Retrieve power readings via diag 0x324")
> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
> ---
>  arch/s390/kernel/diag/diag324.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>

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

end of thread, other threads:[~2026-08-11 14:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-11 14:23 [PATCH] s390/diag324: Preserve -EBUSY return code Sumanth Korikkar
2026-08-11 14:57 ` Heiko Carstens

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