]> git.baikalelectronics.ru Git - kernel.git/commit
HID: hid-lg4ff: Add check for empty lbuf
authorAnastasia Belova <abelova@astralinux.ru>
Fri, 11 Nov 2022 12:55:11 +0000 (15:55 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Dec 2022 10:30:43 +0000 (11:30 +0100)
commit2e7dfebfa3dd1cc84b1b12157e2c0f824b1ce86c
tree4f34bb9a707806b30014c09319870232026df03e
parenta0a4fad9c683547c3da2c2b55e88ac4a45040a16
HID: hid-lg4ff: Add check for empty lbuf

commit 0b94d7f2a95a4e4b45ff671f964b238e34604e92 upstream.

If an empty buf is received, lbuf is also empty. So lbuf is
accessed by index -1.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 0dd6833b97db ("HID: hid-lg4ff: Allow switching of Logitech gaming wheels between compatibility modes")
Signed-off-by: Anastasia Belova <abelova@astralinux.ru>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-lg4ff.c