From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CD8445502; Thu, 27 Jun 2024 12:08:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D1B540DDC; Thu, 27 Jun 2024 12:08:04 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id 76694402C6 for ; Thu, 27 Jun 2024 12:06:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1719482791; x=1751018791; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=B52G3ckGxgjSEUH7pB9NTdtTmtMSOLyo945GHr7Tuv4=; b=fRWjtTGbkN4E3zqgoPkkZUbTi1qXsGvyblaBd4T+n1WbQzsAhuVEWSdT QP3L3RPAiWlsMP6xATs92d0vRbPXzx8c/lPRtLv+KtXOuRcULsuiQDXQJ DVacYrJo1EDLGC24DKKVovm6EgJhEwUN099Gw/WKraIu9yXiGdYLmuILo NGgBjk/ACr2oLfCQ6WsVJ9j3znDcMTK8vsqdXsB9pKAozm4pWQl5zQYe0 1Zm9v0J1XVASr2gwgRInMDgPAMUkcNqvn81Ao3piDTQ7QBsIV7POJhU7M 35OiLnjjqWCfVLAppxOeC+S/+KOPbSAjXtHuQN9Pe0QjqAx0xCTVGIcxl w==; X-CSE-ConnectionGUID: ItHfJtYsSk2v6jiqy9AzEQ== X-CSE-MsgGUID: QZTc6R7fSJCAX7L6T1RRsQ== X-IronPort-AV: E=McAfee;i="6700,10204,11115"; a="27221042" X-IronPort-AV: E=Sophos;i="6.08,269,1712646000"; d="scan'208";a="27221042" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2024 03:06:29 -0700 X-CSE-ConnectionGUID: nqTC+cLlS9uG3wdz01RDJA== X-CSE-MsgGUID: 8dnhZiypSa2St3LXyleS2g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,269,1712646000"; d="scan'208";a="48685639" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmviesa003.fm.intel.com with ESMTP; 27 Jun 2024 03:06:29 -0700 From: Ganapati Kundapura To: dev@dpdk.org, gakhil@marvell.com, abhinandan.gujjar@intel.com, john.mcnamara@intel.com, bruce.richardson@intel.com Cc: mb@smartsharesystems.com, ferruh.yigit@amd.com, fanzhang.oss@gmail.com, thomas@monjalon.net, bala.senthil@intel.com Subject: [PATCH v3 2/2] cryptodev: validate crypto callbacks from next node Date: Thu, 27 Jun 2024 05:06:26 -0500 Message-Id: <20240627100626.2430162-2-ganapati.kundapura@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20240627100626.2430162-1-ganapati.kundapura@intel.com> References: <20240626220028.2260003-1-ganapati.kundapura@intel.com> <20240627100626.2430162-1-ganapati.kundapura@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Crypto callbacks are invoked on checking from head node which is always valid pointer. This patch checks next node from the head node if callbacks registered before invoking callbacks. Fixes: 1c3ffb95595e ("cryptodev: add enqueue and dequeue callbacks") Signed-off-by: Ganapati Kundapura --- v3: retained ifdef diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index c946f74..bec947f 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -1910,7 +1910,7 @@ rte_cryptodev_dequeue_burst(uint8_t dev_id, uint16_t qp_id, nb_ops = fp_ops->dequeue_burst(qp, ops, nb_ops); #ifdef RTE_CRYPTO_CALLBACKS - if (unlikely(fp_ops->qp.deq_cb != NULL)) { + if (unlikely(fp_ops->qp.deq_cb[qp_id].next != NULL)) { struct rte_cryptodev_cb_rcu *list; struct rte_cryptodev_cb *cb; @@ -1977,7 +1977,7 @@ rte_cryptodev_enqueue_burst(uint8_t dev_id, uint16_t qp_id, fp_ops = &rte_crypto_fp_ops[dev_id]; qp = fp_ops->qp.data[qp_id]; #ifdef RTE_CRYPTO_CALLBACKS - if (unlikely(fp_ops->qp.enq_cb != NULL)) { + if (unlikely(fp_ops->qp.enq_cb[qp_id].next != NULL)) { struct rte_cryptodev_cb_rcu *list; struct rte_cryptodev_cb *cb; -- 2.6.4