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: <1380547556-17719-3-git-send-email-b.zolnierkie@samsung.com>
Date:	Mon, 30 Sep 2013 15:25:43 +0200
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	axboe@...nel.dk
Cc:	abhansali@...c-inc.com, jmoyer@...hat.com,
	kyungmin.park@...sung.com, linux-kernel@...r.kernel.org,
	b.zolnierkie@...sung.com
Subject: [PATCH 02/14] skd: fix error paths in skd_init()

Cc: Akhil Bhansali <abhansali@...c-inc.com>
Cc: Jeff Moyer <jmoyer@...hat.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@...sung.com>
---
 drivers/block/skd_main.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index a98d1bc..a4eb480 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -5699,7 +5699,7 @@ static void skd_log_skreq(struct skd_device *skdev,
 
 static int __init skd_init(void)
 {
-	int rc = 0;
+	int rc = -ENOMEM;
 
 	pr_info(PFX " v%s-b%s loaded\n", DRV_VERSION, DRV_BUILD_ID);
 
@@ -5720,7 +5720,7 @@ static int __init skd_init(void)
 
 	if (!skd_flush_slab) {
 		pr_err("failed to allocated flush slab.\n");
-		return -ENOMEM;
+		goto err_kmem_cache_create;
 	}
 
 	if (skd_max_queue_depth < 1
@@ -5766,12 +5766,24 @@ static int __init skd_init(void)
 	/* Obtain major device number. */
 	rc = register_blkdev(0, DRV_NAME);
 	if (rc < 0)
-		return rc;
+		goto err_register_blkdev;
 
 	skd_major = rc;
 
-	return pci_register_driver(&skd_driver);
+	rc = pci_register_driver(&skd_driver);
+	if (rc < 0)
+		goto err_pci_register_driver;
+
+	return rc;
 
+err_pci_register_driver:
+	unregister_blkdev(skd_major, DRV_NAME);
+
+err_register_blkdev:
+	kmem_cache_destroy(skd_flush_slab);
+
+err_kmem_cache_create:
+	return rc;
 }
 
 static void __exit skd_exit(void)
-- 
1.8.2.3

--
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