go7007: add sanity checking for endpoints
authorOliver Neukum <oneukum@suse.com>
Tue, 5 May 2020 10:50:33 +0000 (12:50 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:23:56 +0000 (08:23 +0200)
commit1a1fa600974d891f2a2ef4515ee69216c156717a
treeeded539e9d34e8bd31622246a25db9da4ea25f58
parent1427f39157f3d599133d697f7bcbc6f82ea76170
go7007: add sanity checking for endpoints

[ Upstream commit 137641287eb40260783a4413847a0aef06023a6c ]

A malicious USB device may lack endpoints the driver assumes to exist
Accessing them leads to NULL pointer accesses. This patch introduces
sanity checking.

Reported-and-tested-by: syzbot+cabfa4b5b05ff6be4ef0@syzkaller.appspotmail.com
Signed-off-by: Oliver Neukum <oneukum@suse.com>
Fixes: 866b8695d67e8 ("Staging: add the go7007 video driver")
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/go7007/go7007-usb.c