public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Claudiu Manoil <claudiu.manoil@nxp.com>, Po Liu <Po.Liu@nxp.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH net-next] enetc: Fix use after free in stream_filter_unref()
Date: Tue, 5 May 2020 23:47:21 +0300	[thread overview]
Message-ID: <20200505204721.GA51853@mwanda> (raw)

This code frees "sfi" and then dereferences it on the next line.

Fixes: 888ae5a3952b ("net: enetc: add tc flower psfp offload driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.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 48e589e9d0f7c..10d79eb46c2e8 100644
--- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c
+++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c
@@ -902,8 +902,8 @@ static void stream_filter_unref(struct enetc_ndev_priv *priv, u32 index)
 	if (z) {
 		enetc_streamfilter_hw_set(priv, sfi, false);
 		hlist_del(&sfi->node);
-		kfree(sfi);
 		clear_bit(sfi->index, epsfp.psfp_sfi_bitmap);
+		kfree(sfi);
 	}
 }
 
-- 
2.26.2


             reply	other threads:[~2020-05-05 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 20:47 Dan Carpenter [this message]
2020-05-08  0:36 ` [PATCH net-next] enetc: Fix use after free in stream_filter_unref() David Miller
  -- strict thread matches above, loose matches on Subject: below --
2020-05-06  4:14 Po Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200505204721.GA51853@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Po.Liu@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox