[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190925215854.14284-1-navid.emamdoost@gmail.com>
Date: Wed, 25 Sep 2019 16:58:53 -0500
From: Navid Emamdoost <navid.emamdoost@...il.com>
To: unlisted-recipients:; (no To-header on input)
Cc: emamd001@....edu, kjlu@....edu, smccaman@....edu,
Navid Emamdoost <navid.emamdoost@...il.com>,
Samuel Mendoza-Jonas <sam@...dozajonas.com>,
"David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] net/ncsi: prevent memory leak in ncsi_rsp_handler_gc
In ncsi_rsp_handler_gc if allocation for nc->vlan_filter.vids fails the
allocated memory for nc->mac_filter.addrs should be released.
Signed-off-by: Navid Emamdoost <navid.emamdoost@...il.com>
---
net/ncsi/ncsi-rsp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/ncsi/ncsi-rsp.c b/net/ncsi/ncsi-rsp.c
index d5611f04926d..f3f7c3772994 100644
--- a/net/ncsi/ncsi-rsp.c
+++ b/net/ncsi/ncsi-rsp.c
@@ -800,8 +800,10 @@ static int ncsi_rsp_handler_gc(struct ncsi_request *nr)
nc->vlan_filter.vids = kcalloc(rsp->vlan_cnt,
sizeof(*nc->vlan_filter.vids),
GFP_ATOMIC);
- if (!nc->vlan_filter.vids)
+ if (!nc->vlan_filter.vids) {
+ kfree(nc->mac_filter.addrs);
return -ENOMEM;
+ }
/* Set VLAN filters active so they are cleared in the first
* configuration state
*/
--
2.17.1
Powered by blists - more mailing lists