]> git.baikalelectronics.ru Git - kernel.git/commit
media: ov519: add missing endpoint sanity checks
authorJohan Hovold <johan@kernel.org>
Fri, 3 Jan 2020 16:35:09 +0000 (17:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:02:17 +0000 (11:02 +0200)
commit503f79edf8ef72d6e66f39417a412588483fad61
treef3ffbed67d62aa9af21598e13d0f21e9b88a0593
parent8a2e2b8501611d1c5ef8b9d0b3c4e73d028620be
media: ov519: add missing endpoint sanity checks

commit 77994df491460a33f348c5bfe4f43d7c43a39717 upstream.

Make sure to check that we have at least one endpoint before accessing
the endpoint array to avoid dereferencing a NULL-pointer on stream
start.

Note that these sanity checks are not redundant as the driver is mixing
looking up altsettings by index and by number, which need not coincide.

Fixes: d2bf81184cc5 ("V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge")
Fixes: 2b51a5b335f8 ("V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)")
Cc: stable <stable@vger.kernel.org> # 2.6.31
Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/usb/gspca/ov519.c