mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-23 12:58:23 +00:00
40 lines
1.2 KiB
Diff
40 lines
1.2 KiB
Diff
|
From 424e9df466cea3bb39a1e92bf95f3efe65472c27 Mon Sep 17 00:00:00 2001
|
||
|
From: Howard Hsu <howard-yh.hsu@mediatek.com>
|
||
|
Date: Wed, 20 Mar 2024 19:09:14 +0800
|
||
|
Subject: [PATCH] wifi: mt76: mt7996: fix potential memory leakage when reading
|
||
|
chip temperature
|
||
|
|
||
|
Without this commit, reading chip temperature will cause memory leakage.
|
||
|
|
||
|
Fixes: 6879b2e94172 ("wifi: mt76: mt7996: add thermal sensor device support")
|
||
|
Reported-by: Ryder Lee <ryder.lee@mediatek.com>
|
||
|
Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
|
||
|
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
|
||
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||
|
---
|
||
|
mt7996/mcu.c | 5 ++++-
|
||
|
1 file changed, 4 insertions(+), 1 deletion(-)
|
||
|
|
||
|
--- a/mt7996/mcu.c
|
||
|
+++ b/mt7996/mcu.c
|
||
|
@@ -3721,6 +3721,7 @@ int mt7996_mcu_get_temperature(struct mt
|
||
|
} __packed * res;
|
||
|
struct sk_buff *skb;
|
||
|
int ret;
|
||
|
+ u32 temp;
|
||
|
|
||
|
ret = mt76_mcu_send_and_get_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(THERMAL),
|
||
|
&req, sizeof(req), true, &skb);
|
||
|
@@ -3728,8 +3729,10 @@ int mt7996_mcu_get_temperature(struct mt
|
||
|
return ret;
|
||
|
|
||
|
res = (void *)skb->data;
|
||
|
+ temp = le32_to_cpu(res->temperature);
|
||
|
+ dev_kfree_skb(skb);
|
||
|
|
||
|
- return le32_to_cpu(res->temperature);
|
||
|
+ return temp;
|
||
|
}
|
||
|
|
||
|
int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state)
|