Skip to contentSkip to conversation

sbus: char: Fix refcount leak bug in openrom.c

PATCH Superseded Liang He 1 participant 1 message Jun 18, 2022 SPARC + UltraSPARC (sparc/sparc64)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Liang He

author
#0 lore raw

PATCH 1/1 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().

---
 drivers/sbus/char/openprom.c | 1 +
 1 file changed, 1 insertion(+)
drivers/sbus/char/openprom.c +1 -0
index 30b9751aad30..701978db0f0f 100644
@@ -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;
 
Signature · 1 line
2.25.1