提交 0bb4e918 编写于 作者: R Ryder Lee 提交者: Felix Fietkau

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: 109e505a ("mt76: mt7615: add thermal sensor device support")
Signed-off-by: NRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: NFelix Fietkau <nbd@nbd.name>
上级 0ae3ff56
...@@ -49,12 +49,14 @@ int mt7615_thermal_init(struct mt7615_dev *dev) ...@@ -49,12 +49,14 @@ int mt7615_thermal_init(struct mt7615_dev *dev)
{ {
struct wiphy *wiphy = mt76_hw(dev)->wiphy; struct wiphy *wiphy = mt76_hw(dev)->wiphy;
struct device *hwmon; struct device *hwmon;
const char *name;
if (!IS_REACHABLE(CONFIG_HWMON)) if (!IS_REACHABLE(CONFIG_HWMON))
return 0; return 0;
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7615_%s",
wiphy_name(wiphy), dev, wiphy_name(wiphy));
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, dev,
mt7615_hwmon_groups); mt7615_hwmon_groups);
if (IS_ERR(hwmon)) if (IS_ERR(hwmon))
return PTR_ERR(hwmon); return PTR_ERR(hwmon);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册