Skip to content

Commit 7fcb9cb

Browse files
James-A-ClarkSuzuki K Poulose
authored andcommitted
coresight: Fix ref leak when of_coresight_parse_endpoint() fails
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: d375b35 ("coresight: Fix support for sparsely populated ports") Signed-off-by: James Clark <[email protected]> Reported-by: Laurent Pinchart <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c3f38fa commit 7fcb9cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/hwtracing/coresight/coresight-platform.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ static int of_get_coresight_platform_data(struct device *dev,
297297
continue;
298298

299299
ret = of_coresight_parse_endpoint(dev, ep, pdata);
300-
if (ret)
300+
if (ret) {
301+
of_node_put(ep);
301302
return ret;
303+
}
302304
}
303305

304306
return 0;

0 commit comments

Comments
 (0)