From: Hannes Reinecke <[email protected]>

When a device is probed asynchronously del_gendisk() might be called
before the async probing was run, causing del_gendisk() to crash
due to uninitialized sysfs objects.

Signed-off-by: Hannes Reinecke <[email protected]>
---
 block/genhd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/genhd.c b/block/genhd.c
index c2223f1..cc40d95 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -697,6 +697,9 @@ void del_gendisk(struct gendisk *disk)
        struct disk_part_iter piter;
        struct hd_struct *part;
 
+       if (!(disk->flags & GENHD_FL_UP))
+               return;
+
        blk_integrity_del(disk);
        disk_del_events(disk);
 
-- 
1.8.5.6

Reply via email to