Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp837718pxb; Fri, 13 Aug 2021 07:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVKycn3uBLGwxWY19gVh63hBOOytYDEDwLdh0h6sLmttlU7Iv6cYlhn2nHB5Yq0rhf8LiD X-Received: by 2002:a6b:7712:: with SMTP id n18mr2284449iom.34.1628864799463; Fri, 13 Aug 2021 07:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628864799; cv=none; d=google.com; s=arc-20160816; b=A9QQ2vGrnMdI7K2k4Su5CWIOv1riMHA/uR53Hy+7tOL3UuazHSsGGtFG0BNuGhVZng VeqLo2hkY4UUAXgi15yPUVZPcuphbbBhtGvg5B1NBpwQHawz+CqWFMfxA/cN4R79uVwz 0kbEieuvu4FFev/c9+aktLQLhO1Xx1+1Xi77q45scBZ2+K1waO3j612fA9of89AVh1OQ +aSpYoyGyLaQE7qUxMf/i/le7U3ydgLzjIsS+4k+ySCnQRmoWEGL758P+9cI1Mrmq3bN Czs2yySeG0ISo6wUDt8jvJfF/Y4skKtwhGmtLgd4HynLcHn2cFri2Bp1i1I/7pR5SQKN MLTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature:dkim-filter; bh=8NTFMc6RiMcfToNbrTD72b2hCVji2kFy8KP5ThK73QM=; b=Jw2oEmj7GNoDLXCXQ1Dv1MwDpEPxvY3o780e9sek5sTrLiaH43GATZdP+mT6u3WvhF 7v4VZTjCbG+vGL671IvylY9q6vc3eUNF5AjhHzu7a+gCqtw2p2isgcGalj8lV2mh2O6q y4BNSg0eWJGRP3sQ4nqVJMps8wGzNJuKFOGcC6jypuLx6Sikk8h7osZFCtx1H44KTnJ+ 9OcF9xEw6Nlk5MGkjsmGuQf1dgF+0ogPeApY+AtcUKSr8Egx8JFPiLcGE5q6S2zK8rLZ DfFEtvTDEqkGr+vN9WNNnulBMdLqtfb42M2Gfc4QOGDkkDTXpaHy1A/ufnDoOVwv8X1x HqQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@candelatech.com header.s=default header.b=gz+xfbYw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h13si1650656ilc.131.2021.08.13.07.26.15; Fri, 13 Aug 2021 07:26:39 -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; dkim=pass header.i=@candelatech.com header.s=default header.b=gz+xfbYw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=candelatech.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240706AbhHMNzK (ORCPT + 99 others); Fri, 13 Aug 2021 09:55:10 -0400 Received: from dispatch1-us1.ppe-hosted.com ([67.231.154.184]:36644 "EHLO dispatch1-us1.ppe-hosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240068AbhHMNzK (ORCPT ); Fri, 13 Aug 2021 09:55:10 -0400 X-Virus-Scanned: Proofpoint Essentials engine Received: from mx1-us1.ppe-hosted.com (unknown [10.110.51.24]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTPS id BC4B22A006D; Fri, 13 Aug 2021 13:54:42 +0000 (UTC) Received: from mail3.candelatech.com (mail2.candelatech.com [208.74.158.173]) by mx1-us1.ppe-hosted.com (PPE Hosted ESMTP Server) with ESMTP id 465F43C0026; Fri, 13 Aug 2021 13:54:41 +0000 (UTC) Received: from [192.168.254.6] (unknown [50.34.183.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail3.candelatech.com (Postfix) with ESMTPSA id CEFC713C2B1; Fri, 13 Aug 2021 06:54:39 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 mail3.candelatech.com CEFC713C2B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=candelatech.com; s=default; t=1628862880; bh=5tKunBAwMnPdA7f4AkB8bCitDfhGrzhL+wAN4/LW8Ek=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=gz+xfbYwr10CiYKi0hg11kPXyeK8FKaIEqWm8Gvx4XAoQnJcQl6lbZ6Tn4iZekUYv fuBEHtodw38xvB+GFNyZeD9KkPMoo9heiaohDKqZRFvyeO44ZKyJhMTmXUP/sJslFv zLfsuZTnE5/2mUiLzYPP2pxiK3xDweuOPI7Cku2E= Subject: Re: [PATCH v4 1/2] mt76: mt7915: fix hwmon temp sensor mem use-after-free To: Felix Fietkau , Ryder Lee Cc: Lorenzo Bianconi , Shayne Chen , Evelyn Tsai , linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org References: <9f5b0cf6c4296d3a9e78a95516cf26d1db4baba9.1627696765.git.ryder.lee@mediatek.com> <04c61f83-e4ce-536f-7030-9050d8edfe78@nbd.name> From: Ben Greear Organization: Candela Technologies Message-ID: <44c91410-49db-b829-a69a-f9826c8ff3ee@candelatech.com> Date: Fri, 13 Aug 2021 06:54:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <04c61f83-e4ce-536f-7030-9050d8edfe78@nbd.name> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-MW Content-Transfer-Encoding: 8bit X-MDID: 1628862883-Ux-78EVqV1pL Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On 8/13/21 3:15 AM, Felix Fietkau wrote: > > On 2021-07-31 04:17, Ryder Lee wrote: >> From: Ben Greear >> >> Without this change, garbage is seen in the hwmon name >> and sensors output for mt7915 is garbled. > Where does the use-after-free bug come from? It's not obvious to me why > using KBUILD_MODNAME instead of wiphy_name() fixes it. > I still think the phy name should probably be part of the prefix. We rename phy devices as part of our normal operation, I think maybe that helps trigger the bug. It appears that the hwmon logic does not make a copy of the incoming string, but instead just copies a char* and expects it to never go away. But, I did not actually verify that. Thanks, Ben > >> With the change: >> >> mt7915-pci-1400 >> Adapter: PCI adapter >> temp1: +49.0°C >> >> Fixes: d6938251bb5b (mt76: mt7915: add thermal sensor device support) > The format is wrong (missing quotes), and the hash references a commit > that's not in any upstream tree. > > - Felix > -- Ben Greear Candela Technologies Inc http://www.candelatech.com