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 5668D43CB3 for ; Thu, 14 Mar 2024 10:54:41 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2358E42E7E; Thu, 14 Mar 2024 10:54:39 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by mails.dpdk.org (Postfix) with ESMTP id C118342E41; Thu, 14 Mar 2024 10:54:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710410077; x=1741946077; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4bdO8xet3X+hWNwGP2f+QsQ4X3+CWxzsnW5SvbU6ADk=; b=aB1h8jCLnvztxJGIAuWmpNND25iFOPzUGyI+KkxaHHQPwkA0ojZx3tcx 4DOWXPeYDCoPnpDZ0JaNY4veObmQr3xyNHImNUykDKAzzA/oQsLCZ+Pi+ 7y8xpfS1b9uQneJV1klpsj2S0ddBF9Y1STRS/u32lCJFUcVmTumWhhgzq Zttp90xdqD8FK+7wIVFJZVwxXvWFN+w/K3I6qfkDmY1BQuCcWRPmUI4gG oy7paazb4lZwGFIjTzaPlOo5eRlAhISqVNPRXlV7qioT8hEbP97mcX3YM 05wbkVYD/pH+L6sXjfGZG8FhRS1AsFD/gEFDbEpjz9EXSeXqf5XRF1uxt w==; X-IronPort-AV: E=McAfee;i="6600,9927,11012"; a="5339886" X-IronPort-AV: E=Sophos;i="6.07,125,1708416000"; d="scan'208";a="5339886" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 02:54:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,125,1708416000"; d="scan'208";a="12125211" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 02:54:35 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , stable@dpdk.org Subject: [PATCH 2/3] bus/vdev: revert fix devargs after multi-process bus scan Date: Thu, 14 Mar 2024 09:36:29 +0000 Message-Id: <20240314093630.1066948-3-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240314093630.1066948-1-mingjinx.ye@intel.com> References: <20240314093630.1066948-1-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 The asan tool detected a memory leak in the vdev driver alloc_devargs. The previous commit does not insert device arguments into devargs_list when attaching a device during a bus scan of a secondary process. This resulted in an existing memory leak when removing a vdev device, since rte_devargs_remove actually does nothing. Therefore the following commit was reverted accordingly. Fixes: f5b2eff0847d ("bus/vdev: fix devargs after multi-process bus scan") Restoring this commit will fix the memory leak. There was an issue with device parameters using free devargs when inserting a vdev device when devargs_list already existed, resulting in a core dump. A new patch will fix this issue. Fixes: f5b2eff0847d ("bus/vdev: fix devargs after multi-process bus scan") Cc: stable@dpdk.org Signed-off-by: Mingjin Ye --- drivers/bus/vdev/vdev.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index 38d05a9fe9..1a6cc7d12d 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -264,9 +264,7 @@ alloc_devargs(const char *name, const char *args) } static int -insert_vdev(const char *name, const char *args, - struct rte_vdev_device **p_dev, - bool init) +insert_vdev(const char *name, const char *args, struct rte_vdev_device **p_dev) { struct rte_vdev_device *dev; struct rte_devargs *devargs; @@ -300,8 +298,7 @@ insert_vdev(const char *name, const char *args, goto fail; } - if (init) - rte_devargs_insert(&devargs); + rte_devargs_insert(&devargs); dev->device.devargs = devargs; TAILQ_INSERT_TAIL(&vdev_device_list, dev, next); @@ -323,7 +320,7 @@ rte_vdev_init(const char *name, const char *args) int ret; rte_spinlock_recursive_lock(&vdev_device_list_lock); - ret = insert_vdev(name, args, &dev, true); + ret = insert_vdev(name, args, &dev); if (ret == 0) { ret = vdev_probe_all_drivers(dev); if (ret) { @@ -449,7 +446,7 @@ vdev_action(const struct rte_mp_msg *mp_msg, const void *peer) break; case VDEV_SCAN_ONE: VDEV_LOG(INFO, "receive vdev, %s", in->name); - ret = insert_vdev(in->name, NULL, NULL, false); + ret = insert_vdev(in->name, NULL, NULL); if (ret == -EEXIST) VDEV_LOG(DEBUG, "device already exist, %s", in->name); else if (ret < 0) -- 2.25.1