Skip to content

Commit a082758

Browse files
haogrootopsiff
authored andcommitted
wifi: mt76: mt7996: fix potential memory leakage when reading chip temperature
[ Upstream commit 474b941 ] Without this commit, reading chip temperature will cause memory leakage. Fixes: 6879b2e ("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> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 84e81f9b4818b8efe89beb12a246d5d510631939)
1 parent 8e172dc commit a082758

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • drivers/net/wireless/mediatek/mt76/mt7996

drivers/net/wireless/mediatek/mt76/mt7996/mcu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3748,15 +3748,18 @@ int mt7996_mcu_get_temperature(struct mt7996_phy *phy)
37483748
} __packed * res;
37493749
struct sk_buff *skb;
37503750
int ret;
3751+
u32 temp;
37513752

37523753
ret = mt76_mcu_send_and_get_msg(&phy->dev->mt76, MCU_WM_UNI_CMD(THERMAL),
37533754
&req, sizeof(req), true, &skb);
37543755
if (ret)
37553756
return ret;
37563757

37573758
res = (void *)skb->data;
3759+
temp = le32_to_cpu(res->temperature);
3760+
dev_kfree_skb(skb);
37583761

3759-
return le32_to_cpu(res->temperature);
3762+
return temp;
37603763
}
37613764

37623765
int mt7996_mcu_set_thermal_throttling(struct mt7996_phy *phy, u8 state)

0 commit comments

Comments
 (0)