Bug 215515
Summary: | sysfs: cannot create duplicate filename '.../0000:e0' | ||
---|---|---|---|
Product: | Drivers | Reporter: | Bjorn Helgaas (bjorn) |
Component: | PCI | Assignee: | drivers_pci (drivers_pci) |
Status: | NEW --- | ||
Severity: | normal | CC: | decui, khalasa, korneliuszo |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | 5.14 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Linux v5.16 kernel log
Debug patch used to generate the kernel log Linux v5.16 .config file serial console log of a VM crash on Azure. |
Description
Bjorn Helgaas
2022-01-21 16:54:05 UTC
Created attachment 300462 [details]
Linux v5.16 kernel log
Attaching the kernel log from Gateworks Ventana SBC, v5.16 with only a small debug patch applied.
Created attachment 300463 [details]
Debug patch used to generate the kernel log
Created attachment 300464 [details]
Linux v5.16 .config file
On 5.17.1 problem still exists. I've probably fixed this in: https://github.com/korneliuszo/linux/commit/167139e40c43befecfa7cacd6b6c3fcf6f5a2a48 If you consider this patch worthy, on which mailing list should I add it? Thanks for your work! Please send the patch to the following addresses: $ ./scripts/get_maintainer.pl drivers/pci/pci-sysfs.c Bjorn Helgaas <bhelgaas@google.com> (supporter:PCI SUBSYSTEM) linux-pci@vger.kernel.org (open list:PCI SUBSYSTEM) linux-kernel@vger.kernel.org (open list) Also see the hints here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst I think I'm still seeing the bug with 6.2.0-rc8. The panic log is attached: I got the log with 6.2.0-rc8 + my recent patchset https://lwn.net/ml/linux-kernel/20230328045122.25850-1-decui%40microsoft.com/ I don't think my patchset causes the panic. Created attachment 304067 [details]
serial console log of a VM crash on Azure.
"Linux v5.16 kernel log" shows: [ 0.534071] sysfs: cannot create duplicate filename '/devices/platform/soc/1ffc000.pcie/pci0000:00/0000:00:00.0/resource0' My log (serial console log of a VM crash on Azure) shows: [ 21.364685] sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/29c2dd7f-fe78-4c21-9c4a-994ca4ffe153/pcife78:00/fe78:00:02.0/resource2' [ 21.370907] sysfs: cannot create duplicate filename '/devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0004:00/VMBUS:00/4ad09f4b-92b8-49cf-928e-c5884b47a58c/pci92b8:00/92b8:00:02.0/resource2' and the call-traces are pretty similar. In my case, after sysfs_add_bin_file_mode_ns() returns -EEXIST, pci_create_resource_files() -> pci_create_attr() returns -EEXIST, and pci_create_resource_files() -> pci_remove_resource_files() removes the sysfile that's already created and calls kfree(res_attr), i.e. kfree(pdev->res_attr[i]) . pci_bus_add_device() doesn't check the return value of pci_create_sysfs_dev_files(), so this -EEXIST error is ignored. Later, when the PCI device is removed by the host, hv_eject_device_work() -> ... -> pci_remove_resource_files() -> sysfs_remove_bin_file(..., pdev->res_attr[i]) tries to remove the nonexistent sysfile, and triggers a NULL dereference in kernfs_remove_by_name_ns() -> … > strlen(). (In reply to Korneliusz Osmenda from comment #5) > I've probably fixed this in: > https://github.com/korneliuszo/linux/commit/ > 167139e40c43befecfa7cacd6b6c3fcf6f5a2a48 > > If you consider this patch worthy, on which mailing list should I add it? Looks like the patch is still not in the upstream kernel. Would you please send it? |