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 6101545628 for ; Tue, 16 Jul 2024 12:16:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A97F242DCE; Tue, 16 Jul 2024 12:16:32 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mails.dpdk.org (Postfix) with ESMTP id 1F486402AD; Tue, 16 Jul 2024 12:16:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721124991; x=1752660991; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=t6neVt5DcP/G5i+9ok/1wBYUneP04HcOeFNpDfRnT9c=; b=LwGv5i24jL2ovqrzPJDqkcrZ15vWDAJ+7FCvmjbk8PFnjOuy0V+/GkIx 1j7Q6lOK87uaAu+hCwYiUrQC2qiV6BEgu4HsiWPPqT0riaxJL+CfYSCR9 MIBcbdvgD2CdqBICJPz1SzKAcXAVYUMjjnOI/ZTsVh5VEKuZsDRoTaNIm AWQreRIbSic7Idj0MO5M34USWAOyVi/CfFUyzl8fsqv2d4KzY7JLVOzCr CEeVkaHXoMvY6K75cYNFCTB2dztNKBacZ8D+e7CQWtGuObp1OCgYsZw+o 8/mQ3eI4P0O++aGDFbu1V2N3VkfMusRaVn2JEAUCxBK4hH466lNMYBvja Q==; X-CSE-ConnectionGUID: 7lSTF/D2QWma055wZPfhug== X-CSE-MsgGUID: ZDHI5fp8SEaibf/CsF/tkA== X-IronPort-AV: E=McAfee;i="6700,10204,11134"; a="41077962" X-IronPort-AV: E=Sophos;i="6.09,211,1716274800"; d="scan'208";a="41077962" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 03:16:26 -0700 X-CSE-ConnectionGUID: 8W4k/L1ER1WXa9K+C4Hz0Q== X-CSE-MsgGUID: 0LR6sYBfQFyeez8NXgh6MA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,211,1716274800"; d="scan'208";a="49885083" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2024 03:16:23 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: anatoly.burakov@intel.com, Mingjin Ye , stable@dpdk.org Subject: [PATCH v2] net/vdev: fix insert vdev core dump Date: Tue, 16 Jul 2024 09:53:28 +0000 Message-Id: <20240716095328.1820597-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240314093630.1066948-4-mingjinx.ye@intel.com> References: <20240314093630.1066948-4-mingjinx.ye@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 In secondary processes, insert_vdev() may be called multiple times on the same device due to multi-process hot-plugging of the vdev bus and EAL parameters to add the same vdev. In this case, when rte_devargs_insert() is called, the devargs->name reference will be invalidated because rte_devargs_insert() destroys the just-allocated devargs and replaces the pointer from the devargs list. As a result, the reference to devargs->name stored in dev->device.name will be invalid. This patch fixes the issue by setting the device name after calling rte_devargs_insert(). Fixes: cdb068f031c6 ("bus/vdev: scan by multi-process channel") Cc: stable@dpdk.org Signed-off-by: Mingjin Ye --- v2: Modify commit log. --- drivers/bus/vdev/vdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 38d05a9fe9..ec7abe7cda 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -288,7 +288,6 @@ insert_vdev(const char *name, const char *args, dev->device.bus = &rte_vdev_bus; dev->device.numa_node = SOCKET_ID_ANY; - dev->device.name = devargs->name; if (find_vdev(name)) { /* @@ -303,6 +302,7 @@ insert_vdev(const char *name, const char *args, if (init) rte_devargs_insert(&devargs); dev->device.devargs = devargs; + dev->device.name = devargs->name; TAILQ_INSERT_TAIL(&vdev_device_list, dev, next); if (p_dev) -- 2.25.1