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]
Date:   Mon, 12 Sep 2016 20:43:46 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     ceph-devel@...r.kernel.org, Alex Elder <elder@...nel.org>,
        Ilya Dryomov <idryomov@...il.com>, Sage Weil <sage@...hat.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 02/47] block-rbd: Less function calls in
 rbd_header_from_disk() after error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sun, 11 Sep 2016 13:18:57 +0200

The functions "ceph_put_snap_context" and "kfree" were called in a few
cases by the function "rbd_header_from_disk" during error handling
even if the passed variables contained a null pointer.

Adjust jump targets according to the Linux coding style convention.

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

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index e406c27..f4212e1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1001,7 +1001,7 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev,
 	snap_count = le32_to_cpu(ondisk->snap_count);
 	snapc = ceph_create_snap_context(snap_count, GFP_KERNEL);
 	if (!snapc)
-		goto out_err;
+		goto free_prefix;
 	snapc->seq = le64_to_cpu(ondisk->snap_seq);
 	if (snap_count) {
 		struct rbd_image_snap_ondisk *snaps;
@@ -1013,14 +1013,14 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev,
 			goto out_2big;
 		snap_names = kmalloc(snap_names_len, GFP_KERNEL);
 		if (!snap_names)
-			goto out_err;
+			goto put_snap_context;
 
 		/* ...as well as the array of their sizes. */
 		snap_sizes = kmalloc_array(snap_count,
 					   sizeof(*header->snap_sizes),
 					   GFP_KERNEL);
 		if (!snap_sizes)
-			goto out_err;
+			goto free_names;
 
 		/*
 		 * Copy the names, and fill in each snapshot's id
@@ -1066,10 +1066,12 @@ static int rbd_header_from_disk(struct rbd_device *rbd_dev,
 	return 0;
 out_2big:
 	ret = -EIO;
-out_err:
 	kfree(snap_sizes);
+ free_names:
 	kfree(snap_names);
+ put_snap_context:
 	ceph_put_snap_context(snapc);
+ free_prefix:
 	kfree(object_prefix);
 
 	return ret;
-- 
2.10.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ