From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 317925921 for ; Mon, 16 Mar 2015 02:47:10 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga101.fm.intel.com with ESMTP; 15 Mar 2015 18:47:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,407,1422950400"; d="scan'208";a="467666448" Received: from pgsmsx106.gar.corp.intel.com ([10.221.44.98]) by FMSMGA003.fm.intel.com with ESMTP; 15 Mar 2015 18:40:01 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX106.gar.corp.intel.com (10.221.44.98) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 16 Mar 2015 09:46:15 +0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.198]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.111]) with mapi id 14.03.0224.002; Mon, 16 Mar 2015 09:46:14 +0800 From: "Chen, Jing D" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free Thread-Index: AQHQV+MhszQH5x5jSEiwPF2Jd4e5850eZcuA Date: Mon, 16 Mar 2015 01:46:13 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0169D833@shsmsx102.ccr.corp.intel.com> References: <1425628607-1497-1-git-send-email-michael.qiu@intel.com> In-Reply-To: <1425628607-1497-1-git-send-email-michael.qiu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_pmd_fm10k: Set pointer to NULL after free X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2015 01:47:10 -0000 > -----Original Message----- > From: Qiu, Michael > Sent: Friday, March 06, 2015 3:57 PM > To: dev@dpdk.org > Cc: Chen, Jing D; Qiu, Michael > Subject: [PATCH] librte_pmd_fm10k: Set pointer to NULL after free >=20 > It could be a potential not safe issue. >=20 > Signed-off-by: Michael Qiu > --- > lib/librte_pmd_fm10k/fm10k_ethdev.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/librte_pmd_fm10k/fm10k_ethdev.c > b/lib/librte_pmd_fm10k/fm10k_ethdev.c > index 07ea1e7..30962d3 100644 > --- a/lib/librte_pmd_fm10k/fm10k_ethdev.c > +++ b/lib/librte_pmd_fm10k/fm10k_ethdev.c > @@ -142,9 +142,12 @@ rx_queue_free(struct fm10k_rx_queue *q) > if (q) { > PMD_INIT_LOG(DEBUG, "Freeing rx queue %p", q); > rx_queue_clean(q); > - if (q->sw_ring) > + if (q->sw_ring) { > rte_free(q->sw_ring); > + q->sw_ring =3D NULL; > + } > rte_free(q); > + q =3D NULL; > } > } >=20 > @@ -225,11 +228,16 @@ tx_queue_free(struct fm10k_tx_queue *q) > if (q) { > PMD_INIT_LOG(DEBUG, "Freeing tx queue %p", q); > tx_queue_clean(q); > - if (q->rs_tracker.list) > + if (q->rs_tracker.list) { > rte_free(q->rs_tracker.list); > - if (q->sw_ring) > + q->rs_tracker.list =3D NULL; > + } > + if (q->sw_ring) { > rte_free(q->sw_ring); > + q->sw_ring =3D NULL; > + } > rte_free(q); > + q =3D NULL; > } > } >=20 > -- > 1.9.3 Acked-by: Jing Chen