mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 13:16:22 +00:00
coresight: Fix ref leak when of_coresight_parse_endpoint() fails
[ Upstream commit7fcb9cb2fe
] of_graph_get_next_endpoint() releases the reference to the previous endpoint on each iteration, but when parsing fails the loop exits early meaning the last reference is never dropped. Fix it by dropping the refcount in the exit condition. Fixes:d375b356e6
("coresight: Fix support for sparsely populated ports") Signed-off-by: James Clark <james.clark@arm.com> Reported-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Link: https://lore.kernel.org/r/20240529133626.90080-1-james.clark@arm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
d2f2b6160a
commit
147db31ab7
@ -323,8 +323,10 @@ static int of_get_coresight_platform_data(struct device *dev,
|
||||
continue;
|
||||
|
||||
ret = of_coresight_parse_endpoint(dev, ep, pdata);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(ep);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user