]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
media: msp3400: Avoid possible out-of-bounds array accesses in msp3400c_thread()
authorIvan Abramov <i.abramov@mt-integration.ru>
Tue, 2 Sep 2025 23:28:14 +0000 (02:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:11:58 +0000 (13:11 +0100)
commitfbf8d0317bea9a8fd31d31659b9d2cb9a611a29c
treee6e9d1859cbe3ebf126a97baa3ca73df840d72c5
parentdf4dcf0f72e50f25d26a30b452a6ecb1feb3e337
media: msp3400: Avoid possible out-of-bounds array accesses in msp3400c_thread()

commit d2bceb2e20e783d57e739c71e4e50b4b9f4a3953 upstream.

It's possible for max1 to remain -1 if msp_read() always fail. This
variable is further used as index for accessing arrays.

Fix that by checking max1 prior to array accesses.

It seems that restart is the preferable action in case of out-of-bounds
value.

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

Fixes: 8a4b275f9c19 ("V4L/DVB (3427): audmode and rxsubchans fixes (VIDIOC_G/S_TUNER)")
Cc: stable@vger.kernel.org
Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/i2c/msp3400-kthreads.c