From: Pei Xiao <xiaopei01@kylinos.cn>
To: Vicki Pfau <vi@endrift.com>, Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
syzbot+75f3f9bff8c510602d36@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] HID: hid-steam: fix uninit-value access in steam_get_serial
Date: Tue, 4 Aug 2026 09:41:39 +0800 [thread overview]
Message-ID: <1ecf4899-53f3-4688-a3cb-fa29cbf277ee@kylinos.cn> (raw)
In-Reply-To: <03420881-edf5-4102-8156-79f314284a07@endrift.com>
在 2026/8/4 09:05, Vicki Pfau 写道:
> Hi Pei,
>
> On 8/3/26 5:58 PM, Pei Xiao wrote:
>>
>>
>> 在 2026/8/4 04:39, Vicki Pfau 写道:
>>> Hi Jiri,
>>>
>>> On 8/3/26 12:34 PM, Jiri Kosina wrote:
>>>> CCing Vicki Pfau here ... could you please give your Ack to this fix?
>>>
>>> This was already fixed in 9f8ee99f831b2711624ef81d0abba1d183f28b09 in the series I submitted earlier. I didn't realize there was an open bug report for it.
>> Hi maintainer and Vicki,
>> I took a look at this commit. In fact, my patch was nearly two months
>> earlier than this commit. I had originally thought that this one-line
>> patch, especially for an error-path case, had been ignored by the
>> maintainer.
>
> Yes, sorry, I wasn't marked as maintainer at the time and didn't notice it before I wrote my equivalent patch. Jiri just happened to merge mine first.
>
It's okay.
> Vicki
>
>>
>> thanks!
>> Pei.
>>>
>>>>
>>>> Thanks.
>>>>
>>>> On Wed, 10 Jun 2026, Pei Xiao wrote:
>>>>
>>>>> The reply buffer in steam_get_serial() is allocated on the stack without
>>>>> initialization. In cases where steam_recv_report() returns a short read or
>>>>> an error, not all bytes of the buffer are written, leading to subsequent
>>>>> access of uninitialized memory when checking reply[0], reply[1], reply[2].
>>>>>
>>>>> Zero-initialize the reply array to prevent KMSAN uninit-value warnings.
>>>>>
>>>>> Logs:
>>>>> hid-steam 0003:28DE:1102.0007: unknown main item tag 0x0
>>>>> hid-steam 0003:28DE:1102.0007: unknown main item tag 0x0
>>>>> hid-steam 0003:28DE:1102.0007: :
>>>>> USB HID v7f.fd Device [HID 28de:1102] on usb-dummy_hcd.1-1/input0
>>>>> =====================================================
>>>>> BUG: KMSAN: uninit-value in steam_get_serial drivers/hid/hid-steam.c:457 [inline]
>>>>> BUG: KMSAN: uninit-value in steam_register+0xd83/0x10e0 drivers/hid/hid-steam.c:965
>>>>> steam_get_serial drivers/hid/hid-steam.c:457 [inline]
>>>>> steam_register+0xd83/0x10e0 drivers/hid/hid-steam.c:965
>>>>> steam_probe+0x6f1/0x19b0 drivers/hid/hid-steam.c:1273
>>>>> __hid_device_probe drivers/hid/hid-core.c:2822 [inline]
>>>>> hid_device_probe+0x60d/0xb90 drivers/hid/hid-core.c:2859
>>>>> call_driver_probe drivers/base/dd.c:-1 [inline]
>>>>> really_probe+0x4d5/0xe40 drivers/base/dd.c:709
>>>>> ...
>>>>>
>>>>> Local variable reply.i created at:
>>>>> steam_get_serial drivers/hid/hid-steam.c:448 [inline]
>>>>> steam_register+0x180/0x10e0 drivers/hid/hid-steam.c:965
>>>>> steam_probe+0x6f1/0x19b0 drivers/hid/hid-steam.c:1273
>>>>>
>>>>> Reported-by: syzbot+75f3f9bff8c510602d36@syzkaller.appspotmail.com
>>>>> Closes: https://lore.kernel.org/lkml/6a27d055.39669fcc.33b062.008d.GAE@google.com/
>>>>> Fixes: c164d6abf384 ("HID: add driver for Valve Steam Controller")
>>>>> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
>>>>
>>>>
>>>>
>>>>> ---
>>>>> drivers/hid/hid-steam.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
>>>>> index 197126d6e081..f65ad1a21c01 100644
>>>>> --- a/drivers/hid/hid-steam.c
>>>>> +++ b/drivers/hid/hid-steam.c
>>>>> @@ -445,7 +445,7 @@ static int steam_get_serial(struct steam_device *steam)
>>>>> */
>>>>> int ret = 0;
>>>>> u8 cmd[] = {ID_GET_STRING_ATTRIBUTE, sizeof(steam->serial_no), ATTRIB_STR_UNIT_SERIAL};
>>>>> - u8 reply[3 + STEAM_SERIAL_LEN + 1];
>>>>> + u8 reply[3 + STEAM_SERIAL_LEN + 1] = { 0 };
>>>>>
>>>>> mutex_lock(&steam->report_mutex);
>>>>> ret = steam_send_report(steam, cmd, sizeof(cmd));
>>>>> --
>>>>> 2.25.1
>>>>>
>>>>
>>>
>>> Vicki
>>
prev parent reply other threads:[~2026-08-04 1:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 8:35 [syzbot] [usb?] [input?] KMSAN: uninit-value in steam_register syzbot
2026-06-10 12:01 ` [PATCH] HID: hid-steam: fix uninit-value access in steam_get_serial Pei Xiao
2026-06-10 12:17 ` sashiko-bot
2026-08-03 19:34 ` Jiri Kosina
2026-08-03 20:39 ` Vicki Pfau
2026-08-04 0:58 ` Pei Xiao
2026-08-04 1:05 ` Vicki Pfau
2026-08-04 1:41 ` Pei Xiao [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=1ecf4899-53f3-4688-a3cb-fa29cbf277ee@kylinos.cn \
--to=xiaopei01@kylinos.cn \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=syzbot+75f3f9bff8c510602d36@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
--cc=vi@endrift.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