Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933465AbbDWJXz (ORCPT ); Thu, 23 Apr 2015 05:23:55 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:36388 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964829AbbDWJXx (ORCPT ); Thu, 23 Apr 2015 05:23:53 -0400 X-AuditID: cbfee61a-f79516d000006302-24-5538ba279207 From: Chao Yu To: axboe@kernel.dk Cc: linux-kernel@vger.kernel.org Subject: [PATCH] elevator: fix double release for elevator module Date: Thu, 23 Apr 2015 17:23:18 +0800 Message-id: <005701d07da7$364d9950$a2e8cbf0$@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: AdB9pqgSxsRT1womRemCntzl8hFs7A== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLLMWRmVeSWpSXmKPExsVy+t9jQV31XRahBudb5CxW3+1ns7i8aw6b A5PH5bOlHp83yQUwRXHZpKTmZJalFunbJXBlTLiXVfCdo2L9gSXsDYyL2bsYOTkkBEwk1i09 BWWLSVy4t56ti5GLQ0hgOqPElz9bWSGcV4wSf6fOB6tiE1CRWN7xnwnEFhEQltjf0coCYjML KEj8urcJqIGDQ1jAUWL9UmOQMIuAqsTnLTvBynkFLCU+NLeyQ9iCEj8m34Nq1ZJYv/M4E4Qt L7F5zVtmiIMUJHacfc0IsUpPYtKiw1A14hIbj9ximcAoMAvJqFlIRs1CMmoWkpYFjCyrGEVT C5ILipPScw31ihNzi0vz0vWS83M3MYID9ZnUDsaVDRaHGAU4GJV4eD8UWYQKsSaWFVfmHmKU 4GBWEuEVmgoU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzjtHVy5USCA9sSQ1OzW1ILUIJsvEwSnV wOitGedy2uew+23Z/63qHqxZb64EPc70nWvubM1ikLhwe2o9b/o2L5M2M/6YxrikOtFUsdbX O26EdrBwnsm3zVFbcfQg+/KPjxTlmOqc+Jc8XmjRpbjOT9omf+X9dR9nXZyadvOY8ofKUr+q 67f+P0iR22nwMt/Af6ekXNCRtTElYQp6s4pnKbEUZyQaajEXFScCAEb+Bu1QAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1344 Lines: 49 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); -- 2.3.3 -- 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/