From: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
To: Jiri Kosina <jikos@kernel.org>, Kees Cook <kees@kernel.org>
Cc: Benjamin Tissoires <bentiss@kernel.org>,
Kees Cook <keescook@chromium.org>, <linux-usb@vger.kernel.org>,
<linux-input@vger.kernel.org>, <syzkaller-bugs@googlegroups.com>,
<linux-kernel@vger.kernel.org>,
<syzbot+c52569baf0c843f35495@syzkaller.appspotmail.com>,
<linux-hardening@vger.kernel.org>
Subject: Re: [PATCH] HID: usbhid: fix recurrent out-of-bounds bug in usbhid_parse()
Date: Tue, 4 Jun 2024 10:09:43 -0700 [thread overview]
Message-ID: <2a38e355-af5c-4b3d-81be-0cc97376c1f5@fintech.ru> (raw)
In-Reply-To: <nycvar.YFH.7.76.2406041614210.24940@cbobk.fhfr.pm>
Hi,
On 6/4/24 07:15, Jiri Kosina wrote:
> On Tue, 4 Jun 2024, Kees Cook wrote:
>
>> This isn't the right solution. The problem is that hid_class_descriptor
>> is a flexible array but was sized as a single element fake flexible
>> array:
>>
>> struct hid_descriptor {
>> __u8 bLength;
>> __u8 bDescriptorType;
>> __le16 bcdHID;
>> __u8 bCountryCode;
>> __u8 bNumDescriptors;
>>
>> struct hid_class_descriptor desc[1];
>> } __attribute__ ((packed));
>>
>> This likely needs to be:
>>
>> struct hid_class_descriptor desc[] __counted_by(bNumDescriptors);
>>
>> And then check for any sizeof() uses of the struct that might have changed.
>
> Ah, you are of course right, not sure what I was thinking. Thanks a lot
> for catching my brainfart.
>
> I am dropping the patch for now; Nikita, will you please send a refreshed
> one?
>
Thanks for catching my mistake.
I'll gladly send a revised version, hoping to do it very soon.
Regards,
Nikita
next prev parent reply other threads:[~2024-06-04 17:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-24 12:01 [PATCH] HID: usbhid: fix recurrent out-of-bounds bug in usbhid_parse() Nikita Zhandarovich
2024-06-04 8:15 ` Jiri Kosina
2024-06-04 14:11 ` Kees Cook
2024-06-04 14:15 ` Jiri Kosina
2024-06-04 17:09 ` Nikita Zhandarovich [this message]
2024-06-04 17:21 ` Kees Cook
2024-06-04 17:45 ` Alan Stern
2025-01-28 13:45 ` Nikita Zhandarovich
2025-01-28 17:00 ` Alan Stern
2025-01-29 1:53 ` Kees Cook
2025-01-29 19:21 ` Terry Junge
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=2a38e355-af5c-4b3d-81be-0cc97376c1f5@fintech.ru \
--to=n.zhandarovich@fintech.ru \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=kees@kernel.org \
--cc=keescook@chromium.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=syzbot+c52569baf0c843f35495@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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