projects/linux·commit 764d102e

cxl: Add missing return to cdat read error path

764d102e · Dave Jiang <[email protected]> · 2023-05-13 00:20:06 -07:00

Add a return to the error path when cxl_cdat_read_table() fails. Current
code continues with the table pointer points to freed memory.

Fixes: 7a877c923995 ("cxl/pci: Simplify CDAT retrieval error path")
Signed-off-by: Dave Jiang <[email protected]>
Reviewed-by: Davidlohr Bueso <[email protected]>
Link: https://lore.kernel.org/r/168382793506.3510737.4792518576623749076.stgit@djiang5-mobl3
Signed-off-by: Dan Williams <[email protected]>
Commit
764d102ef94e880ca834a7fe3968a00a05b1fb12
Parents
270205be

Changes

1 files changed · +1 −0

FileStatusAddDelContent
drivers/cxl/core/pci.cmodified+1−0View file

drivers/cxl/core/pci.c

View file
diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index bdbd907..f332fe7 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -571,6 +571,7 @@ void read_cdat_data(struct cxl_port *port)
/* Don't leave table data allocated on error */
devm_kfree(dev, cdat_table);
dev_err(dev, "CDAT data read error\n");
+ return;
}
port->cdat.table = cdat_table + sizeof(__le32);