Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966612AbbDWQtP (ORCPT ); Thu, 23 Apr 2015 12:49:15 -0400 Received: from mail-ig0-f173.google.com ([209.85.213.173]:38828 "EHLO mail-ig0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966478AbbDWQtN (ORCPT ); Thu, 23 Apr 2015 12:49:13 -0400 Message-ID: <55392287.30704@kernel.dk> Date: Thu, 23 Apr 2015 10:49:11 -0600 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jeff Moyer , Chao Yu CC: linux-kernel@vger.kernel.org Subject: Re: [PATCH] elevator: fix double release for elevator module References: <005701d07da7$364d9950$a2e8cbf0$@samsung.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1794 Lines: 59 On 04/23/2015 08:59 AM, Jeff Moyer wrote: > Chao Yu 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 >> --- >> 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 Agree, it should be one patch. I've combined them, and applied the fix for 4.1. Thanks. -- Jens Axboe -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/