public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ti: fix possible memory leak in _ti_omap4_clkctrl_setup()
@ 2023-10-31 10:30 Hangyu Hua
  2023-10-31 10:42 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Hangyu Hua @ 2023-10-31 10:30 UTC (permalink / raw)
  To: kristo, mturquette, sboyd, tony, andriy.shevchenko,
	claudiu.beznea, robh, dario.binacchi
  Cc: linux-omap, linux-clk, linux-kernel, Hangyu Hua

kstrndup() and kstrdup_and_replace() in clkctrl_get_name() can perform
dynamic memory allocation. So clkctrl_name needs to be freed when
provider->clkdm_name is NULL.

Fixes: bd46cd0b802d ("clk: ti: clkctrl: check return value of kasprintf()")
Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
---

	 v2 and v3: fix commit info.

 drivers/clk/ti/clkctrl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clk/ti/clkctrl.c b/drivers/clk/ti/clkctrl.c
index 607e34d8e289..cb4aa8a45bb2 100644
--- a/drivers/clk/ti/clkctrl.c
+++ b/drivers/clk/ti/clkctrl.c
@@ -591,6 +591,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
 		provider->clkdm_name = kasprintf(GFP_KERNEL,
 						 "%s_clkdm", clkctrl_name);
 		if (!provider->clkdm_name) {
+			kfree(clkctrl_name);
 			kfree(provider);
 			return;
 		}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] ti: fix possible memory leak in _ti_omap4_clkctrl_setup()
  2023-10-31 10:30 [PATCH v3] ti: fix possible memory leak in _ti_omap4_clkctrl_setup() Hangyu Hua
@ 2023-10-31 10:42 ` Andy Shevchenko
  2023-11-01  2:30   ` Hangyu Hua
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2023-10-31 10:42 UTC (permalink / raw)
  To: Hangyu Hua
  Cc: kristo, mturquette, sboyd, tony, claudiu.beznea, robh,
	dario.binacchi, linux-omap, linux-clk, linux-kernel

On Tue, Oct 31, 2023 at 06:30:10PM +0800, Hangyu Hua wrote:
> kstrndup() and kstrdup_and_replace() in clkctrl_get_name() can perform
> dynamic memory allocation. So clkctrl_name needs to be freed when
> provider->clkdm_name is NULL.

> Fixes: bd46cd0b802d ("clk: ti: clkctrl: check return value of kasprintf()")
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
> 
> 	 v2 and v3: fix commit info.

I believe I gave you my Rb tag. It's your responsibility to care it on if you
send a new version. Otherwise, please tell what makes you think that tag should
not be here?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] ti: fix possible memory leak in _ti_omap4_clkctrl_setup()
  2023-10-31 10:42 ` Andy Shevchenko
@ 2023-11-01  2:30   ` Hangyu Hua
  0 siblings, 0 replies; 3+ messages in thread
From: Hangyu Hua @ 2023-11-01  2:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kristo, mturquette, sboyd, tony, claudiu.beznea, robh,
	dario.binacchi, linux-omap, linux-clk, linux-kernel

On 31/10/2023 18:42, Andy Shevchenko wrote:
> On Tue, Oct 31, 2023 at 06:30:10PM +0800, Hangyu Hua wrote:
>> kstrndup() and kstrdup_and_replace() in clkctrl_get_name() can perform
>> dynamic memory allocation. So clkctrl_name needs to be freed when
>> provider->clkdm_name is NULL.
> 
>> Fixes: bd46cd0b802d ("clk: ti: clkctrl: check return value of kasprintf()")
>> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
>> ---
>>
>> 	 v2 and v3: fix commit info.
> 
> I believe I gave you my Rb tag. It's your responsibility to care it on if you
> send a new version. Otherwise, please tell what makes you think that tag should
> not be here?

Do you mean "Reviewed-by"? I checked the previous emails and 
"lore.kernel.org" and didn’t find this tag in any related emails. I am 
not sure what happened. Can you please resend it?

Thanks,
Hangyu
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-01  2:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 10:30 [PATCH v3] ti: fix possible memory leak in _ti_omap4_clkctrl_setup() Hangyu Hua
2023-10-31 10:42 ` Andy Shevchenko
2023-11-01  2:30   ` Hangyu Hua

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox