linux/drivers/cxl
Dan Williams b5dc5b7de7 cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices()
[ Upstream commit 3d6ebf1643 ]

It turns out since its original introduction, pre-2.6.12,
bus_rescan_devices() has skipped devices that might be in the process of
attaching or detaching from their driver. For CXL this behavior is
unwanted and expects that cxl_bus_rescan() is a probe barrier.

That behavior is simple enough to achieve with bus_for_each_dev() paired
with call to device_attach(), and it is unclear why bus_rescan_devices()
took the position of lockless consumption of dev->driver which is racy.

The "Fixes:" but no "Cc: stable" on this patch reflects that the issue
is merely by inspection since the bug that triggered the discovery of
this potential problem [1] is fixed by other means.  However, a stable
backport should do no harm.

Fixes: 8dd2bc0f8e ("cxl/mem: Add the cxl_mem driver")
Link: http://lore.kernel.org/20241004212504.1246-1-gourry@gourry.net [1]
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://patch.msgid.link/172964781104.81806.4277549800082443769.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2024-11-08 16:26:46 +01:00
..
core cxl/port: Fix cxl_bus_rescan() vs bus_rescan_devices() 2024-11-08 16:26:46 +01:00
acpi.c cxl/acpi: Move rescan to the workqueue 2024-11-08 16:26:46 +01:00
cxl.h cxl/acpi: Move rescan to the workqueue 2024-11-08 16:26:46 +01:00
cxlmem.h cxl/core: Fix incorrect vendor debug UUID define 2024-09-18 19:23:04 +02:00
cxlpci.h cxl: Wait Memory_Info_Valid before access memory related info 2023-05-30 14:03:32 +01:00
Kconfig cxl/region: Allocate HPA capacity to regions 2022-07-25 12:18:06 -07:00
Makefile PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00
mem.c cxl/mem: Move devm_cxl_add_endpoint() from cxl_core to cxl_mem 2023-11-28 17:07:17 +00:00
pci.c cxl/pci: Create PCI DOE mailbox's for memory devices 2022-07-19 15:38:04 -07:00
pmem.c cxl/pmem: Fix nvdimm registration races 2023-03-10 09:34:20 +01:00
port.c cxl/port: Read CDAT table 2022-07-19 15:38:05 -07:00