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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <d547446ee3ebd127ba002bade1689c6605fccb6a.1444302968.git.sergei@s15v.net>
Date:	Thu,  8 Oct 2015 14:32:05 +0300
From:	Sergei Zviagintsev <sergei@...v.net>
To:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Daniel Mack <daniel@...que.org>,
	David Herrmann <dh.herrmann@...glemail.com>,
	Djalal Harouni <tixxdz@...ndz.org>
Cc:	linux-kernel@...r.kernel.org, Sergei Zviagintsev <sergei@...v.net>
Subject: [PATCH 36/44] kdbus: Improve kdbus_name_release()

Use goto to handle error paths in conventional way.

Signed-off-by: Sergei Zviagintsev <sergei@...v.net>
---
 ipc/kdbus/names.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/ipc/kdbus/names.c b/ipc/kdbus/names.c
index a1c3442f8e53..8e53681d1b7b 100644
--- a/ipc/kdbus/names.c
+++ b/ipc/kdbus/names.c
@@ -474,18 +474,23 @@ static int kdbus_name_release(struct kdbus_name_registry *reg,
 	int ret = 0;
 
 	down_write(&reg->rwlock);
+
 	name = kdbus_name_entry_find(reg, kdbus_strhash(name_str), name_str);
-	if (name) {
-		owner = kdbus_name_owner_find(name, conn);
-		if (owner)
-			kdbus_name_release_unlocked(owner);
-		else
-			ret = -EADDRINUSE;
-	} else {
+	if (!name) {
 		ret = -ESRCH;
+		goto exit;
 	}
-	up_write(&reg->rwlock);
 
+	owner = kdbus_name_owner_find(name, conn);
+	if (!owner) {
+		ret = -EADDRINUSE;
+		goto exit;
+	}
+
+	kdbus_name_release_unlocked(owner);
+
+exit:
+	up_write(&reg->rwlock);
 	kdbus_notify_flush(conn->ep->bus);
 	return ret;
 }
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ