linux-stable/drivers/cxl
Jonathan Cameron 3409427ab8 cxl: Fix cleanup of port devices on failure to probe driver.
commit db9a3a35d3 upstream.

The device is created, and then there is a check if a driver succesfully
bound to it. In event of failing the bind (e.g. failure in cxl_port_probe())
the device is left registered. When a bus rescan later occurs, fresh
devices are created leading to a multiple device representing the same
underlying hardware. Bad things may follow and at very least we have far too many
devices.

Fix by ensuring autoremove is registered if the device create succeeds,
but doesn't depend on sucessful binding to a driver.

Bug was observed as side effect of incorrect ownership in
[PATCH v9 6/9] cxl/port: Read CDAT table
but will result from any failure to in cxl_port_probe().

Fixes: 8dd2bc0f8e ("cxl/mem: Add the cxl_mem driver")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20220609134519.11668-1-Jonathan.Cameron@huawei.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-12 16:42:16 +02:00
..
core cxl/core/port: Fix NULL but dereferenced coccicheck error 2022-03-22 10:51:17 -07:00
acpi.c cxl/core/port: Fix / relax decoder target enumeration 2022-02-08 23:15:10 -08:00
cxl.h cxl/core/port: Add endpoint decoders 2022-02-08 22:57:32 -08:00
cxlmem.h cxl/mbox: Use __le32 in get,set_lsa mailbox structures 2022-07-12 16:42:15 +02:00
cxlpci.h cxl/pci: Retrieve CXL DVSEC memory info 2022-02-08 22:57:31 -08:00
Kconfig cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
Makefile cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
mem.c cxl: Fix cleanup of port devices on failure to probe driver. 2022-07-12 16:42:16 +02:00
pci.c cxl/pci: Make cxl_dvsec_ranges() failure not fatal to cxl_pci 2022-06-09 10:30:23 +02:00
pmem.c cxl/mbox: Use __le32 in get,set_lsa mailbox structures 2022-07-12 16:42:15 +02:00
port.c cxl/core/port: Add endpoint decoders 2022-02-08 22:57:32 -08:00