mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Liang He <windhl@126.com>
To: linux-kernel@vger.kernel.org
Cc: Liang He <windhl@126.com>
Subject: [PATCH] firmware: Fix refcount leak bug in trusted_foundation
Date: Fri, 17 Jun 2022 21:35:53 +0800	[thread overview]
Message-ID: <20220617133553.4049515-1-windhl@126.com> (raw)

In of_register_trusted_foundations(), of_find_compatible_node() will
return a node pointer with refcount incremented. We should use
of_node_put() when it is not used anymore.

Signed-off-by: Liang He <windhl@126.com>
---
 drivers/firmware/trusted_foundations.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/trusted_foundations.c b/drivers/firmware/trusted_foundations.c
index 1389fa9418a7..74ef947f5547 100644
--- a/drivers/firmware/trusted_foundations.c
+++ b/drivers/firmware/trusted_foundations.c
@@ -173,6 +173,7 @@ void of_register_trusted_foundations(void)
 		panic("Trusted Foundation: missing version-major property\n");
 	err = of_property_read_u32(node, "tlm,version-minor",
 				   &pdata.version_minor);
+	of_node_put(node);
 	if (err != 0)
 		panic("Trusted Foundation: missing version-minor property\n");
 	register_trusted_foundations(&pdata);
-- 
2.25.1


                 reply	other threads:[~2022-06-17 13:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220617133553.4049515-1-windhl@126.com \
    --to=windhl@126.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®