Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp91734pxb; Wed, 1 Sep 2021 22:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHpYotJ92pmIQZ9cWfdZKt+qLfGGxkssDy1+hQjtfLReocUUeeSi4KgZS29nEWcFkg2jOQ X-Received: by 2002:a17:906:a018:: with SMTP id p24mr1809502ejy.349.1630562073106; Wed, 01 Sep 2021 22:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630562073; cv=none; d=google.com; s=arc-20160816; b=I604mTDnXdSUf0dKPEnCaEuCRHz+4dCJmdkOqf2dWaFS4/MGRAukQBOym4oVCrffc/ V+87oj127BkUq+OKzlR73O1cSzn142oN0ynQ3B1IokRBd2RHiJaZwXJ1s4hjOhzNy5bl oBsL721UEQ7kRiP2Uaz605giJ/8KjfSIJa9ctG3nqWZ+kVTTrq/lXHqgahU0y0WLH0N0 pIYpCZMgFZdlg3GZ7P0KvLU3YhjnbiuZVnkZn7+KznHJ4qzRNlmw4ItZmjGzb2p0RKEV ilsR3x5NSlXluhvh5U2EbPm078qjpfe0KSwCWj57QrEm1lBP4sLd+sHdgRlJYsOIwPbV 9Rsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=dVoA5MDaVRx0F2G6VR0xN54U7moskxhRsHmwkJQQYZw=; b=WpD8IhfreAL1sLZ0YSNQF16TrvY4a952LYECf8Y2vpyaDcLJDCD0hCm638SZjq1OTQ 8A+lKaUlG7ya5KVJ/2/vO8VbQFK0X0VjO1fmlK1w1HyjvBE6bzh6RErGr8IbLt9fvB8J w6d3FTo4eA8te5+odMr+PIOk5/JkbA+dA0/IZb0cDj18+zji7bFjJEXwvzhUA6rD6/3T DKLq8tzOoNBLrgUcsk4cnAdRwhETUl+l8jNwR1YGcb+HNJAED63eSNNbRn9cN53IgWJu u73OF/UU+jd9ch72CSOYemsze8QV5cvgm+OfYkivC1ql3frr8pjh23jN51UkW5ehjYim 7Hgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si1317281ede.98.2021.09.01.22.54.00; Wed, 01 Sep 2021 22:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236724AbhIBFxt (ORCPT + 99 others); Thu, 2 Sep 2021 01:53:49 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:55406 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S236573AbhIBFxs (ORCPT ); Thu, 2 Sep 2021 01:53:48 -0400 X-UUID: 134f060d8f1b4c75a293380cda4bf6db-20210902 X-UUID: 134f060d8f1b4c75a293380cda4bf6db-20210902 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 904648352; Thu, 02 Sep 2021 13:52:48 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 2 Sep 2021 13:52:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 2 Sep 2021 13:52:47 +0800 From: Ryder Lee To: Felix Fietkau CC: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , , , Ryder Lee Subject: [PATCH v6 2/2] mt76: mt7615: fix hwmon temp sensor mem use-after-free Date: Thu, 2 Sep 2021 13:52:04 +0800 Message-ID: <9b5e38c8ac84ded6af5969e7780a7c23ec154857.1630561595.git.ryder.lee@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <101c24cfc81ed5819d93c60cf2e96bdd6ce97c47.1630561595.git.ryder.lee@mediatek.com> References: <101c24cfc81ed5819d93c60cf2e96bdd6ce97c47.1630561595.git.ryder.lee@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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 --- v6: Use devm_kasprintf to add a generic prefix "mt7615-" on wiphy name. v5: Use devm_kstrdup on the wiphy name as suggested. --- drivers/net/wireless/mediatek/mt76/mt7615/init.c | 6 ++++-- 1 file 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 05235a60d413..e053548cafd2 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); -- 2.29.2