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: <6f650168-02dc-91e5-c47a-e3ead380252f@users.sourceforge.net>
Date:   Sat, 1 Oct 2016 16:59:20 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-raid@...r.kernel.org, Guoqing Jiang <gqjiang@...e.com>,
        Shaohua Li <shli@...nel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 14/15] md-cluster: Less function calls in lockres_init() after
 error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 1 Oct 2016 16:01:05 +0200

The kfree() function was called in up to three cases
by the lockres_init() function during error handling even if
the passed data structure member (or variable) contained a null pointer.

Adjust jump targets according to the Linux coding style convention.

Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
 drivers/md/md-cluster.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 36bb962..0cade1a 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -201,12 +201,12 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
 	namelen = strlen(name);
 	res->name = kzalloc(namelen + 1, GFP_KERNEL);
 	if (!res->name)
-		goto out_err;
+		goto free_resource;
 	strlcpy(res->name, name, namelen + 1);
 	if (with_lvb) {
 		res->lksb.sb_lvbptr = kzalloc(LVB_SIZE, GFP_KERNEL);
 		if (!res->lksb.sb_lvbptr)
-			goto out_err;
+			goto free_name;
 		res->flags = DLM_LKF_VALBLK;
 	}
 
@@ -218,15 +218,17 @@ static struct dlm_lock_resource *lockres_init(struct mddev *mddev,
 	ret = dlm_lock_sync(res, DLM_LOCK_NL);
 	if (ret) {
 		pr_err("md-cluster: Unable to lock NL on new lock resource %s\n", name);
-		goto out_err;
+		goto free_lvb;
 	}
 	res->flags &= ~DLM_LKF_EXPEDITE;
 	res->flags |= DLM_LKF_CONVERT;
 
 	return res;
-out_err:
+free_lvb:
 	kfree(res->lksb.sb_lvbptr);
+free_name:
 	kfree(res->name);
+free_resource:
 	kfree(res);
 	return NULL;
 }
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ