History

cxl: Add missing return to cdat read error path

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

Dave Jiang committed 3 years ago

Commit 764d1021 parent 270205b1 file · +1 −0Browse files

Unified · Split

drivers/cxl/core/pci.c+1−0
@@ -571,6 +571,7 @@ void read_cdat_data(struct cxl_port *port) · 570 unmodified lines
571 /* Don't leave table data allocated on error */571 /* Don't leave table data allocated on error */
572 devm_kfree(dev, cdat_table);572 devm_kfree(dev, cdat_table);
573 dev_err(dev, "CDAT data read error\n");573 dev_err(dev, "CDAT data read error\n");
574 return;
574 }575 }
575 576
576 port->cdat.table = cdat_table + sizeof(__le32);577 port->cdat.table = cdat_table + sizeof(__le32);