Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbbDXB3o (ORCPT ); Thu, 23 Apr 2015 21:29:44 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:15216 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751654AbbDXB3l (ORCPT ); Thu, 23 Apr 2015 21:29:41 -0400 X-AuditID: cbfee61b-f79536d000000f1f-7b-55399c82e7e3 From: Chao Yu To: "'Jens Axboe'" , "'Jeff Moyer'" Cc: linux-kernel@vger.kernel.org References: <005701d07da7$364d9950$a2e8cbf0$@samsung.com> <55392287.30704@kernel.dk> In-reply-to: <55392287.30704@kernel.dk> Subject: RE: [PATCH] elevator: fix double release for elevator module Date: Fri, 24 Apr 2015 09:28:58 +0800 Message-id: <00c301d07e2e$217ab670$64702350$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQGhOBY4whqgKmiFFboMYFu4fa0HEQH84hnmAeiLqYqdmr8AQA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsVy+t9jAd3mOZahBgu+MVmsvtvPZnH211UW i8u75rA5MHtcPlvq8X7fVTaPz5vkApijuGxSUnMyy1KL9O0SuDIufZ3KXvCZv6Ln5BumBsbd PF2MnBwSAiYSjfv/skPYYhIX7q1n62Lk4hASWMQose9xPxtIQkjgFaPE9K/MIDabgIrE8o7/ TCC2iICLROOak6wgNrOAgsSve5tYIZo7GSX6tuwBauDg4BRQl/ixwRSkRljAVeLflE1gy1gE VCUWT1gINpNXwFLiTNMFVghbUOLH5HssEDO1JNbvPM4EYctLbF7zlhniUAWJHWdfM0Lc4CTx 5/N2RogacYmNR26xTGAUmoVk1Cwko2YhGTULScsCRpZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ +bmbGMHh/kx6B+OqBotDjAIcjEo8vB+KLEKFWBPLiitzDzFKcDArifAaTbYMFeJNSaysSi3K jy8qzUktPsQozcGiJM47R1cuVEggPbEkNTs1tSC1CCbLxMEp1cCoXuK1U+DETPYZL2tOHJ0l 2NxcXXn9sUW6k2bUujeXjq9xFq0/7PqsRYLD5+t8lh3lDD4n7fs43zTqCv8r6vZo2Xjzb/if 6dXPAg3Pan6fWHdRa8oU50sGwkEPck8lXdp1UWp5608bk8/HLMoXMBw4ce+iAa9KZOT8izGz JqxkyOXU5v2lUCSkxFKckWioxVxUnAgAn+86g3MCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2213 Lines: 72 Hi Jens and Jeff, Thanks for your review and help! :) Regards, > -----Original Message----- > From: Jens Axboe [mailto:axboe@kernel.dk] > Sent: Friday, April 24, 2015 12:49 AM > To: Jeff Moyer; Chao Yu > Cc: linux-kernel@vger.kernel.org > Subject: Re: [PATCH] elevator: fix double release for elevator module > > 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/