OSDN Git Service

staging: comedi: verify array index is correct before using it
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 9 Jul 2020 10:29:36 +0000 (13:29 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jul 2020 12:03:00 +0000 (14:03 +0200)
commitef75e14a6c935eec82abac07ab68e388514e39bc
tree8f8707f25c62ad2a263acac276267a048d4e2e71
parent617894cd848f592fa84d7cf561dc80929afc66ff
staging: comedi: verify array index is correct before using it

This code reads from the array before verifying that "trig" is a valid
index.  If the index is wildly out of bounds then reading from an
invalid address could lead to an Oops.

Fixes: a8c66b684efa ("staging: comedi: addi_apci_1500: rewrite the subdevice support functions")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://lore.kernel.org/r/20200709102936.GA20875@mwanda
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/addi_apci_1500.c