]> git.baikalelectronics.ru Git - kernel.git/commit
comedi: ni_usb6501: fix NULL-deref in command paths
authorJohan Hovold <johan@kernel.org>
Wed, 27 Oct 2021 09:35:28 +0000 (11:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 30 Oct 2021 08:54:47 +0000 (10:54 +0200)
commiteb9b3eb408b05210a893586f5e16610d744a051e
tree8e0ea076a5c5d3899c1ece7f30aa2cba8a73fa7a
parent2d587f2896982c102195389a22e0a9dbe27c9f18
comedi: ni_usb6501: fix NULL-deref in command paths

The driver uses endpoint-sized USB transfer buffers but had no sanity
checks on the sizes. This can lead to zero-size-pointer dereferences or
overflowed transfer buffers in ni6501_port_command() and
ni6501_counter_command() if a (malicious) device has smaller max-packet
sizes than expected (or when doing descriptor fuzz testing).

Add the missing sanity checks to probe().

Fixes: 1454294967b0 ("staging: comedi: add NI USB-6501 support")
Cc: stable@vger.kernel.org # 3.18
Cc: Luca Ellero <luca.ellero@brickedbrain.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211027093529.30896-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/comedi/drivers/ni_usb6501.c