lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240717211857.4510-3-yskelg@gmail.com>
Date: Thu, 18 Jul 2024 06:18:57 +0900
From: Yunseong Kim <yskelg@...il.com>
To: Heiko Carstens <hca@...ux.ibm.com>,
	Vasily Gorbik <gor@...ux.ibm.com>,
	Alexander Gordeev <agordeev@...ux.ibm.com>,
	Christian Borntraeger <borntraeger@...ux.ibm.com>,
	Sven Schnelle <svens@...ux.ibm.com>
Cc: Luis Chamberlain <mcgrof@...nel.org>,
	Joel Granados <j.granados@...sung.com>,
	MichelleJin <shjy180909@...il.com>,
	linux-s390@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] s390/debug: optimize acquiring spinlock on failure in debug_info_copy()

Optimize acquiring the spinlock once more and then exiting without any
additional actions, when handling of debug_info_alloc() failed.

Fixes: 942eaabd5d77 ("[PATCH] s390: debug feature changes")
Signed-off-by: Yunseong Kim <yskelg@...il.com>
---
 arch/s390/kernel/debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 85328a0ef3b6..c64f17cc1ebe 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -333,9 +333,9 @@ static debug_info_t *debug_info_copy(debug_info_t *in, int mode)
 	do {
 		rc = debug_info_alloc(in->name, in->pages_per_area,
 			in->nr_areas, in->buf_size, in->level, mode);
-		spin_lock_irqsave(&in->lock, flags);
 		if (!rc)
-			goto out;
+			return rc;
+		spin_lock_irqsave(&in->lock, flags);
 		/* has something changed in the meantime ? */
 		if ((rc->pages_per_area == in->pages_per_area) &&
 		    (rc->nr_areas == in->nr_areas)) {
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ