Skip to content

Commit

Permalink
cxl: Add missing return to cdat read error path
Browse files Browse the repository at this point in the history
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: 7a877c9 ("cxl/pci: Simplify CDAT retrieval error path")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Link: https://lore.kernel.org/r/168382793506.3510737.4792518576623749076.stgit@djiang5-mobl3
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
Dave Jiang authored and Dan Williams committed May 13, 2023
1 parent 270205b commit 764d102
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/cxl/core/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 764d102

Please sign in to comment.