OSDN Git Service

ath11k: add missing of_node_put() to avoid leak
authorYang Yingliang <yangyingliang@huawei.com>
Mon, 10 Jan 2022 14:24:13 +0000 (16:24 +0200)
committerKalle Valo <quic_kvalo@quicinc.com>
Tue, 11 Jan 2022 14:27:37 +0000 (16:27 +0200)
The node pointer is returned by of_find_node_by_type()
or of_parse_phandle() with refcount incremented. Calling
of_node_put() to aovid the refcount leak.

Fixes: 6ac04bdc5edb ("ath11k: Use reserved host DDR addresses from DT for PCI devices")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20211221114003.335557-1-yangyingliang@huawei.com
drivers/net/wireless/ath/ath11k/mhi.c
drivers/net/wireless/ath/ath11k/qmi.c

index e4250ba..cccaa34 100644 (file)
@@ -332,6 +332,7 @@ static int ath11k_mhi_read_addr_from_dt(struct mhi_controller *mhi_ctrl)
                return -ENOENT;
 
        ret = of_address_to_resource(np, 0, &res);
+       of_node_put(np);
        if (ret)
                return ret;
 
index 65d3c6b..42c2ad3 100644 (file)
@@ -1936,6 +1936,7 @@ static int ath11k_qmi_assign_target_mem_chunk(struct ath11k_base *ab)
                        }
 
                        ret = of_address_to_resource(hremote_node, 0, &res);
+                       of_node_put(hremote_node);
                        if (ret) {
                                ath11k_dbg(ab, ATH11K_DBG_QMI,
                                           "qmi fail to get reg from hremote\n");