From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 5EE0BA00E6 for ; Mon, 15 Apr 2019 17:05:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B2731B2AF; Mon, 15 Apr 2019 17:05:05 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 538301B212; Mon, 15 Apr 2019 17:04:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Apr 2019 08:04:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,354,1549958400"; d="scan'208";a="140836583" Received: from silpixa00399502.ir.intel.com (HELO silpixa00399502.ger.corp.intel.com) ([10.237.222.111]) by fmsmga008.fm.intel.com with ESMTP; 15 Apr 2019 08:04:54 -0700 From: Marko Kovacevic To: dev@dpdk.org Cc: john.mcnamara@intel.com, xinfengx.zhao@intel.com, akhil.goyal@nxp.com, Marko Kovacevic , roy.fan.zhang@intel.com, stable@dpdk.org Date: Mon, 15 Apr 2019 16:04:49 +0100 Message-Id: <20190415150449.44799-3-marko.kovacevic@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20190415150449.44799-1-marko.kovacevic@intel.com> References: <20190411141656.27720-1-marko.kovacevic@intel.com> <20190415150449.44799-1-marko.kovacevic@intel.com> Subject: [dpdk-dev] [PATCH v2 3/3] cryptodev: fix uninitialized session clear 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190415150449.D8TU-CEWlz-Nq02NJnr3Cdubc8s3h7JGvmNQ6Q8dvPI@z> added check to see if a session for a device has been initialised if it has return 0. Fixes: 5d6c73dd5938 ("cryptodev: add reference count to session private data") Cc: roy.fan.zhang@intel.com Cc: stable@dpdk.org Signed-off-by: Marko Kovacevic --- lib/librte_cryptodev/rte_cryptodev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index 2675e1ef7..00c2cf432 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1386,6 +1386,8 @@ rte_cryptodev_sym_session_clear(uint8_t dev_id, return -EINVAL; driver_id = dev->driver_id; + if (sess->sess_data[driver_id].refcnt == 0) + return 0; if (--sess->sess_data[driver_id].refcnt != 0) return -EBUSY; -- 2.13.6