Skip to content

Commit bbefa60

Browse files
Ivan AbramovUlrich Hecht
authored andcommitted
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: 8a4b275 ("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> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 957ea93 commit bbefa60

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/media/i2c/msp3400-kthreads.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,8 @@ int msp3400c_thread(void *data)
601601
"carrier2 val: %5d / %s\n", val, cd[i].name);
602602
}
603603

604+
if (max1 < 0 || max1 > 3)
605+
goto restart;
604606
/* program the msp3400 according to the results */
605607
state->main = msp3400c_carrier_detect_main[max1].cdo;
606608
switch (max1) {

0 commit comments

Comments
 (0)