summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mediatek/mt76/mt7615/init.c
diff options
context:
space:
mode:
authorRyder Lee <ryder.lee@mediatek.com>2021-09-02 07:52:04 +0200
committerFelix Fietkau <nbd@nbd.name>2021-10-20 10:36:40 +0200
commit0bb4e9187ea4a59dc6658a62978deda0c0dc4b28 (patch)
tree5ee13dae3b0217c107512410111c760bb98ad764 /drivers/net/wireless/mediatek/mt76/mt7615/init.c
parentmt76: mt7915: fix hwmon temp sensor mem use-after-free (diff)
downloadlinux-0bb4e9187ea4a59dc6658a62978deda0c0dc4b28.tar.xz
linux-0bb4e9187ea4a59dc6658a62978deda0c0dc4b28.zip
mt76: mt7615: fix hwmon temp sensor mem use-after-free
Without this change, garbage is seen in the hwmon name and sensors output for mt7615 is garbled. Fixes: 109e505ad944 ("mt76: mt7615: add thermal sensor device support") Signed-off-by: Ryder Lee <ryder.lee@mediatek.com> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/init.c')
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7615/init.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
index 2f1ac644e018..47f23ac905a3 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c
@@ -49,12 +49,14 @@ int mt7615_thermal_init(struct mt7615_dev *dev)
{
struct wiphy *wiphy = mt76_hw(dev)->wiphy;
struct device *hwmon;
+ const char *name;
if (!IS_REACHABLE(CONFIG_HWMON))
return 0;
- hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev,
- wiphy_name(wiphy), dev,
+ name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7615_%s",
+ wiphy_name(wiphy));
+ hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, dev,
mt7615_hwmon_groups);
if (IS_ERR(hwmon))
return PTR_ERR(hwmon);