From: Jiri Slaby <jirislaby@kernel.org>
To: Nolan Nicholson <nolananicholson@gmail.com>, stable@vger.kernel.org
Cc: jikos@kernel.org, bentiss@kernel.org, linux-usb@vger.kernel.org,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
anssi.hannula@gmail.com
Subject: Re: hid-pidff.c: null-pointer deref if optional HID reports are not present
Date: Tue, 5 Nov 2024 08:40:43 +0100 [thread overview]
Message-ID: <1b40561a-580d-406a-bb2c-1398dce7fb90@kernel.org> (raw)
In-Reply-To: <CAL-gK7f5=R0nrrQdPtaZZr1fd-cdAMbDMuZ_NLA8vM0SX+nGSw@mail.gmail.com>
Cc Anssi
On 05. 11. 24, 1:30, Nolan Nicholson wrote:
> Hello,
>
> (This is my first time reporting a Linux bug; please accept my apologies
> for any mistakes in the process.)
>
> When initializing a HID PID device, hid-pidff.c checks for eight
> required HID reports and five optional reports. If the eight required
> reports are present, the hid_pidff_init() function then attempts to find
> the necessary fields in each required or optional report, using the
> pidff_find_fields() function. However, if any of the five optional
> reports is not present, pidff_find_fields() will trigger a null-pointer
> dereference.
>
> I recently implemented the descriptors for a USB HID device with PID
> force-feedback capability. After implementing the required report
> descriptors but not the optional ones, I got an OOPS from the
> pidff_find_fields function. I saved the OOPS from my Ubuntu
> installation, and have attached it here. I later reproduced the issue on
> 6.11.6.
>
> I was able to work around the issue by having my device present all of
> the optional report descriptors as well as all of the required ones.
Indeed. The code checks the required ones in pidff_reports_ok(). But the
optional ones are not checked at all and are directly accessed in both
pidff_init_fields() and also likely pidff_find_special_fields().
thanks,
--
js
suse labs
next prev parent reply other threads:[~2024-11-05 7:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-05 0:30 Nolan Nicholson
2024-11-05 7:40 ` Jiri Slaby [this message]
2024-11-06 16:30 ` Jiri Kosina
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=1b40561a-580d-406a-bb2c-1398dce7fb90@kernel.org \
--to=jirislaby@kernel.org \
--cc=anssi.hannula@gmail.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nolananicholson@gmail.com \
--cc=stable@vger.kernel.org \
/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
all inboxes | Powered by JetHome®