[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <560BEC77.8010400@amd.com>
Date: Wed, 30 Sep 2015 09:06:47 -0500
From: Tom Lendacky <thomas.lendacky@....com>
To: Geliang Tang <geliangtang@....com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
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@....com>
Acked-by: Tom Lendacky <thomas.lendacky@....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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists