From: Wang YanQing <udknight@gmail.com>
To: Chen Gang <gang.chen@asianux.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
lig.fnst@cn.fujitsu.com, chuansheng.liu@intel.com,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] kernel/smp.c: free related resources when failure occurs in hotplug_cfd()
Date: Tue, 9 Jul 2013 08:46:17 +0800 [thread overview]
Message-ID: <20130709004617.GA3129@udknight> (raw)
In-Reply-To: <51DB5C99.50405@asianux.com>
On Tue, Jul 09, 2013 at 08:43:05AM +0800, Chen Gang wrote:
> When failure occurs in hotplug_cfd(), need release related resources,
> or will cause memory leak.
>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
> kernel/smp.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/smp.c b/kernel/smp.c
> index 02a885d..2a3a017 100644
> --- a/kernel/smp.c
> +++ b/kernel/smp.c
> @@ -49,10 +49,13 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
> cpu_to_node(cpu)))
> return notifier_from_errno(-ENOMEM);
> if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL,
> - cpu_to_node(cpu)))
> + cpu_to_node(cpu))) {
> + free_cpumask_var(cfd->cpumask);
> return notifier_from_errno(-ENOMEM);
> + }
> cfd->csd = alloc_percpu(struct call_single_data);
> if (!cfd->csd) {
> + free_cpumask_var(cfd->cpumask_ipi);
> free_cpumask_var(cfd->cpumask);
> return notifier_from_errno(-ENOMEM);
> }
> --
> 1.7.7.6
Acked-by: Wang YanQing <udknight@gmail.com>
next prev parent reply other threads:[~2013-07-09 0:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-08 8:50 [PATCH] kernel/smp.c: free related resources when failure occurs in hotplug_cfd() Chen Gang
2013-07-08 14:26 ` Paul Gortmaker
2013-07-09 0:25 ` Chen Gang F T
2013-07-09 0:28 ` Wang YanQing
2013-07-09 0:32 ` Chen Gang
2013-07-09 0:43 ` [PATCH v2] " Chen Gang
2013-07-09 0:46 ` Wang YanQing [this message]
2013-07-09 0:46 ` Chen Gang
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=20130709004617.GA3129@udknight \
--to=udknight@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chuansheng.liu@intel.com \
--cc=gang.chen@asianux.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
/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