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 D1E48A034F for ; Thu, 23 Apr 2020 17:10:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8DF081C43F; Thu, 23 Apr 2020 17:10:55 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 865A01C2F5; Thu, 23 Apr 2020 17:10:52 +0200 (CEST) IronPort-SDR: ArWr0GpIJEqSl4gz01e+Nl22dfH/fdpDCwtOo4nFJrQyGxk7ZOcJUODaBAwpS2XZxJWU3TFcZx j/1FMl2MGf1g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Apr 2020 08:10:51 -0700 IronPort-SDR: +vM0Lji8LoSpfg8KMOVNifPDCeWRtCg6ax7Lw8qo5GTPGj7wxjzra6ZflV5T7ArVrN5YIUs+5Y 1lqbDr3QuVrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,307,1583222400"; d="scan'208";a="280436702" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga004.fm.intel.com with ESMTP; 23 Apr 2020 08:10:49 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: akhil.goyal@nxp.com, declan.doherty@intel.com, Konstantin Ananyev , stable@dpdk.org Date: Thu, 23 Apr 2020 16:10:42 +0100 Message-Id: <20200423151042.4650-1-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200422235158.24497-1-konstantin.ananyev@intel.com> References: <20200422235158.24497-1-konstantin.ananyev@intel.com> Subject: [dpdk-stable] [PATCH v2] security: fix crash at accessing non-implemented ops 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" Valid checks for optional function pointers inside dev-ops were disabled by undefined macro. Fixes: b6ee98547847 ("security: fix verification of parameters") Cc: stable@dpdk.org Signed-off-by: Konstantin Ananyev --- lib/librte_security/rte_security.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/librte_security/rte_security.c b/lib/librte_security/rte_security.c index d475b0977..dc9a3e89c 100644 --- a/lib/librte_security/rte_security.c +++ b/lib/librte_security/rte_security.c @@ -108,10 +108,11 @@ rte_security_set_pkt_metadata(struct rte_security_ctx *instance, struct rte_mbuf *m, void *params) { #ifdef RTE_DEBUG - RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, set_pkt_metadata, -EINVAL, - -ENOTSUP); RTE_PTR_OR_ERR_RET(sess, -EINVAL); + RTE_PTR_OR_ERR_RET(instance, -EINVAL); + RTE_PTR_OR_ERR_RET(instance->ops, -EINVAL); #endif + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->set_pkt_metadata, -ENOTSUP); return instance->ops->set_pkt_metadata(instance->device, sess, m, params); } @@ -122,8 +123,10 @@ rte_security_get_userdata(struct rte_security_ctx *instance, uint64_t md) void *userdata = NULL; #ifdef RTE_DEBUG - RTE_PTR_CHAIN3_OR_ERR_RET(instance, ops, get_userdata, NULL, NULL); + RTE_PTR_OR_ERR_RET(instance, NULL); + RTE_PTR_OR_ERR_RET(instance->ops, NULL); #endif + RTE_FUNC_PTR_OR_ERR_RET(*instance->ops->get_userdata, NULL); if (instance->ops->get_userdata(instance->device, md, &userdata)) return NULL; -- 2.17.1