From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4396947CD for ; Mon, 6 Feb 2017 19:42:26 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga102.jf.intel.com with ESMTP; 06 Feb 2017 10:42:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,342,1477983600"; d="scan'208";a="62500614" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga006.fm.intel.com with ESMTP; 06 Feb 2017 10:42:23 -0800 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.173]) by IRSMSX102.ger.corp.intel.com ([169.254.2.230]) with mapi id 14.03.0248.002; Mon, 6 Feb 2017 18:42:23 +0000 From: "Dumitrescu, Cristian" To: Jan Blunck , "dev@dpdk.org" CC: "h.mikita89@gmail.com" , Alan Dewar Thread-Topic: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port Thread-Index: AQHSgJ8sIGfDKPAsREaYUUrE13GKk6FcT/sQ Date: Mon, 6 Feb 2017 18:42:22 +0000 Message-ID: <3EB4FA525960D640B5BDFFD6A3D8912652748706@IRSMSX108.ger.corp.intel.com> References: <1486402362-15098-1-git-send-email-jblunck@infradead.org> In-Reply-To: <1486402362-15098-1-git-send-email-jblunck@infradead.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjk1MGM5ZDUtYTM1OC00N2Q1LWJiMGMtMGI2YzQxYWNlZjRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjIuMTEuMCIsIlRydXN0ZWRMYWJlbEhhc2giOiJ0RnRiOGZNbFQ1a2ZWdXAxYWgxNEtBYnFQYVM0dkRuWjdHd08yM2ZWYllVPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing port X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Feb 2017 18:42:26 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jan Blunck > Sent: Monday, February 6, 2017 5:33 PM > To: dev@dpdk.org > Cc: h.mikita89@gmail.com; Alan Dewar > Subject: [dpdk-dev] [PATCH] sched: fix segmentation fault when freeing po= rt >=20 > From: Alan Dewar >=20 > Prevent a segmentation fault in rte_sched_port_free by only accessing > the port structure after the NULL pointer check has been made. >=20 > Fixes: 7b3c4f35 ("sched: fix releasing enqueued packets") >=20 > Signed-off-by: Alan Dewar > Signed-off-by: Jan Blunck > --- > lib/librte_sched/rte_sched.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c > index e6dace2..614705d 100644 > --- a/lib/librte_sched/rte_sched.c > +++ b/lib/librte_sched/rte_sched.c > @@ -735,12 +735,14 @@ void > rte_sched_port_free(struct rte_sched_port *port) > { > uint32_t qindex; > - uint32_t n_queues_per_port =3D > rte_sched_port_queues_per_port(port); > + uint32_t n_queues_per_port; >=20 > /* Check user parameters */ > if (port =3D=3D NULL) > return; >=20 > + n_queues_per_port =3D rte_sched_port_queues_per_port(port); > + > /* Free enqueued mbufs */ > for (qindex =3D 0; qindex < n_queues_per_port; qindex++) { > struct rte_mbuf **mbufs =3D rte_sched_port_qbase(port, > qindex); > -- > 2.7.4 Acked-by: Cristian Dumitrescu