From: cgel.zte@gmail.com
To: joro@8bytes.org
Cc: will@kernel.org, iommu@lists.linux-foundation.org,
linux-kernel@vger.kernel.org,
Minghao Chi <chi.minghao@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH] iommu/ipmmu-vmsa: Avoid leak OF node on error
Date: Mon, 23 May 2022 11:11:45 +0000 [thread overview]
Message-ID: <20220523111145.2976-1-chi.minghao@zte.com.cn> (raw)
From: Minghao Chi <chi.minghao@zte.com.cn>
The OF node should be put before returning error in ipmmu_init(),
otherwise node's refcount will be leaked.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
drivers/iommu/ipmmu-vmsa.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c
index 8fdb84b3642b..f6440b106f46 100644
--- a/drivers/iommu/ipmmu-vmsa.c
+++ b/drivers/iommu/ipmmu-vmsa.c
@@ -1179,11 +1179,10 @@ static int __init ipmmu_init(void)
return 0;
np = of_find_matching_node(NULL, ipmmu_of_ids);
+ of_node_put(np);
if (!np)
return 0;
- of_node_put(np);
-
ret = platform_driver_register(&ipmmu_driver);
if (ret < 0)
return ret;
--
2.25.1
next reply other threads:[~2022-05-23 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-23 11:11 cgel.zte [this message]
2022-05-23 11:54 ` [PATCH] iommu/ipmmu-vmsa: Avoid leak OF node on error Johan Hovold
2022-05-23 13:10 ` Robin Murphy
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=20220523111145.2976-1-chi.minghao@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=chi.minghao@zte.com.cn \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=will@kernel.org \
--cc=zealci@zte.com.cn \
/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