From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 91B6E45AE2;
	Tue,  8 Oct 2024 17:44:24 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8424A40E3E;
	Tue,  8 Oct 2024 17:43:26 +0200 (CEST)
Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com
 [209.85.215.174])
 by mails.dpdk.org (Postfix) with ESMTP id BB50F40DC9
 for <dev@dpdk.org>; Tue,  8 Oct 2024 17:43:19 +0200 (CEST)
Received: by mail-pg1-f174.google.com with SMTP id
 41be03b00d2f7-7cd8803fe0aso3952778a12.0
 for <dev@dpdk.org>; Tue, 08 Oct 2024 08:43:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1728402199;
 x=1729006999; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Plgy9PDqajvquXkog4RVCkn7bnNeKWLvrtxzK7ec50g=;
 b=hT6U/qHbqVp04vtaOVPq6Bt8tBLH3uD8rZ+sasmunu0jqOTmvoQu6lgIwJ1f+MAvBo
 mVKjFB7E1bZXpIP+kBHjtVDec9NZ0vuoy9VwxSl3d6UzmUEZnaUrRT3HVELeQNFSOAaG
 iQUOOuzoXApC3m/Ow0S1s7SARfbttnmwi8tnLftOpkfxcYfeQJQ9NJqayhknjPmV6hwY
 WtXo2a8L30yTXoyZWNirbGpuaseg4m60Oa5MI8Gtao+Hc5UGprGUMv+kxW7vbht2EHyr
 iT0sE3Puty6gvrMbgpuYKBifffcFpVUnkjr+O2bhxKDr3MtwMuiUrUJbTT/jYrtgdVlO
 rIdg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728402199; x=1729006999;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Plgy9PDqajvquXkog4RVCkn7bnNeKWLvrtxzK7ec50g=;
 b=Mxkgqbnce21Dju2QGCp9mWaE5kGMODBlLCFwupoFUS4GTdj4WLCbtnt6kd/9wn0qaW
 VyhIYyKcDCetdjeZ5ExlYu8MaJXpYKSQZCMIXE1kV3vq8pze4yYbjIWfFotkOKTqnvBS
 L4M0t1ZCd5efRzEpcRv9BFx6c3i3UXHeWlZDT4ycJIoD64cCoVUYdmrM0CrVwet61qPs
 U6vh0viFXY/99NZn2EnE9gHJg3xQQr30YuiScIS0OAfwUU73dEIYgNjBu37S6Opaf4rJ
 NOXYwmWXUYaJW8w0p5QX2RqpjC7UQWzuv0YbzIWmIKzwiAVQyvzUjReORRfxo2kAXERm
 yWvQ==
X-Gm-Message-State: AOJu0YwCnTeemafwZjizMwSco7Z6zLrRhqbcX1plLtIloOGTQq5t8iPR
 owfupN8Eb8VXvCY46uYkdzQF53sz6GIlfpgzOb7AqksGZn8SkkJV/jz4BLL1OiYJfy9nNwk2+H7
 2lLTcww==
X-Google-Smtp-Source: AGHT+IFg8wqLfySlRcm36Iyo4F8BbUjRJe/4aPqMv/LJPYnayt8+O7ZvhVZ+lMnVMhjBx+huZ8xRdg==
X-Received: by 2002:a05:6a21:1584:b0:1c8:92ed:7c5e with SMTP id
 adf61e73a8af0-1d6dfa40ae2mr26233349637.23.1728402199022; 
 Tue, 08 Oct 2024 08:43:19 -0700 (PDT)
Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226])
 by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71df0ccf01dsm6293527b3a.70.2024.10.08.08.43.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 08 Oct 2024 08:43:18 -0700 (PDT)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>, stable@dpdk.org,
 Wei Zhao <wei.zhao1@intel.com>
Subject: [PATCH v8 08/17] net/e1000: fix use-after-free
Date: Tue,  8 Oct 2024 08:41:38 -0700
Message-ID: <20241008154301.66192-9-stephen@networkplumber.org>
X-Mailer: git-send-email 2.45.2
In-Reply-To: <20241008154301.66192-1-stephen@networkplumber.org>
References: <20240927204742.546164-1-stephen@networkplumber.org>
 <20241008154301.66192-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

The driver cleanup code was freeing the filter object
then dereferencing it.

Bugzilla ID: 1550
Fixes: 6a4d050e2855 ("net/igb: flush all the filter")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/e1000/igb_ethdev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index 1e0a483d4a..d3a9181874 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -3907,11 +3907,11 @@ igb_delete_2tuple_filter(struct rte_eth_dev *dev,
 
 	filter_info->twotuple_mask &= ~(1 << filter->index);
 	TAILQ_REMOVE(&filter_info->twotuple_list, filter, entries);
-	rte_free(filter);
 
 	E1000_WRITE_REG(hw, E1000_TTQF(filter->index), E1000_TTQF_DISABLE_MASK);
 	E1000_WRITE_REG(hw, E1000_IMIR(filter->index), 0);
 	E1000_WRITE_REG(hw, E1000_IMIREXT(filter->index), 0);
+	rte_free(filter);
 	return 0;
 }
 
@@ -4348,7 +4348,6 @@ igb_delete_5tuple_filter_82576(struct rte_eth_dev *dev,
 
 	filter_info->fivetuple_mask &= ~(1 << filter->index);
 	TAILQ_REMOVE(&filter_info->fivetuple_list, filter, entries);
-	rte_free(filter);
 
 	E1000_WRITE_REG(hw, E1000_FTQF(filter->index),
 			E1000_FTQF_VF_BP | E1000_FTQF_MASK);
@@ -4357,6 +4356,7 @@ igb_delete_5tuple_filter_82576(struct rte_eth_dev *dev,
 	E1000_WRITE_REG(hw, E1000_SPQF(filter->index), 0);
 	E1000_WRITE_REG(hw, E1000_IMIR(filter->index), 0);
 	E1000_WRITE_REG(hw, E1000_IMIREXT(filter->index), 0);
+	rte_free(filter);
 	return 0;
 }
 
-- 
2.45.2