[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241028-fsl_hypervisor-of_node_put-v1-1-dd0621341fb7@gmail.com>
Date: Mon, 28 Oct 2024 18:05:41 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: Arnd Bergmann <arnd@...db.de>, Timur Tabi <timur@...escale.com>,
Kumar Gala <galak@...nel.crashing.org>
Cc: linux-kernel@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>, stable@...r.kernel.org
Subject: [PATCH 1/2] virt: fsl: fix missing of_node_put() on early exit
from for_each_compatible_node()
Early exits from for_each_compatible_node() require explicit calls to
of_node_put() to release the node and avoid leaking the resource. Add
the missing call to of_node_put(np) before the 'goto' instruction that
jumps out of the loop.
Cc: stable@...r.kernel.org
Fixes: 6db7199407ca ("drivers/virt: introduce Freescale hypervisor management driver")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/virt/fsl_hypervisor.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/virt/fsl_hypervisor.c b/drivers/virt/fsl_hypervisor.c
index e92e2ceb12a4..7c7ec13761ba 100644
--- a/drivers/virt/fsl_hypervisor.c
+++ b/drivers/virt/fsl_hypervisor.c
@@ -846,8 +846,10 @@ static int __init fsl_hypervisor_init(void)
}
dbisr = kzalloc(sizeof(*dbisr), GFP_KERNEL);
- if (!dbisr)
+ if (!dbisr) {
+ of_node_put(np);
goto out_of_memory;
+ }
dbisr->irq = irq;
dbisr->doorbell = be32_to_cpup(handle);
--
2.43.0
Powered by blists - more mailing lists