From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 42EC8A0548; Thu, 1 Apr 2021 14:02:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C149E1410F9; Thu, 1 Apr 2021 14:02:07 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 4B5881410BC for ; Thu, 1 Apr 2021 14:02:05 +0200 (CEST) IronPort-SDR: C+IvKpWfUrmORFIzV8yTj6zEhTzonq0nZ7XEWAtn44tLsfMFrAJRrvp/XPxfL4T/WvkFVuXMwX 1pM83VpunjYA== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="192330716" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="192330716" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 05:02:04 -0700 IronPort-SDR: tnoYKVd3F548icc4j/Dq0bP1OlpHp3AHTA+FDWkwgMbg32WbQSblqc/reusy+XW33o73qstHHc afHClHnytDow== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="517311867" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga001.fm.intel.com with ESMTP; 01 Apr 2021 05:02:04 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 05:02:03 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX605.ccr.corp.intel.com (10.109.6.215) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 20:02:01 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.2106.013; Thu, 1 Apr 2021 20:02:01 +0800 From: "Zhang, Qi Z" To: "Ma, WenwuX" , "Yang, Qiming" CC: "dev@dpdk.org" Thread-Topic: [PATCH] net/ice: fix illegal pointer access in releasing vsi Thread-Index: AQHXJqX1PasKnlXDIkyWF8vsc0IJwKqfkCbQ Date: Thu, 1 Apr 2021 12:02:01 +0000 Message-ID: <932ac785208b4fabb23f025ad9704927@intel.com> References: <20210401151407.18546-1-wenwux.ma@intel.com> In-Reply-To: <20210401151407.18546-1-wenwux.ma@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] net/ice: fix illegal pointer access in releasing vsi X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Ma, WenwuX > Sent: Thursday, April 1, 2021 11:14 PM > To: Yang, Qiming ; Zhang, Qi Z > > Cc: dev@dpdk.org > Subject: [PATCH] net/ice: fix illegal pointer access in releasing vsi Please add fix line and cc stable. >=20 > When deleting the mac filter in ice_remove_all_mac_vlan_filters(), > TAILQ_FOREACH_SAFE should be used instead of TAILQ_FOREACH, Otherwise, > it will result in a illegal pointer access. >=20 > Signed-off-by: Wenwu Ma > --- > drivers/net/ice/ice_ethdev.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c = index > 9c9b84a93..785750d9b 100644 > --- a/drivers/net/ice/ice_ethdev.c > +++ b/drivers/net/ice/ice_ethdev.c > @@ -10,6 +10,8 @@ > #include > #include >=20 > +#include > + > #include "base/ice_sched.h" > #include "base/ice_flow.h" > #include "base/ice_dcb.h" > @@ -1094,12 +1096,13 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi > *vsi) { > struct ice_mac_filter *m_f; > struct ice_vlan_filter *v_f; > + void *temp; > int ret =3D 0; >=20 > if (!vsi || !vsi->mac_num) > return -EINVAL; >=20 > - TAILQ_FOREACH(m_f, &vsi->mac_list, next) { > + TAILQ_FOREACH_SAFE(m_f, &vsi->mac_list, next, temp) { > ret =3D ice_remove_mac_filter(vsi, &m_f->mac_info.mac_addr); > if (ret !=3D ICE_SUCCESS) { > ret =3D -EINVAL; > @@ -1110,7 +1113,7 @@ ice_remove_all_mac_vlan_filters(struct ice_vsi *vsi= ) > if (vsi->vlan_num =3D=3D 0) > return 0; >=20 > - TAILQ_FOREACH(v_f, &vsi->vlan_list, next) { > + TAILQ_FOREACH_SAFE(v_f, &vsi->vlan_list, next, temp) { > ret =3D ice_remove_vlan_filter(vsi, &v_f->vlan_info.vlan); > if (ret !=3D ICE_SUCCESS) { > ret =3D -EINVAL; > -- > 2.25.1