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>] [day] [month] [year] [list]
Date:	Tue, 22 Sep 2009 13:51:22 +0200
From:	Zdenek Kabelac <zdenek.kabelac@...il.com>
To:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Cc:	Tejun Heo <tj@...nel.org>
Subject: [PATCH] Make a basic error check for failure in register_disk()

Make a basic error check for failure in register_disk() to avoid kernel BUG
when sysfs entry could not be created (i.e. duplicate filename).
Fix is not perfect as register_disk() and add_disk() should probably return
error code in this case but avoids this BUG message:

kernel BUG at fs/sysfs/group.c:65!
 [<ffffffff812d6eac>] ? device_add+0x3c/0x5a0
 [<ffffffff811767c3>] sysfs_create_group+0x13/0x20
 [<ffffffff810c6c14>] blk_trace_init_sysfs+0x14/0x20
 [<ffffffff8121e3b0>] blk_register_queue+0x40/0x100
 [<ffffffff81223438>] add_disk+0xf8/0x170
 [<ffffffffa00bb3aa>] dm_create+0x37a/0x5b0 [dm_mod]
 ...

Problem has been noticed during check of some dm error code path.

Signed-off-by: Zdenek Kabelac <zkabelac@...hat.com>

---
 block/genhd.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/block/genhd.c b/block/genhd.c
index f4c64c2..317f961 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -544,6 +544,10 @@ void add_disk(struct gendisk *disk)
 	blk_register_region(disk_devt(disk), disk->minors, NULL,
 			    exact_match, exact_lock, disk);
 	register_disk(disk);
+	if (!disk_to_dev(disk)->kobj.parent) {
+		WARN_ON(1);
+		return;
+	}
 	blk_register_queue(disk);

 	bdi = &disk->queue->backing_dev_info;
--
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