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 3A58941CF4 for ; Mon, 20 Feb 2023 07:06:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 34D0242F82; Mon, 20 Feb 2023 07:06:12 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 7D71940691 for ; Mon, 20 Feb 2023 07:06:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676873170; x=1708409170; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=wJFDS5XXDsLIgj7qmKaSPDR89CXCSWj0utBHxTZrS1w=; b=kX/gIATJzF3IiSi8jvt3O56BJIASVjG3+IvZipt41fPrgbOsNNDbrmpJ 142Z44ccve4aUNVG1VAIpzL9PixJ35OsFPleT79HfbHu/qaRtulHVtBdx GEkKtD4axotmD5Mewz9K0Q4MDyfD3BZY/mc+3JwFvVBxBtClSMLfkaTy/ 1W9Yy5m+igptOr+gsl+HR6BZ15rQSDp0Qj/6+h4777As+5+aQayFqlddK N0F/vOLib/M/DcytHHGFXEpXO/abhHeIxwOQssHLTiA1XyLMFy6BDhZeS s98K+NcFMt03GcuC0DaBDcufV2MTmUxO7rgLTI3YqJznOvDzgsqEbI+Wu g==; X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="418552126" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="418552126" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2023 22:06:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="780525013" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="780525013" Received: from txandevlnx321.an.intel.com ([10.123.117.43]) by fmsmga002.fm.intel.com with ESMTP; 19 Feb 2023 22:06:09 -0800 From: Ashok Kaladi To: s.v.naga.harish.k@intel.com Cc: stable@dpdk.org Subject: [PATCH 1/2] eventdev: fix race condition in fast-path set function Date: Mon, 20 Feb 2023 00:06:04 -0600 Message-Id: <20230220060605.1267215-1-ashok.k.kaladi@intel.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 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 If eventdev enqueue or dequeue function is called during event_dev_fp_ops_set(), it may get pre-empted after setting the function pointers, but before setting the pointer to port data. In this case the newly registered enqueue/dequeue function will use dummy port data and end up in seg fault. This patch moves the updation of data element to the beginning of event_dev_fp_ops_set() function. Fixes: d35e61322de5 ("eventdev: move inline APIs into separate structure") Cc: stable@dpdk.org Signed-off-by: Ashok Kaladi diff --git a/.mailmap b/.mailmap index 5015494210..bbf6744278 100644 --- a/.mailmap +++ b/.mailmap @@ -132,6 +132,7 @@ Ashish Jain Ashish Paul Ashish Sadanandan Ashish Shah +Ashok Kaladi Ashwin Sekhar T K Asim Jamshed Aviad Yehezkel diff --git a/lib/eventdev/eventdev_private.c b/lib/eventdev/eventdev_private.c index 1d3d9d357e..539aade780 100644 --- a/lib/eventdev/eventdev_private.c +++ b/lib/eventdev/eventdev_private.c @@ -107,6 +107,7 @@ void event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, const struct rte_eventdev *dev) { + fp_op->data = dev->data->ports; fp_op->enqueue = dev->enqueue; fp_op->enqueue_burst = dev->enqueue_burst; fp_op->enqueue_new_burst = dev->enqueue_new_burst; @@ -117,5 +118,4 @@ event_dev_fp_ops_set(struct rte_event_fp_ops *fp_op, fp_op->txa_enqueue = dev->txa_enqueue; fp_op->txa_enqueue_same_dest = dev->txa_enqueue_same_dest; fp_op->ca_enqueue = dev->ca_enqueue; - fp_op->data = dev->data->ports; } -- 2.25.1