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: <20070630031538.GA4131@APFDCB5C>
Date:	Sat, 30 Jun 2007 12:15:38 +0900
From:	Akinobu Mita <akinobu.mita@...il.com>
To:	linux-kernel@...r.kernel.org, Jens Axboe <jens.axboe@...cle.com>
Cc:	Eberhard Moenkeberg <emoenke@...g.de>,
	Oliver Raupach <raupach@...s1.rz.fh-hannover.de>
Subject: [PATCH 3/4] void unregister_blkdev - ignore the return value

Some cdrom drivers stop destruct operations in module_exit() when
unregister_blkdev() failure happens.

But it can't help to stop unloading module. So it will not be good
error handling. Furthermore any other block drivers don't have such
handling and there is no special reason that only those cdrom drivers
have to do.

This patch removes the return value checks for unregister_blkdev().

This change will not hide the bugs. Because unregister_blkdev() prints
error message on failures by the previous patch.

Cc: Eberhard Moenkeberg <emoenke@...g.de>
Cc: Oliver Raupach <raupach@...s1.rz.fh-hannover.de>
Signed-off-by: Akinobu Mita <akinobu.mita@...il.com>

---
 drivers/cdrom/aztcd.c  |    5 +----
 drivers/cdrom/cdu31a.c |    6 +-----
 drivers/cdrom/cm206.c  |    5 +----
 drivers/cdrom/gscd.c   |    5 +----
 drivers/cdrom/optcd.c  |    5 +----
 drivers/cdrom/sbpcd.c  |    8 ++------
 6 files changed, 7 insertions(+), 27 deletions(-)

Index: 2.6-mm/drivers/cdrom/optcd.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/optcd.c
+++ 2.6-mm/drivers/cdrom/optcd.c
@@ -2089,10 +2089,7 @@ static void __exit optcd_exit(void)
 {
 	del_gendisk(optcd_disk);
 	put_disk(optcd_disk);
-	if (unregister_blkdev(MAJOR_NR, "optcd") == -EINVAL) {
-		printk(KERN_ERR "optcd: what's that: can't unregister\n");
-		return;
-	}
+	unregister_blkdev(MAJOR_NR, "optcd");
 	blk_cleanup_queue(opt_queue);
 	release_region(optcd_port, 4);
 	printk(KERN_INFO "optcd: module released.\n");
Index: 2.6-mm/drivers/cdrom/sbpcd.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/sbpcd.c
+++ 2.6-mm/drivers/cdrom/sbpcd.c
@@ -5885,12 +5885,8 @@ int __init sbpcd_init(void)
 static void sbpcd_exit(void)
 {
 	int j;
-	
-	if ((unregister_blkdev(MAJOR_NR, major_name) == -EINVAL))
-	{
-		msg(DBG_INF, "What's that: can't unregister %s.\n", major_name);
-		return;
-	}
+
+	unregister_blkdev(MAJOR_NR, major_name);
 	release_region(CDo_command,4);
 	blk_cleanup_queue(sbpcd_queue);
 	for (j=0;j<NR_SBPCD;j++)
Index: 2.6-mm/drivers/cdrom/cdu31a.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/cdu31a.c
+++ 2.6-mm/drivers/cdrom/cdu31a.c
@@ -3227,11 +3227,7 @@ static void __exit cdu31a_exit(void)
 				"cdrom driver\n");
 		return;
 	}
-	if ((unregister_blkdev(MAJOR_NR, "cdu31a") == -EINVAL)) {
-		printk(KERN_WARNING PFX "Can't unregister\n");
-		return;
-	}
-
+	unregister_blkdev(MAJOR_NR, "cdu31a");
 	blk_cleanup_queue(cdu31a_queue);
 
 	if (cdu31a_irq > 0)
Index: 2.6-mm/drivers/cdrom/gscd.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/gscd.c
+++ 2.6-mm/drivers/cdrom/gscd.c
@@ -882,10 +882,7 @@ static void __exit gscd_exit(void)
 
 	del_gendisk(gscd_disk);
 	put_disk(gscd_disk);
-	if ((unregister_blkdev(MAJOR_NR, "gscd") == -EINVAL)) {
-		printk("What's that: can't unregister GoldStar-module\n");
-		return;
-	}
+	unregister_blkdev(MAJOR_NR, "gscd");
 	blk_cleanup_queue(gscd_queue);
 	release_region(gscd_port, GSCD_IO_EXTENT);
 	printk(KERN_INFO "GoldStar-module released.\n");
Index: 2.6-mm/drivers/cdrom/aztcd.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/aztcd.c
+++ 2.6-mm/drivers/cdrom/aztcd.c
@@ -1941,10 +1941,7 @@ static void __exit aztcd_exit(void)
 {
 	del_gendisk(azt_disk);
 	put_disk(azt_disk);
-	if ((unregister_blkdev(MAJOR_NR, "aztcd") == -EINVAL)) {
-		printk("What's that: can't unregister aztcd\n");
-		return;
-	}
+	unregister_blkdev(MAJOR_NR, "aztcd");
 	blk_cleanup_queue(azt_queue);
 	if ((azt_port == 0x1f0) || (azt_port == 0x170)) {
 		SWITCH_IDE_MASTER;
Index: 2.6-mm/drivers/cdrom/cm206.c
===================================================================
--- 2.6-mm.orig/drivers/cdrom/cm206.c
+++ 2.6-mm/drivers/cdrom/cm206.c
@@ -1548,10 +1548,7 @@ static void __exit cm206_exit(void)
 		printk("Can't unregister cdrom cm206\n");
 		return;
 	}
-	if (unregister_blkdev(MAJOR_NR, "cm206")) {
-		printk("Can't unregister major cm206\n");
-		return;
-	}
+	unregister_blkdev(MAJOR_NR, "cm206");
 	blk_cleanup_queue(cm206_queue);
 	free_irq(cm206_irq, NULL);
 	kfree(cd);
-
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