Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ipmi:ipmb: Fix refcount leak in ipmi_ipmb_probe

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>
Message-Id: <20220512044445.3102-1-linmq006@gmail.com>
Cc: stable@vger.kernel.org # v5.17+
Signed-off-by: Corey Minyard <cminyard@mvista.com>

authored by

Miaoqian Lin and committed by
Corey Minyard
a508e339 5396ccbd

+1
+1
drivers/char/ipmi/ipmi_ipmb.c
··· 475 475 slave_np = of_parse_phandle(dev->of_node, "slave-dev", 0); 476 476 if (slave_np) { 477 477 slave_adap = of_get_i2c_adapter_by_node(slave_np); 478 + of_node_put(slave_np); 478 479 if (!slave_adap) { 479 480 dev_notice(&client->dev, 480 481 "Could not find slave adapter\n");