Skip to content

Commit

Permalink
elevator: fix double release of elevator module
Browse files Browse the repository at this point in the history
Our issue is descripted in below call path:
->elevator_init
 ->elevator_init_fn
  ->{cfq,deadline,noop}_init_queue
   ->elevator_alloc
    ->kzalloc_node
   fail to call kzalloc_node and then put module in elevator_alloc;
fail to call elevator_init_fn and then put module again in elevator_init.

Remove elevator_put invoking in error path of elevator_alloc to avoid
double release issue.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
chaseyu authored and axboe committed Apr 23, 2015
1 parent 464d138 commit 8406a4d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions block/elevator.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,18 +157,14 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,

eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, q->node);
if (unlikely(!eq))
goto err;
return NULL;

eq->type = e;
kobject_init(&eq->kobj, &elv_ktype);
mutex_init(&eq->sysfs_lock);
hash_init(eq->hash);

return eq;
err:
kfree(eq);
elevator_put(e);
return NULL;
}
EXPORT_SYMBOL(elevator_alloc);

Expand Down

0 comments on commit 8406a4d

Please sign in to comment.