* [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
@ 2015-09-30 10:48 Geliang Tang
2015-09-30 14:06 ` Tom Lendacky
2015-10-05 10:06 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Geliang Tang @ 2015-09-30 10:48 UTC (permalink / raw)
To: Tom Lendacky; +Cc: Geliang Tang, netdev, linux-kernel
Added kfree() to avoid the memory leak when debugfs_create_dir() fails.
Signed-off-by: Geliang Tang <geliangtang@163.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
index 2c063b6..66137ff 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
@@ -330,6 +330,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
if (!pdata->xgbe_debugfs) {
netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
+ kfree(buf);
return;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
2015-09-30 10:48 [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs Geliang Tang
@ 2015-09-30 14:06 ` Tom Lendacky
2015-10-05 10:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Tom Lendacky @ 2015-09-30 14:06 UTC (permalink / raw)
To: Geliang Tang; +Cc: netdev, linux-kernel
On 09/30/2015 05:48 AM, Geliang Tang wrote:
> Added kfree() to avoid the memory leak when debugfs_create_dir() fails.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
> index 2c063b6..66137ff 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-debugfs.c
> @@ -330,6 +330,7 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
> pdata->xgbe_debugfs = debugfs_create_dir(buf, NULL);
> if (!pdata->xgbe_debugfs) {
> netdev_err(pdata->netdev, "debugfs_create_dir failed\n");
> + kfree(buf);
> return;
> }
>
>
Looking at the code, I should also check for buf being NULL before
calling debugfs_create_dir. I'll work up a patch for that and send
it in.
Thanks,
Tom
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
2015-09-30 10:48 [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs Geliang Tang
2015-09-30 14:06 ` Tom Lendacky
@ 2015-10-05 10:06 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-10-05 10:06 UTC (permalink / raw)
To: geliangtang; +Cc: thomas.lendacky, netdev, linux-kernel
From: Geliang Tang <geliangtang@163.com>
Date: Wed, 30 Sep 2015 03:48:50 -0700
> Added kfree() to avoid the memory leak when debugfs_create_dir() fails.
>
> Signed-off-by: Geliang Tang <geliangtang@163.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-10-05 10:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-30 10:48 [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs Geliang Tang
2015-09-30 14:06 ` Tom Lendacky
2015-10-05 10:06 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).