> -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx] > Sent: Thursday, November 24, 2016 1:21 PM > To: Madalin-Cristian Bucur <madalin.bucur@xxxxxxx>; Igal Liberman > <igal.liberman@xxxxxxxxxxxxx> > Cc: netdev@xxxxxxxxxxxxxxx; kernel-janitors@xxxxxxxxxxxxxxx > 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@xxxxxxxxxx> > --- > 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); > -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html