mirror of
https://github.com/LineageOS/android_kernel_fxtec_sm6115.git
synced 2026-08-18 12:41:04 +00:00
HID: prodikeys: Check presence of pm->input_ep82
[ Upstream commit cee8337e1bad168136aecfe6416ecd7d3aa7529a ] Fake USB devices can send their own report descriptors for which the input_mapping() hook does not get called. In this case, pm->input_ep82 stays NULL, which leads to a crash later. This does not happen with the real device, but can be provoked by imposing as one. Cc: stable@vger.kernel.org Signed-off-by: Günther Noack <gnoack@google.com> Signed-off-by: Jiri Kosina <jkosina@suse.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
This commit is contained in:
committed by
Ulrich Hecht
parent
f57ed48230
commit
bf34bf2b4e
@ -392,6 +392,10 @@ static int pcmidi_handle_report4(struct pcmidi_snd *pm, u8 *data)
|
||||
bit_mask = (bit_mask << 8) | data[2];
|
||||
bit_mask = (bit_mask << 8) | data[3];
|
||||
|
||||
/* robustness in case input_mapping hook does not get called */
|
||||
if (!pm->input_ep82)
|
||||
return 0;
|
||||
|
||||
/* break keys */
|
||||
for (bit_index = 0; bit_index < 24; bit_index++) {
|
||||
if (!((0x01 << bit_index) & bit_mask)) {
|
||||
|
||||
Reference in New Issue
Block a user