HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX
authorTomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Tue, 11 Feb 2025 14:35:08 +0000 (15:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:15:30 +0000 (10:15 +0200)
commit211861869766a7bb7c72158aee0140ec67e182a7
treef33a817799b3344e2596ca595ad0397ec6a42cbb
parent13d15dd6175e1e3eb70ce95e3da0b8a0a5a54d34
HID: pidff: Make sure to fetch pool before checking SIMULTANEOUS_MAX

[ Upstream commit 1f650dcec32d22deb1d6db12300a2b98483099a9 ]

As noted by Anssi some 20 years ago, pool report is sometimes messed up.
This worked fine on many devices but casued oops on VRS DirectForce PRO.

Here, we're making sure pool report is refetched before trying to access
any of it's fields. While loop was replaced with a for loop + exit
conditions were moved aroud to decrease the possibility of creating an
infinite loop scenario.

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/usbhid/hid-pidff.c