mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 10:29:37 +00:00
coresight: platform: Fix leaking device reference
We don't drop the reference on the remote device while parsing the connection, held by bus_find_device(). Fix this by duplicating the device name and dropping the reference. Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Kim Phillips <kim.phillips@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a0f9992c80
commit
5111e749c7
1 changed files with 5 additions and 1 deletions
|
@ -162,7 +162,9 @@ static int of_coresight_parse_endpoint(struct device *dev,
|
|||
}
|
||||
|
||||
pdata->outports[i] = endpoint.port;
|
||||
pdata->child_names[i] = dev_name(rdev);
|
||||
pdata->child_names[i] = devm_kstrdup(dev,
|
||||
dev_name(rdev),
|
||||
GFP_KERNEL);
|
||||
pdata->child_ports[i] = rendpoint.id;
|
||||
/* Connection record updated */
|
||||
ret = 1;
|
||||
|
@ -172,6 +174,8 @@ static int of_coresight_parse_endpoint(struct device *dev,
|
|||
of_node_put(rparent);
|
||||
if (rport)
|
||||
of_node_put(rport);
|
||||
if (rdev)
|
||||
put_device(rdev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue