[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161124111931.GK17225@mwanda>
Date: Thu, 24 Nov 2016 14:20:43 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Madalin Bucur <madalin.bucur@....com>,
Igal Liberman <igal.liberman@...escale.com>
Cc: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] fsl/fman: fix a leak in tgec_free()
We set "tgec->cfg" to NULL before passing it to kfree(). There is no
need to set it to NULL at all. Let's just delete it.
Fixes: 57ba4c9b56d8 ("fsl/fman: Add FMan MAC support")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
I haven't tested this. It occurs to me that this code might be
something to paper over a use after free bug by changing it to a leak
instead.
It applies to net-master.
diff --git a/drivers/net/ethernet/freescale/fman/fman_tgec.c b/drivers/net/ethernet/freescale/fman/fman_tgec.c
index efabb04..4b0f3a5 100644
--- a/drivers/net/ethernet/freescale/fman/fman_tgec.c
+++ b/drivers/net/ethernet/freescale/fman/fman_tgec.c
@@ -722,9 +722,6 @@ int tgec_free(struct fman_mac *tgec)
{
free_init_resources(tgec);
- if (tgec->cfg)
- tgec->cfg = NULL;
-
kfree(tgec->cfg);
kfree(tgec);
Powered by blists - more mailing lists