Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1236135 > unrolled thread

[PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs

Started byGeliang Tang <geliangtang@163.com>
First post2015-09-30 12:50 +0200
Last post2015-10-05 12:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs Geliang Tang <geliangtang@163.com> - 2015-09-30 12:50 +0200
    Re: [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs David Miller <davem@davemloft.net> - 2015-10-05 12:00 +0200

#1236135 — [PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs

FromGeliang Tang <geliangtang@163.com>
Date2015-09-30 12:50 +0200
Subject[PATCH] amd-xgbe: fix potential memory leak in xgbe-debugfs
Message-ID<qen7t-2yO-33@gated-at.bofh.it>
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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1239401

FromDavid Miller <davem@davemloft.net>
Date2015-10-05 12:00 +0200
Message-ID<qgaIP-3Ld-23@gated-at.bofh.it>
In reply to#1236135
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web