From: Felix Fietkau <nbd@nbd.name>
To: Ben Greear <greearb@candelatech.com>, Ryder Lee <ryder.lee@mediatek.com>
Cc: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Evelyn Tsai <evelyn.tsai@mediatek.com>,
linux-wireless@vger.kernel.org,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v4 1/2] mt76: mt7915: fix hwmon temp sensor mem use-after-free
Date: Fri, 13 Aug 2021 16:08:45 +0200 [thread overview]
Message-ID: <1c4ab69a-21ad-f3fb-12b9-e1664dcc735d@nbd.name> (raw)
In-Reply-To: <44c91410-49db-b829-a69a-f9826c8ff3ee@candelatech.com>
On 2021-08-13 15:54, Ben Greear wrote:
> On 8/13/21 3:15 AM, Felix Fietkau wrote:
>>
>> On 2021-07-31 04:17, Ryder Lee wrote:
>>> From: Ben Greear <greearb@candelatech.com>
>>>
>>> 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.
That makes sense. It seems that thermal copies the string internally,
but hwmon does not.
How about using devm_kstrdup on the wiphy name instead of using
KBUILD_MODNAME? If you really don't want to use the initial phy name,
there's also the option of using dev_name(dev->mt76.dev)
- Felix
prev parent reply other threads:[~2021-08-13 14:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-31 2:17 [PATCH v4 1/2] mt76: mt7915: fix hwmon temp sensor mem use-after-free Ryder Lee
2021-07-31 2:17 ` [PATCH v4 2/2] mt76: mt7615: " Ryder Lee
2021-08-13 10:15 ` [PATCH v4 1/2] mt76: mt7915: " Felix Fietkau
2021-08-13 13:54 ` Ben Greear
2021-08-13 14:08 ` Felix Fietkau [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1c4ab69a-21ad-f3fb-12b9-e1664dcc735d@nbd.name \
--to=nbd@nbd.name \
--cc=evelyn.tsai@mediatek.com \
--cc=greearb@candelatech.com \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=ryder.lee@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox