* [PATCH] Make a basic error check for failure in register_disk()
@ 2009-09-22 11:51 Zdenek Kabelac
0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2009-09-22 11:51 UTC (permalink / raw)
To: Linux Kernel Mailing List; +Cc: Tejun Heo
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@redhat.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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-22 11:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 11:51 [PATCH] Make a basic error check for failure in register_disk() Zdenek Kabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®