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 5F7EC41CF4 for ; Mon, 20 Feb 2023 07:06:16 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C0EF42F82; Mon, 20 Feb 2023 07:06:16 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 4776540691 for ; Mon, 20 Feb 2023 07:06:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676873175; x=1708409175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BkNZZyLjSfwaVQe0dtb33lYkpf26a0PUfmfA6D420Ps=; b=PN1HCN87q3997TwK0b3SKh3WPOYInTXjJJUV+G5TuOILvQYcDLavm1On lY1oHSjDwCnifcZ2QAc/czo+Pn5ms/G2RNBZa017ZInX6xjw2jOtlD7Rv JFnzD+1E34I14GZRfO1bmm1nPaK1DxkWJFJkBajrfj3oLn4TCyHmbx/G3 t973qpGXs52KhnkULBxysMoEHyK6lKPIRlVzSJMLfe11F9eS5XnK3x/1t Zo+uTsTMD8CD6baO/p1/xNceJHtyZqRYEGUV+D2j8EiNsS4wnfzm2xjGU dUDMCUPt5UQTgHtB4Cmxlgs2bRycwpFAeGebIlNl5aqMb7w1v/15thnDK g==; X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="418552134" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="418552134" 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:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10626"; a="780525029" X-IronPort-AV: E=Sophos;i="5.97,311,1669104000"; d="scan'208";a="780525029" Received: from txandevlnx321.an.intel.com ([10.123.117.43]) by fmsmga002.fm.intel.com with ESMTP; 19 Feb 2023 22:06:14 -0800 From: Ashok Kaladi To: s.v.naga.harish.k@intel.com Cc: stable@dpdk.org Subject: [PATCH 2/2] ethdev: fix race condition in fast-path ops setup Date: Mon, 20 Feb 2023 00:06:05 -0600 Message-Id: <20230220060605.1267215-2-ashok.k.kaladi@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20230220060605.1267215-1-ashok.k.kaladi@intel.com> References: <20230220060605.1267215-1-ashok.k.kaladi@intel.com> 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 ethdev enqueue or dequeue function is called during eth_dev_fp_ops_setup(), 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 each data pointers before updating corresponding function pointers. Fixes: c87d435a4d79 ("ethdev: copy fast-path API into separate structure") Cc: stable@dpdk.org Signed-off-by: Ashok Kaladi diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index 48090c879a..a0232c669f 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -270,17 +270,17 @@ void eth_dev_fp_ops_setup(struct rte_eth_fp_ops *fpo, const struct rte_eth_dev *dev) { + fpo->rxq.data = dev->data->rx_queues; fpo->rx_pkt_burst = dev->rx_pkt_burst; + fpo->txq.data = dev->data->tx_queues; fpo->tx_pkt_burst = dev->tx_pkt_burst; fpo->tx_pkt_prepare = dev->tx_pkt_prepare; fpo->rx_queue_count = dev->rx_queue_count; fpo->rx_descriptor_status = dev->rx_descriptor_status; fpo->tx_descriptor_status = dev->tx_descriptor_status; - fpo->rxq.data = dev->data->rx_queues; fpo->rxq.clbk = (void **)(uintptr_t)dev->post_rx_burst_cbs; - fpo->txq.data = dev->data->tx_queues; fpo->txq.clbk = (void **)(uintptr_t)dev->pre_tx_burst_cbs; } -- 2.25.1