Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030966AbaLLRMX (ORCPT ); Fri, 12 Dec 2014 12:12:23 -0500 Received: from mail-qc0-f175.google.com ([209.85.216.175]:33547 "EHLO mail-qc0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030303AbaLLRMV (ORCPT ); Fri, 12 Dec 2014 12:12:21 -0500 Date: Fri, 12 Dec 2014 12:12:16 -0500 From: Tejun Heo To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Yasuaki Ishimatsu , "Gu, Zheng" , tangchen , Hiroyuki KAMEZAWA Subject: Re: [PATCH 1/5] workqueue: fix memory leak in wq_numa_init() Message-ID: <20141212171216.GA20020@htj.dyndns.org> References: <1418379595-6281-1-git-send-email-laijs@cn.fujitsu.com> <1418379595-6281-2-git-send-email-laijs@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1418379595-6281-2-git-send-email-laijs@cn.fujitsu.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 12, 2014 at 06:19:51PM +0800, Lai Jiangshan wrote: > wq_numa_init() will quit directly on some bonkers cases without freeing the > memory. Add the missing cleanup code. > > Cc: Tejun Heo > Cc: Yasuaki Ishimatsu > Cc: "Gu, Zheng" > Cc: tangchen > Cc: Hiroyuki KAMEZAWA > Signed-off-by: Lai Jiangshan > --- > kernel/workqueue.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 09b685d..a6fd2b8 100644 > --- a/kernel/workqueue.c > +++ b/kernel/workqueue.c > @@ -4811,6 +4811,9 @@ static void __init wq_numa_init(void) > if (WARN_ON(node == NUMA_NO_NODE)) { > pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu); > /* happens iff arch is bonkers, let's just proceed */ > + for_each_node(node) > + free_cpumask_var(tbl[node]); > + kfree(tbl); The comment right up there says that this happens if and only if the arch code is seriously broken and it's consciously skipping exception handling. That's a condition where we might as well trigger BUG_ON(). Just leave it alone. Thanks. -- tejun -- 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/