mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Moyer <jmoyer@redhat.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] elevator: fix double release for elevator module
Date: Thu, 23 Apr 2015 10:59:21 -0400	[thread overview]
Message-ID: <x49mw1yx54m.fsf@segfault.boston.devel.redhat.com> (raw)
In-Reply-To: <005701d07da7$364d9950$a2e8cbf0$@samsung.com> (Chao Yu's message of "Thu, 23 Apr 2015 17:23:18 +0800")

Chao Yu <chao2.yu@samsung.com> writes:

> 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>
> ---
>  block/elevator.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/block/elevator.c b/block/elevator.c
> index d146a5e..8985038 100644
> --- a/block/elevator.c
> +++ b/block/elevator.c
> @@ -157,7 +157,7 @@ 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);
> @@ -165,9 +165,6 @@ struct elevator_queue *elevator_alloc(struct request_queue *q,
>  	hash_init(eq->hash);
>  
>  	return eq;
> -err:
> -	elevator_put(e);
> -	return NULL;
>  }
>  EXPORT_SYMBOL(elevator_alloc);

You could have posted the two patches together, as they are related.
Anyway, looks good to me.

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

  reply	other threads:[~2015-04-23 14:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  9:23 Chao Yu
2015-04-23 14:59 ` Jeff Moyer [this message]
2015-04-23 16:49   ` Jens Axboe
2015-04-24  1:28     ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x49mw1yx54m.fsf@segfault.boston.devel.redhat.com \
    --to=jmoyer@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=chao2.yu@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®