From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 47FC639D6E9; Wed, 8 Apr 2026 08:12:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775635949; cv=none; b=R8QRWqDbb8nBJFzCcaI6QAOB73q4WXIz8c61uTYB1BOwgKePl0xCNsBBcJSRAME3EOIbHZRw1Kw07lnLYwGa2s0UZeQ80uV6RCzMe9wviVqtbGprAmgApkpZ+TTJ6dBw5bb2vY7oO4KNZ98GsxhJ93ln8smIBwGq7s669sXarqg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775635949; c=relaxed/simple; bh=ukuIH6/yRrRaqtvXzkm4s1U+ttO2kW1bymh8uMuEnoY=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JM/xqfeSzefMafgCbG5dqG1qKS58mNtj9AUQY+6wLZ/NZ9gMkt5ka1Fwt+KASBwfFsEKaOL0DZCvTmGQVDsM+NxCYsbAQnnw0u5PVs7t7l4NcCuVSoCh2DC30J4LqFOL2KkS4zAN9mro05UyOKqLnGi0pXtY/zMB5bwsy1m38hE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=j0SwygoA; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="j0SwygoA" Received: by linux.microsoft.com (Postfix, from userid 1173) id 154B920B703B; Wed, 8 Apr 2026 01:12:28 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 154B920B703B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1775635948; bh=NGAZX83mASiUTiFGtErPASD/16BV2K4lhQwv6T4vFUg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=j0SwygoASwg0BEx/lxZiT5VaPUsxmNDbYYR5d6MUDRVDs9v7vvIS9WuRoTE9TQukv Z68H/p/Te00d7gJ3OH31gxQoEMQVcUkWgLo/WP8VvJvzYidAQTRGVeAUuQY79dRfpZ Gzr6sHtzzb64eKufLDujafyGm0VCAKehk8BZy3HE= From: Erni Sri Satya Vennela To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, longli@microsoft.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ernis@linux.microsoft.com, ssengar@linux.microsoft.com, dipayanroy@linux.microsoft.com, gargaditya@linux.microsoft.com, shradhagupta@linux.microsoft.com, kees@kernel.org, kotaranov@microsoft.com, yury.norov@gmail.com, linux-hyperv@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net 1/2] net: mana: Use pci_name() for debugfs directory naming Date: Wed, 8 Apr 2026 01:12:19 -0700 Message-ID: <20260408081224.302308-2-ernis@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260408081224.302308-1-ernis@linux.microsoft.com> References: <20260408081224.302308-1-ernis@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use pci_name(pdev) for the per-device debugfs directory instead of hardcoded "0" for PFs and pci_slot_name(pdev->slot) for VFs. The previous approach had two issues: 1. pci_slot_name() dereferences pdev->slot, which can be NULL for VFs in environments like generic VFIO passthrough or nested KVM, causing a NULL pointer dereference. 2. Multiple PFs would all use "0", and VFs across different PCI domains or buses could share the same slot name, leading to -EEXIST errors from debugfs_create_dir(). pci_name(pdev) returns the unique BDF address, is always valid, and is unique across the system. Fixes: 6607c17c6c5e ("net: mana: Enable debugfs files for MANA device") Signed-off-by: Erni Sri Satya Vennela --- drivers/net/ethernet/microsoft/mana/gdma_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c b/drivers/net/ethernet/microsoft/mana/gdma_main.c index 43741cd35af8..098fbda0d128 100644 --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c @@ -2065,11 +2065,8 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent) gc->dev = &pdev->dev; xa_init(&gc->irq_contexts); - if (gc->is_pf) - gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root); - else - gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot), - mana_debugfs_root); + gc->mana_pci_debugfs = debugfs_create_dir(pci_name(pdev), + mana_debugfs_root); err = mana_gd_setup(pdev); if (err) -- 2.34.1