Skip to content

Commit

Permalink
[BLOCK] elevator init fixes
Browse files Browse the repository at this point in the history
I got a panic in the elevator code, backtrace :

Unable to handle kernel NULL pointer dereference at virtual address 00000060
..
EIP is at elevator_put+0x0/0x30 (null elevator_type passed)
..
elevator_init+0x38
blk_init_queu_node+0xc9
floppy_init+0xdb
do_initcalls+0x23
init+0x10a
init+0x0

Clearly if the kmalloc here fails, e->elevator_type is not yet set; this
appears to be the correct fix, but I think I probably hit the second case
due to a race condition.  Someone more familiar with the elevator code
should look at this more closely until I can determine if I can reproduce.

Signed-off-by: Zachary Amsden <zach@vmware.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jens Axboe <axboe@suse.de>
  • Loading branch information
Zachary Amsden authored and Jens Axboe committed Nov 12, 2005
1 parent cd52d1e commit b8ea2cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ int elevator_init(request_queue_t *q, char *name)

eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL);
if (!eq) {
elevator_put(e->elevator_type);
elevator_put(e);
return -ENOMEM;
}

ret = elevator_attach(q, e, eq);
if (ret) {
kfree(eq);
elevator_put(e->elevator_type);
elevator_put(e);
}

return ret;
Expand Down

0 comments on commit b8ea2cb

Please sign in to comment.