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>
This commit is contained in:
parent
0ae3ff5684
commit
0bb4e9187e
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user