netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Geliang Tang <geliangtang@163.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
Date: Wed, 30 Sep 2015 09:06:47 -0500	[thread overview]
Message-ID: <560BEC77.8010400@amd.com> (raw)
In-Reply-To: <636eed156113df40f9dd5e696f0486f428aff590.1443638366.git.geliangtang@163.com>

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

  reply	other threads:[~2015-09-30 14:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-30 10:48 [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs Geliang Tang
2015-09-30 14:06 ` Tom Lendacky [this message]
2015-10-05 10:06 ` David Miller

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=560BEC77.8010400@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=geliangtang@163.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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 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).