diff options
| author | Chao Yu <chao2.yu@samsung.com> | 2015-04-23 12:47:44 -0400 |
|---|---|---|
| committer | Jens Axboe <axboe@fb.com> | 2015-04-23 12:47:44 -0400 |
| commit | 8406a4d56ea94d1d91f62cab3bed15399bac73cb (patch) | |
| tree | ef5319354f305374ff5b67f2fbee019a1dc5c587 /block | |
| parent | 464d1387acb94dc43ba772b35242345e3d2ead1b (diff) | |
elevator: fix double release of elevator module
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>
Diffstat (limited to 'block')
| -rw-r--r-- | block/elevator.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/block/elevator.c b/block/elevator.c index 59794d0d38e3..8985038f398c 100644 --- a/block/elevator.c +++ b/block/elevator.c | |||
| @@ -157,7 +157,7 @@ struct elevator_queue *elevator_alloc(struct request_queue *q, | |||
| 157 | 157 | ||
| 158 | eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, q->node); | 158 | eq = kzalloc_node(sizeof(*eq), GFP_KERNEL, q->node); |
| 159 | if (unlikely(!eq)) | 159 | if (unlikely(!eq)) |
| 160 | goto err; | 160 | return NULL; |
| 161 | 161 | ||
| 162 | eq->type = e; | 162 | eq->type = e; |
| 163 | kobject_init(&eq->kobj, &elv_ktype); | 163 | kobject_init(&eq->kobj, &elv_ktype); |
| @@ -165,10 +165,6 @@ struct elevator_queue *elevator_alloc(struct request_queue *q, | |||
| 165 | hash_init(eq->hash); | 165 | hash_init(eq->hash); |
| 166 | 166 | ||
| 167 | return eq; | 167 | return eq; |
| 168 | err: | ||
| 169 | kfree(eq); | ||
| 170 | elevator_put(e); | ||
| 171 | return NULL; | ||
| 172 | } | 168 | } |
| 173 | EXPORT_SYMBOL(elevator_alloc); | 169 | EXPORT_SYMBOL(elevator_alloc); |
| 174 | 170 | ||
