Commit 03ee8f73 authored by Henry Martin's avatar Henry Martin Committed by Felix Fietkau
Browse files

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: 396e41a7 ("wifi: mt76: mt7925: support temperature sensor")
Signed-off-by: default avatarHenry Martin <bsdhenryma@tencent.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://patch.msgid.link/20250625124901.1839832-1-bsdhenryma@tencent.com


Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent dedf2ec3
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ static int mt7925_thermal_init(struct mt792x_phy *phy)

	name = devm_kasprintf(&wiphy->dev, GFP_KERNEL, "mt7925_%s",
			      wiphy_name(wiphy));
	if (!name)
		return -ENOMEM;

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