* [PATCH] sbus: char: Fix refcount leak bug in openrom.c
@ 2022-06-18 7:37 Liang He
0 siblings, 0 replies; only message in thread
From: Liang He @ 2022-06-18 7:37 UTC (permalink / raw)
To: davem; +Cc: windhl, sparclinux, linux-kernel
In opiocgetnext(), we need a of_node_put() to keep refcount balance
for device_node pointer returned by of_find_node_by_phandle() or
of_find_node_by_path().
Signed-off-by: Liang He <windhl@126.com>
---
drivers/sbus/char/openprom.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 30b9751aad30..701978db0f0f 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -518,6 +518,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
}
if (dp)
nd = dp->phandle;
+ of_node_put(dp);
if (copy_to_user(argp, &nd, sizeof(phandle)))
return -EFAULT;
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-18 7:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-18 7:37 [PATCH] sbus: char: Fix refcount leak bug in openrom.c Liang He
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®