]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: gspca: Add bounds checking to firmware parser
authorDan Carpenter <dan.carpenter@linaro.org>
Wed, 28 May 2025 20:22:14 +0000 (23:22 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:28:37 +0000 (16:28 +0200)
commit0148fcdd91403eda2c285ee3aaa6e755ef2e6f93
tree0226a1e4d4dc9ea15ca5beed00bb6b91e9ad8933
parent85bfcb0e40fe632c2563ca7cfb005379a1eebe24
media: gspca: Add bounds checking to firmware parser

commit aef89c0b2417da79cb2062a95476288f9f203ab0 upstream.

This sd_init() function reads the firmware.  The firmware data holds a
series of records and the function reads each record and sends the data
to the device.  The request_ihex_firmware() function
calls ihex_validate_fw() which ensures that the total length of all the
records won't read out of bounds of the fw->data[].

However, a potential issue is if there is a single very large
record (larger than PAGE_SIZE) and that would result in memory
corruption.  Generally we trust the firmware, but it's always better to
double check.

Fixes: 49b61ec9b5af ("[media] gspca: Add new vicam subdriver")
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/usb/gspca/vicam.c