Patch "coresight: Fix ref leak when of_coresight_parse_endpoint() fails" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    coresight: Fix ref leak when of_coresight_parse_endpoint() fails

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     coresight-fix-ref-leak-when-of_coresight_parse_endpo.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7bc22d5cf0f4f6d7767ec1a80fdda5804aa2fd2c
Author: James Clark <james.clark@xxxxxxx>
Date:   Wed May 29 14:36:26 2024 +0100

    coresight: Fix ref leak when of_coresight_parse_endpoint() fails
    
    [ Upstream commit 7fcb9cb2fe47294e16067c3cfd25332c8662a115 ]
    
    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@xxxxxxx>
    Reported-by: Laurent Pinchart <laurent.pinchart+renesas@xxxxxxxxxxxxxxxx>
    Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
    Signed-off-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
    Link: https://lore.kernel.org/r/20240529133626.90080-1-james.clark@xxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index c594f45319fc5..dfb8022c4da1a 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -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;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux