]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
coresight: Fix ref leak when of_coresight_parse_endpoint() fails
authorJames Clark <james.clark@arm.com>
Wed, 29 May 2024 13:36:26 +0000 (14:36 +0100)
committerSuzuki K Poulose <suzuki.poulose@arm.com>
Fri, 7 Jun 2024 10:30:30 +0000 (11:30 +0100)
commit7fcb9cb2fe47294e16067c3cfd25332c8662a115
tree94fc18a644f391fc0162e99f92d6020c0a270980
parentc3f38fa61af77b49866b006939479069cd451173
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: d375b356e687 ("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
drivers/hwtracing/coresight/coresight-platform.c