* [PATCH] ipmi:ipmb: Fix refcount leak in ipmi_ipmb_probe
@ 2022-05-12 4:44 Miaoqian Lin
2022-05-12 14:52 ` Corey Minyard
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-05-12 4:44 UTC (permalink / raw)
To: Corey Minyard, openipmi-developer, linux-kernel; +Cc: linmq006
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.
Fixes: 00d93611f002 ("ipmi:ipmb: Add the ability to have a separate slave and master device")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/char/ipmi/ipmi_ipmb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
index b81b862532fb..a8bfe0ade082 100644
--- a/drivers/char/ipmi/ipmi_ipmb.c
+++ b/drivers/char/ipmi/ipmi_ipmb.c
@@ -476,6 +476,7 @@ static int ipmi_ipmb_probe(struct i2c_client *client,
slave_np = of_parse_phandle(dev->of_node, "slave-dev", 0);
if (slave_np) {
slave_adap = of_get_i2c_adapter_by_node(slave_np);
+ of_node_put(slave_np);
if (!slave_adap) {
dev_notice(&client->dev,
"Could not find slave adapter\n");
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipmi:ipmb: Fix refcount leak in ipmi_ipmb_probe
2022-05-12 4:44 [PATCH] ipmi:ipmb: Fix refcount leak in ipmi_ipmb_probe Miaoqian Lin
@ 2022-05-12 14:52 ` Corey Minyard
0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2022-05-12 14:52 UTC (permalink / raw)
To: Miaoqian Lin; +Cc: openipmi-developer, linux-kernel
On Thu, May 12, 2022 at 08:44:45AM +0400, Miaoqian Lin wrote:
> of_parse_phandle() returns a node pointer with refcount
> incremented, we should use of_node_put() on it when done.
> Add missing of_node_put() to avoid refcount leak.
Thanks, applied and backport requested for 5.17.
-corey
>
> Fixes: 00d93611f002 ("ipmi:ipmb: Add the ability to have a separate slave and master device")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/char/ipmi/ipmi_ipmb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/char/ipmi/ipmi_ipmb.c b/drivers/char/ipmi/ipmi_ipmb.c
> index b81b862532fb..a8bfe0ade082 100644
> --- a/drivers/char/ipmi/ipmi_ipmb.c
> +++ b/drivers/char/ipmi/ipmi_ipmb.c
> @@ -476,6 +476,7 @@ static int ipmi_ipmb_probe(struct i2c_client *client,
> slave_np = of_parse_phandle(dev->of_node, "slave-dev", 0);
> if (slave_np) {
> slave_adap = of_get_i2c_adapter_by_node(slave_np);
> + of_node_put(slave_np);
> if (!slave_adap) {
> dev_notice(&client->dev,
> "Could not find slave adapter\n");
> --
> 2.25.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-12 14:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12 4:44 [PATCH] ipmi:ipmb: Fix refcount leak in ipmi_ipmb_probe Miaoqian Lin
2022-05-12 14:52 ` Corey Minyard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).