From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D3D5A0613 for ; Thu, 26 Sep 2019 11:47:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 16DC71BF55; Thu, 26 Sep 2019 11:47:53 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 2DEEC1BF34; Thu, 26 Sep 2019 11:47:47 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Sep 2019 02:47:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,551,1559545200"; d="scan'208";a="189958563" Received: from kmsmsx156.gar.corp.intel.com ([172.21.138.133]) by fmsmga007.fm.intel.com with ESMTP; 26 Sep 2019 02:47:46 -0700 Received: from pgsmsx109.gar.corp.intel.com (10.221.44.109) by KMSMSX156.gar.corp.intel.com (172.21.138.133) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 26 Sep 2019 17:47:45 +0800 Received: from pgsmsx102.gar.corp.intel.com ([169.254.6.203]) by PGSMSX109.gar.corp.intel.com ([169.254.14.150]) with mapi id 14.03.0439.000; Thu, 26 Sep 2019 17:47:45 +0800 From: "Gujjar, Abhinandan S" To: "Chaitanya Babu, TalluriX" , "dev@dpdk.org" CC: "Pattan, Reshma" , "Parthasarathy, JananeeX M" , "stable@dpdk.org" Thread-Topic: [PATCH] lib/eventdev: fix null pointer dereferences coverity issue Thread-Index: AQHVb4KNSDkKwGrXLUqy795SBdjFXac76CgAgAFNZACAAIce0A== Date: Thu, 26 Sep 2019 09:47:44 +0000 Message-ID: <5612CB344B05EE4F95FC5B729939F78079549B20@PGSMSX102.gar.corp.intel.com> References: <1568963369-6449-1-git-send-email-tallurix.chaitanya.babu@intel.com> <5612CB344B05EE4F95FC5B729939F78079549005@PGSMSX102.gar.corp.intel.com> <761FB0F2AB727F4FA9CE98D18810B01560F169CA@BGSMSX103.gar.corp.intel.com> In-Reply-To: <761FB0F2AB727F4FA9CE98D18810B01560F169CA@BGSMSX103.gar.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmZhMzg5MTgtZDJhOC00OGEzLWFhOTYtNzNkYzUwYjRkNzMyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiODc3YlNBekw2eVFPRUNEN3JoZkFnaG94YjFUTHBhVStKU0E1MTd4RWxTc2RpVWlEaE5TOWV3MFp0XC9HZVNZbHEifQ== dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [172.30.20.206] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [PATCH] lib/eventdev: fix null pointer dereferences coverity issue X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Chaitanya, This patch is not required. This has to be marked to ignore in coverity. Regards Abhinandan > -----Original Message----- > From: Chaitanya Babu, TalluriX > Sent: Thursday, September 26, 2019 3:03 PM > To: Gujjar, Abhinandan S ; dev@dpdk.org > Cc: Pattan, Reshma ; Parthasarathy, JananeeX M > ; stable@dpdk.org > Subject: RE: [PATCH] lib/eventdev: fix null pointer dereferences coverity= issue >=20 > Hi Abhinandan, >=20 > >-----Original Message----- > >From: Gujjar, Abhinandan S > >Sent: Wednesday, September 25, 2019 11:17 AM > >To: Chaitanya Babu, TalluriX ; > >dev@dpdk.org > >Cc: Pattan, Reshma ; Parthasarathy, JananeeX M > >; stable@dpdk.org > >Subject: RE: [PATCH] lib/eventdev: fix null pointer dereferences > >coverity issue > > > >Please find the comments inline > > > >> -----Original Message----- > >> From: Chaitanya Babu, TalluriX > >> Sent: Friday, September 20, 2019 12:39 PM > >> To: dev@dpdk.org > >> Cc: Pattan, Reshma ; Parthasarathy, JananeeX > >> M ; Gujjar, Abhinandan S > >> ; Chaitanya Babu, TalluriX > >> ; stable@dpdk.org > >> Subject: [PATCH] lib/eventdev: fix null pointer dereferences coverity > >> issue > >> > >> One issue caught by Coverity 340075 > >> *deref_ptr: Directly dereferencing pointer qp_info. > >> > >> In eca_enq_to_cryptodev() qp_info dereferenced without null check in > >> both session and sessionless crypto ops. > >> > >> The fix is to access qp_info after null check. > >> > >> Coverity issue: 340075 > >> Fixes: 7901eac340 ("eventdev: add crypto adapter implementation") > >> Cc: stable@dpdk.org > >> > >> Signed-off-by: Chaitanya Babu Talluri > >> > >> --- > >> lib/librte_eventdev/rte_event_crypto_adapter.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/lib/librte_eventdev/rte_event_crypto_adapter.c > >> b/lib/librte_eventdev/rte_event_crypto_adapter.c > >> index 22d910816..4f3f57348 100644 > >> --- a/lib/librte_eventdev/rte_event_crypto_adapter.c > >> +++ b/lib/librte_eventdev/rte_event_crypto_adapter.c > >> @@ -356,7 +356,7 @@ eca_enq_to_cryptodev(struct > >> rte_event_crypto_adapter *adapter, > >> cdev_id =3D m_data->request_info.cdev_id; > >> qp_id =3D m_data->request_info.queue_pair_id; > >> qp_info =3D &adapter->cdevs[cdev_id].qpairs[qp_id]; > >> - if (!qp_info->qp_enabled) { > >> + if ((qp_info =3D=3D NULL) || (!qp_info->qp_enabled)) { > >qp_info cannot be null as the memory allocation is done in > >rte_event_crypto_adapter_queue_pair_add() -> eca_add_queue_pair(). > >Please refer line #736 which is allocating memory for > >"dev_info->dev->data- > >>nb_queue_pairs" > > > >Without queue_pair_add(), service core cannot be started [Please look > >at eca_init_service()]. > >This issue can be marked to ignore in klockworks. > > >=20 > Yes, we observed that queue pairs are allocated earlier based on device c= onfig. > But NULL check is done here just in case if queue pair id "qp_id" is inva= lid since > this is fed from request info during enqueue. >=20 > Please let us know if still this change is not required, we will ignore t= his patch. >=20 > >> rte_pktmbuf_free(crypto_op->sym->m_src); > >> rte_crypto_op_free(crypto_op); > >> continue; > >> @@ -372,7 +372,7 @@ eca_enq_to_cryptodev(struct > >> rte_event_crypto_adapter *adapter, > >> cdev_id =3D m_data->request_info.cdev_id; > >> qp_id =3D m_data->request_info.queue_pair_id; > >> qp_info =3D &adapter->cdevs[cdev_id].qpairs[qp_id]; > >> - if (!qp_info->qp_enabled) { > >> + if ((qp_info =3D=3D NULL) || (!qp_info->qp_enabled)) { > >> rte_pktmbuf_free(crypto_op->sym->m_src); > >> rte_crypto_op_free(crypto_op); > >> continue; > >> -- > >> 2.17.2