linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next] net:enetc: bug fix for qos sfi operate space after freed
@ 2020-05-07 10:57 Po Liu
  2020-05-07 20:06 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Po Liu @ 2020-05-07 10:57 UTC (permalink / raw)
  To: linux-kernel, kernel-janitors, netdev, dan.carpenter
  Cc: davem, claudiu.manoil, Po Liu

'Dan Carpenter' reported:
This code frees "sfi" and then dereferences it on the next line:
>                 kfree(sfi);
>                 clear_bit(sfi->index, epsfp.psfp_sfi_bitmap);

This "sfi->index" should be "index".

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Po Liu <Po.Liu@nxp.com>
---
 drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
index 48e589e9d0f7..77f110e24505 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
@@ -903,7 +903,7 @@ static void stream_filter_unref(struct enetc_ndev_priv *priv, u32 index)
 		enetc_streamfilter_hw_set(priv, sfi, false);
 		hlist_del(&sfi->node);
 		kfree(sfi);
-		clear_bit(sfi->index, epsfp.psfp_sfi_bitmap);
+		clear_bit(index, epsfp.psfp_sfi_bitmap);
 	}
 }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net-next] net:enetc: bug fix for qos sfi operate space after freed
  2020-05-07 10:57 [net-next] net:enetc: bug fix for qos sfi operate space after freed Po Liu
@ 2020-05-07 20:06 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-05-07 20:06 UTC (permalink / raw)
  To: Po.Liu
  Cc: linux-kernel, kernel-janitors, netdev, dan.carpenter, claudiu.manoil

From: Po Liu <Po.Liu@nxp.com>
Date: Thu,  7 May 2020 18:57:38 +0800

> 'Dan Carpenter' reported:
> This code frees "sfi" and then dereferences it on the next line:
>>                 kfree(sfi);
>>                 clear_bit(sfi->index, epsfp.psfp_sfi_bitmap);
> 
> This "sfi->index" should be "index".
> 
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Po Liu <Po.Liu@nxp.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-07 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 10:57 [net-next] net:enetc: bug fix for qos sfi operate space after freed Po Liu
2020-05-07 20:06 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).