diff options
author | Zachary Amsden <zach@vmware.com> | 2005-11-09 07:23:01 -0500 |
---|---|---|
committer | Jens Axboe <axboe@nelson.home.kernel.dk> | 2005-11-12 04:54:48 -0500 |
commit | b8ea2cb5120a92fe63053a2896be42abbb919a76 (patch) | |
tree | edbe103c6c5c2fe971ee270d8b0e3ae7dab8af83 /block | |
parent | cd52d1ee9a92587b242d946a2300a3245d3b885a (diff) |
[BLOCK] elevator init fixes
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/elevator.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/elevator.c b/block/elevator.c index d4a49a3df82..23cfbe528be 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
@@ -190,14 +190,14 @@ int elevator_init(request_queue_t *q, char *name) | |||
190 | 190 | ||
191 | eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL); | 191 | eq = kmalloc(sizeof(struct elevator_queue), GFP_KERNEL); |
192 | if (!eq) { | 192 | if (!eq) { |
193 | elevator_put(e->elevator_type); | 193 | elevator_put(e); |
194 | return -ENOMEM; | 194 | return -ENOMEM; |
195 | } | 195 | } |
196 | 196 | ||
197 | ret = elevator_attach(q, e, eq); | 197 | ret = elevator_attach(q, e, eq); |
198 | if (ret) { | 198 | if (ret) { |
199 | kfree(eq); | 199 | kfree(eq); |
200 | elevator_put(e->elevator_type); | 200 | elevator_put(e); |
201 | } | 201 | } |
202 | 202 | ||
203 | return ret; | 203 | return ret; |