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: <fbf4bcd3-1505-d959-eaa2-f6688a0aec2c@users.sourceforge.net>
Date:   Thu, 6 Oct 2016 11:46:15 +0200
From:   SF Markus Elfring <elfring@...rs.sourceforge.net>
To:     linux-raid@...r.kernel.org, Christoph Hellwig <hch@....de>,
        Guoqing Jiang <gqjiang@...e.com>, Jens Axboe <axboe@...com>,
        Mike Christie <mchristi@...hat.com>,
        Neil Brown <neilb@...e.com>, Shaohua Li <shli@...nel.org>,
        Tomasz Majchrzak <tomasz.majchrzak@...el.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        kernel-janitors@...r.kernel.org,
        Julia Lawall <julia.lawall@...6.fr>
Subject: [PATCH 46/54] md/raid10: Less function calls in setup_conf() after
 error detection

From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 5 Oct 2016 18:32:30 +0200

Resource release functions were called in up to three cases
by the setup_conf() function during error handling even if
the passed data structure members 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/raid10.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 7e512d4..9b8d11f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -3508,13 +3508,13 @@ static struct r10conf *setup_conf(struct mddev *mddev)
 				GFP_KERNEL);
 	if (!conf->mirrors) {
 		err = -ENOMEM;
-		goto out;
+		goto free_conf;
 	}
 
 	conf->tmppage = alloc_page(GFP_KERNEL);
 	if (!conf->tmppage) {
 		err = -ENOMEM;
-		goto out;
+		goto kfree_mirrors;
 	}
 
 	conf->geo = geo;
@@ -3523,7 +3523,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
 					   r10bio_pool_free, conf);
 	if (!conf->r10bio_pool) {
 		err = -ENOMEM;
-		goto out;
+		goto put_page;
 	}
 
 	calc_sectors(conf, mddev->dev_sectors);
@@ -3533,7 +3533,7 @@ static struct r10conf *setup_conf(struct mddev *mddev)
 	} else {
 		if (setup_geo(&conf->prev, mddev, geo_old) != conf->copies) {
 			err = -EINVAL;
-			goto out;
+			goto destroy_pool;
 		}
 		conf->reshape_progress = mddev->reshape_position;
 		if (conf->prev.far_offset)
@@ -3554,16 +3554,18 @@ static struct r10conf *setup_conf(struct mddev *mddev)
 	conf->thread = md_register_thread(raid10d, mddev, "raid10");
 	if (!conf->thread) {
 		err = -ENOMEM;
-		goto out;
+		goto destroy_pool;
 	}
 
 	conf->mddev = mddev;
 	return conf;
-
- out:
+destroy_pool:
 	mempool_destroy(conf->r10bio_pool);
+put_page:
 	safe_put_page(conf->tmppage);
+kfree_mirrors:
 	kfree(conf->mirrors);
+free_conf:
 	kfree(conf);
 	return ERR_PTR(err);
 }
-- 
2.10.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ