[BUG] disk_free_ptbl_rcu_cb() crash

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Saturday, October 23, 2010 - 2:10 pm

Current Linus tree makes my machine crash in disk_free_ptbl_rcu_cb(),
while booting...

commit 7681bfeeccff5ef seems the problem ?

Following patch solves the NULL dereference, but this is only to show
you where the problem is, not a real fix, of course.

Thanks

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

diff --git a/block/genhd.c b/block/genhd.c
index a8adf96..b63d401 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -930,14 +930,16 @@ static void disk_free_ptbl_rcu_cb(struct rcu_head *head)
 	struct disk_part_tbl *ptbl =
 		container_of(head, struct disk_part_tbl, rcu_head);
 	struct gendisk *disk = ptbl->disk;
-	struct request_queue *q = disk->queue;
+	struct request_queue *q = disk ? disk->queue : NULL;
 	unsigned long flags;
 
 	kfree(ptbl);
 
-	spin_lock_irqsave(q->queue_lock, flags);
-	elv_quiesce_end(q);
-	spin_unlock_irqrestore(q->queue_lock, flags);
+	if (q) {
+		spin_lock_irqsave(q->queue_lock, flags);
+		elv_quiesce_end(q);
+		spin_unlock_irqrestore(q->queue_lock, flags);
+	}
 }
 
 /**


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[BUG] disk_free_ptbl_rcu_cb() crash, Eric Dumazet, (Sat Oct 23, 2:10 pm)
Re: [BUG] disk_free_ptbl_rcu_cb() crash, Jens Axboe, (Sat Oct 23, 11:04 pm)
Re: [BUG] disk_free_ptbl_rcu_cb() crash, Eric Dumazet, (Sat Oct 23, 11:44 pm)
Re: [BUG] disk_free_ptbl_rcu_cb() crash, Jens Axboe, (Sat Oct 23, 11:45 pm)
Re: [BUG] disk_free_ptbl_rcu_cb() crash, Vivek Goyal, (Sat Oct 23, 11:52 pm)
Re: [BUG] disk_free_ptbl_rcu_cb() crash, Jens Axboe, (Sun Oct 24, 12:00 am)