Skip to content

Commit 84688b6

Browse files
liming011gregkh
authored andcommitted
cxl/pci: Check memdev driver binding status in cxl_reset_done()
[ Upstream commit e8069c6 ] cxl_reset_done() accesses the endpoint of the corresponding CXL memdev without endpoint validity checking. By default, cxlmd->endpoint is initialized to -ENXIO, if cxl_reset_done() is triggered after the corresponding CXL memdev probing failed, this results in access to an invalid endpoint. CXL subsystem can always check CXL memdev driver binding status to confirm its endpoint validity. So adding the CXL memdev driver checking inside cxl_reset_done() to avoid accessing an invalid endpoint. Fixes: 934edcd ("cxl: Add post-reset warning if reset results in loss of previously committed HDM decoders") Reviewed-by: Dan Williams <dan.j.williams@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Li Ming <ming.li@zohomail.com> Link: https://patch.msgid.link/20260314-fix_access_endpoint_without_drv_check-v2-4-4c09edf2e1db@zohomail.com Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5a282a6 commit 84688b6

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/cxl/pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,6 +1104,9 @@ static void cxl_reset_done(struct pci_dev *pdev)
11041104
* that no longer exists.
11051105
*/
11061106
guard(device)(&cxlmd->dev);
1107+
if (!cxlmd->dev.driver)
1108+
return;
1109+
11071110
if (cxlmd->endpoint &&
11081111
cxl_endpoint_decoder_reset_detected(cxlmd->endpoint)) {
11091112
dev_crit(dev, "SBR happened without memory regions removal.\n");

0 commit comments

Comments
 (0)