[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220618073746.4059541-1-windhl@126.com>
Date: Sat, 18 Jun 2022 15:37:46 +0800
From: Liang He <windhl@....com>
To: davem@...emloft.net
Cc: windhl@....com, sparclinux@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] sbus: char: Fix refcount leak bug in openrom.c
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@....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
Powered by blists - more mailing lists