Skip to content

Commit 03ee8f7

Browse files
Henry Martinnbd168
authored andcommitted
wifi: mt76: mt7925: Fix null-ptr-deref in mt7925_thermal_init()
devm_kasprintf() returns NULL on error. Currently, mt7925_thermal_init() does not check for this case, which results in a NULL pointer dereference. Add NULL check after devm_kasprintf() to prevent this issue. Fixes: 396e41a ("wifi: mt76: mt7925: support temperature sensor") Signed-off-by: Henry Martin <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Felix Fietkau <[email protected]>
1 parent dedf2ec commit 03ee8f7

File tree

1 file changed

+2
-0
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7925

1 file changed

+2
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt7925/init.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ static int mt7925_thermal_init(struct mt792x_phy *phy)
5252

5353
name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7925_%s",
5454
wiphy_name(wiphy));
55+
if (!name)
56+
return -ENOMEM;
5557

5658
hwmon = devm_hwmon_device_register_with_groups(&wiphy->dev, name, phy,
5759
mt7925_hwmon_groups);

0 commit comments

Comments
 (0)