[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM4PR04MB1604B06C5FB986CCF241D411ECB60@AM4PR04MB1604.eurprd04.prod.outlook.com>
Date: Thu, 24 Nov 2016 12:01:22 +0000
From: Madalin-Cristian Bucur <madalin.bucur@....com>
To: Dan Carpenter <dan.carpenter@...cle.com>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [patch] fsl/fman: fix a leak in tgec_free()
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@...cle.com]
> Sent: Thursday, November 24, 2016 1:21 PM
> To: Madalin-Cristian 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.
Agree, thanks.
> 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