From: Zhang Rui <rui.zhang@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling
Date: Tue, 08 Aug 2017 08:38:24 +0000 [thread overview]
Message-ID: <1502181504.4296.17.camel@intel.com> (raw)
In-Reply-To: <dcc79547980dca6c42c16c60f76cf8b4cbd5a392.1500187753.git.christophe.jaillet@wanadoo.fr>
On Sun, 2017-07-16 at 08:59 +0200, Christophe JAILLET wrote:
> 'tz' is freed in some error handling paths but not in the main one.
> So free it also here to avoid a memory leak.
>
After device registered, tz is freed in thermal_release().
thanks,
rui
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/thermal/thermal_core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index 5a51c740e372..9743f3e65eb0 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1296,6 +1296,7 @@ thermal_zone_device_register(const char *type,
> int trips, int mask,
> unregister:
> ida_simple_remove(&thermal_tz_ida, tz->id);
> device_unregister(&tz->device);
> + kfree(tz);
> return ERR_PTR(result);
> }
> EXPORT_SYMBOL_GPL(thermal_zone_device_register);
WARNING: multiple messages have this Message-ID (diff)
From: Zhang Rui <rui.zhang@intel.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>, edubezval@gmail.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path
Date: Tue, 08 Aug 2017 16:38:24 +0800 [thread overview]
Message-ID: <1502181504.4296.17.camel@intel.com> (raw)
In-Reply-To: <dcc79547980dca6c42c16c60f76cf8b4cbd5a392.1500187753.git.christophe.jaillet@wanadoo.fr>
On Sun, 2017-07-16 at 08:59 +0200, Christophe JAILLET wrote:
> 'tz' is freed in some error handling paths but not in the main one.
> So free it also here to avoid a memory leak.
>
After device registered, tz is freed in thermal_release().
thanks,
rui
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> drivers/thermal/thermal_core.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thermal/thermal_core.c
> b/drivers/thermal/thermal_core.c
> index 5a51c740e372..9743f3e65eb0 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1296,6 +1296,7 @@ thermal_zone_device_register(const char *type,
> int trips, int mask,
> unregister:
> ida_simple_remove(&thermal_tz_ida, tz->id);
> device_unregister(&tz->device);
> + kfree(tz);
> return ERR_PTR(result);
> }
> EXPORT_SYMBOL_GPL(thermal_zone_device_register);
next prev parent reply other threads:[~2017-08-08 8:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-16 6:58 [PATCH 0/3] thermal: core: Fix some error handling code in 'thermal_zone_device_register()' Christophe JAILLET
2017-07-16 6:58 ` Christophe JAILLET
2017-07-16 6:59 ` [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path Christophe JAILLET
2017-07-16 6:59 ` Christophe JAILLET
2017-07-16 6:59 ` [PATCH 2/3] thermal: core: Reorder 'thermal_zone_device_register()' error handling code Christophe JAILLET
2017-07-16 6:59 ` Christophe JAILLET
2017-08-08 8:49 ` Zhang Rui
2017-08-08 8:49 ` Zhang Rui
2017-08-08 12:31 ` Christophe JAILLET
2017-08-08 12:31 ` Christophe JAILLET
2017-08-08 13:05 ` Zhang Rui
2017-08-08 13:05 ` Zhang Rui
2017-07-16 6:59 ` [PATCH 3/3] thermal: core: Avoid code duplication in 'thermal_zone_device_register()' Christophe JAILLET
2017-07-16 6:59 ` Christophe JAILLET
2017-08-08 8:38 ` Zhang Rui [this message]
2017-08-08 8:38 ` [PATCH 1/3] thermal: core: Fix a memory leak in 'thermal_zone_device_register()' error handling path Zhang Rui
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=1502181504.4296.17.camel@intel.com \
--to=rui.zhang@intel.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=edubezval@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.