Re: [syzbot] [input?] [usb?] WARNING in hid_output_report

From: Alan Stern
Date: Tue May 07 2024 - 13:35:41 EST


On Sun, May 05, 2024 at 03:36:27PM -0700, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 18daea77cca6 Merge tag 'for-linus' of git://git.kernel.org..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=159f1f17180000
> kernel config: https://syzkaller.appspot.com/x/.config?x=d2f00edef461175
> dashboard link: https://syzkaller.appspot.com/bug?extid=5186630949e3c55f0799
> compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13deb917180000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1035ae87180000
>
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/4614372cf68b/disk-18daea77.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/e118db95ea43/vmlinux-18daea77.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/998cf091eeb5/bzImage-18daea77.xz
>
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+5186630949e3c55f0799@xxxxxxxxxxxxxxxxxxxxxxxxx
>
> keytouch 0003:0926:3333.0001: implement() called with too large value 8 (n: 1)! (kworker/0:0)
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 7 at drivers/hid/hid-core.c:1451 implement drivers/hid/hid-core.c:1451 [inline]
> WARNING: CPU: 0 PID: 7 at drivers/hid/hid-core.c:1451 hid_output_report+0x548/0x760 drivers/hid/hid-core.c:1863

I suspect the WARN_ON(1) call in implement() should simply be removed.

It looks like the keytouch driver is trying to write 8 to a 1-bit field
in an output report. It probably doesn't verify the field sizes and
just assumes the device is reasonable.

Alan Stern