mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
Merge branch 'for-7.3/cxl-fixes' into cxl-for-next
cxl/region: Use __free(put_device) in find_pos_and_ways() cxl/region: Fix use-after-free in find_pos_and_ways() error path
This commit is contained in:
commit
f0986e9e60
|
|
@ -1914,15 +1914,14 @@ static int find_pos_and_ways(struct cxl_port *port, struct range *range,
|
|||
{
|
||||
struct cxl_switch_decoder *cxlsd;
|
||||
struct cxl_port *parent;
|
||||
struct device *dev;
|
||||
int rc = -ENXIO;
|
||||
|
||||
parent = parent_port_of(port);
|
||||
if (!parent)
|
||||
return rc;
|
||||
|
||||
dev = device_find_child(&parent->dev, range,
|
||||
match_switch_decoder_by_range);
|
||||
struct device *dev __free(put_device) =
|
||||
device_find_child(&parent->dev, range, match_switch_decoder_by_range);
|
||||
if (!dev) {
|
||||
dev_err(port->uport_dev,
|
||||
"failed to find decoder mapping %#llx-%#llx\n",
|
||||
|
|
@ -1939,14 +1938,11 @@ static int find_pos_and_ways(struct cxl_port *port, struct range *range,
|
|||
break;
|
||||
}
|
||||
}
|
||||
put_device(dev);
|
||||
|
||||
if (rc)
|
||||
dev_err(port->uport_dev,
|
||||
"failed to find %s:%s in target list of %s\n",
|
||||
dev_name(&port->dev),
|
||||
dev_name(port->parent_dport->dport_dev),
|
||||
dev_name(&cxlsd->cxld.dev));
|
||||
dev_name(port->parent_dport->dport_dev), dev_name(dev));
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user