Skip to content

Commit 34dbd7b

Browse files
Erni Sri Satya Vennelagregkh
authored andcommitted
net: mana: Use pci_name() for debugfs directory naming
[ Upstream commit c116f07 ] 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: 6607c17 ("net: mana: Enable debugfs files for MANA device") Signed-off-by: Erni Sri Satya Vennela <ernis@linux.microsoft.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20260408081224.302308-2-ernis@linux.microsoft.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 64daf39 commit 34dbd7b

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/net/ethernet/microsoft/mana/gdma_main.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,11 +1927,8 @@ static int mana_gd_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
19271927
gc->dev = &pdev->dev;
19281928
xa_init(&gc->irq_contexts);
19291929

1930-
if (gc->is_pf)
1931-
gc->mana_pci_debugfs = debugfs_create_dir("0", mana_debugfs_root);
1932-
else
1933-
gc->mana_pci_debugfs = debugfs_create_dir(pci_slot_name(pdev->slot),
1934-
mana_debugfs_root);
1930+
gc->mana_pci_debugfs = debugfs_create_dir(pci_name(pdev),
1931+
mana_debugfs_root);
19351932

19361933
err = mana_gd_setup(pdev);
19371934
if (err)

0 commit comments

Comments
 (0)