Thread (6 messages) 6 messages, 5 authors, 2022-11-30

Re: [PATCH] cxl: Fix refcount leak in cxl_calc_capp_routing

From: Frederic Barrat <hidden>
Date: 2022-06-07 09:05:52
Also in: lkml


On 05/06/2022 08:00, Miaoqian Lin wrote:
of_get_next_parent() returns a node pointer with refcount incremented,
we should use of_node_put() on it when not need anymore.
This function only calls of_node_put() in normal path,
missing it in the error path.
Add missing of_node_put() to avoid refcount leak.

Fixes: f24be42aab37 ("cxl: Add psl9 specific code")
Signed-off-by: Miaoqian Lin <redacted>

Indeed. Thanks!
Acked-by: Frederic Barrat <redacted>

   Fred

quoted hunk ↗ jump to hunk
---
  drivers/misc/cxl/pci.c | 1 +
  1 file changed, 1 insertion(+)
diff --git a/drivers/misc/cxl/pci.c b/drivers/misc/cxl/pci.c
index 3de0aea62ade..62385a529d86 100644
--- a/drivers/misc/cxl/pci.c
+++ b/drivers/misc/cxl/pci.c
@@ -387,6 +387,7 @@ int cxl_calc_capp_routing(struct pci_dev *dev, u64 *chipid,
  	rc = get_phb_index(np, phb_index);
  	if (rc) {
  		pr_err("cxl: invalid phb index\n");
+		of_node_put(np);
  		return rc;
  	}
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help