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 15800A2EFC for ; Fri, 20 Sep 2019 09:11:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 678571EDE0; Fri, 20 Sep 2019 09:11:02 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 35B8C1F220; Fri, 20 Sep 2019 09:10:56 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2019 00:10:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,527,1559545200"; d="scan'208";a="388566431" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga006.fm.intel.com with ESMTP; 20 Sep 2019 00:10:54 -0700 Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com [10.102.246.100]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x8K7Arqr012725; Fri, 20 Sep 2019 08:10:53 +0100 Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1]) by wgcvswdev001.ir.intel.com with ESMTP id x8K7AFln007089; Fri, 20 Sep 2019 08:10:15 +0100 Received: (from tchaitax@localhost) by wgcvswdev001.ir.intel.com with œ id x8K7AFxl007085; Fri, 20 Sep 2019 08:10:15 +0100 From: Chaitanya Babu Talluri To: dev@dpdk.org Cc: reshma.pattan@intel.com, jananeex.m.parthasarathy@intel.com, abhinandan.gujjar@intel.com, Chaitanya Babu Talluri , stable@dpdk.org Date: Fri, 20 Sep 2019 08:09:29 +0100 Message-Id: <1568963369-6449-1-git-send-email-tallurix.chaitanya.babu@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [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" 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 = m_data->request_info.cdev_id; qp_id = m_data->request_info.queue_pair_id; qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id]; - if (!qp_info->qp_enabled) { + if ((qp_info == NULL) || (!qp_info->qp_enabled)) { 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 = m_data->request_info.cdev_id; qp_id = m_data->request_info.queue_pair_id; qp_info = &adapter->cdevs[cdev_id].qpairs[qp_id]; - if (!qp_info->qp_enabled) { + if ((qp_info == NULL) || (!qp_info->qp_enabled)) { rte_pktmbuf_free(crypto_op->sym->m_src); rte_crypto_op_free(crypto_op); continue; -- 2.17.2