lkml.org 
[lkml]   [2022]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86/devicetree: Fix refcount leak in dtb_lapic_setup
Date
From: Lv Ruyi <lv.ruyi@zte.com.cn>

If dn is true that meas the of_find_compatible_node function
successfully returns a node pointer with refcount incremented,
use of_node_put() on it when done.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
arch/x86/kernel/devicetree.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c
index 5cd51f25f446..6498825cf48d 100644
--- a/arch/x86/kernel/devicetree.c
+++ b/arch/x86/kernel/devicetree.c
@@ -156,6 +156,7 @@ static void __init dtb_lapic_setup(void)
dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-lapic");
if (dn) {
ret = of_address_to_resource(dn, 0, &r);
+ of_node_put(dn);
if (WARN_ON(ret))
return;
lapic_addr = r.start;
--
2.25.1
\
 
 \ /
  Last update: 2022-04-02 10:47    [W:0.075 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site