Commit ed45d380 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge branch 'net-mana-fix-debugfs-directory-naming-and-file-lifecycle'

Erni Sri Satya Vennela says:

====================
net: mana: Fix debugfs directory naming and file lifecycle

This series fixes two pre-existing debugfs issues in the MANA driver.

Patch 1 fixes the per-device debugfs directory naming to use the unique
PCI BDF address via pci_name(), avoiding a potential NULL pointer
dereference when pdev->slot is NULL (e.g. VFIO passthrough, nested KVM)
and preventing name collisions across multiple PFs or VFs.

Patch 2 moves the current_speed debugfs file creation from
mana_probe_port() to mana_init_port() so it survives detach/attach
cycles triggered by MTU changes or XDP program changes.
====================

Link: https://patch.msgid.link/20260408081224.302308-1-ernis@linux.microsoft.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 2b5dd463 3b7c7fc9
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -2007,10 +2007,7 @@ 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),
	gc->mana_pci_debugfs = debugfs_create_dir(pci_name(pdev),
						  mana_debugfs_root);

	err = mana_gd_setup(pdev);
+2 −2
Original line number Diff line number Diff line
@@ -3117,6 +3117,8 @@ static int mana_init_port(struct net_device *ndev)
	eth_hw_addr_set(ndev, apc->mac_addr);
	sprintf(vport, "vport%d", port_idx);
	apc->mana_port_debugfs = debugfs_create_dir(vport, gc->mana_pci_debugfs);
	debugfs_create_u32("current_speed", 0400, apc->mana_port_debugfs,
			   &apc->speed);
	return 0;

reset_apc:
@@ -3393,8 +3395,6 @@ static int mana_probe_port(struct mana_context *ac, int port_idx,

	netif_carrier_on(ndev);

	debugfs_create_u32("current_speed", 0400, apc->mana_port_debugfs, &apc->speed);

	return 0;

free_indir: