mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
cxl/port: Fix NULL pointer access in devm_cxl_add_port()
commita70fc4ed20upstream. In devm_cxl_add_port() the port creation may fail and its associated pointer does not contain a valid address. During error message generation this invalid port address is used. Fix that wrong address access. Fixes:f3cd264c4e("cxl: Unify debug messages when calling devm_cxl_add_port()") Signed-off-by: Robert Richter <rrichter@amd.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20230519215436.3394532-1-rrichter@amd.com Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c88cfbb18a
commit
9e1e0887ea
@@ -717,11 +717,10 @@ struct cxl_port *devm_cxl_add_port(struct device *host, struct device *uport,
|
|||||||
|
|
||||||
parent_port = parent_dport ? parent_dport->port : NULL;
|
parent_port = parent_dport ? parent_dport->port : NULL;
|
||||||
if (IS_ERR(port)) {
|
if (IS_ERR(port)) {
|
||||||
dev_dbg(uport, "Failed to add %s%s%s%s: %ld\n",
|
dev_dbg(uport, "Failed to add%s%s%s: %ld\n",
|
||||||
dev_name(&port->dev),
|
parent_port ? " port to " : "",
|
||||||
parent_port ? " to " : "",
|
|
||||||
parent_port ? dev_name(&parent_port->dev) : "",
|
parent_port ? dev_name(&parent_port->dev) : "",
|
||||||
parent_port ? "" : " (root port)",
|
parent_port ? "" : " root port",
|
||||||
PTR_ERR(port));
|
PTR_ERR(port));
|
||||||
} else {
|
} else {
|
||||||
dev_dbg(uport, "%s added%s%s%s\n",
|
dev_dbg(uport, "%s added%s%s%s\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user