]> git.proxmox.com Git - mirror_ubuntu-jammy-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)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:32:24 +0000 (07:32 +0100)
commit49bdc8931c00ef588682810d48aa94ede698f6b2
tree1c57fb6b74a27e397e6495d70fc725a0962a2839
parent4e26fbf7988be124878ab9e7c94b8b727f5343bd
comedi: ni_usb6501: fix NULL-deref in command paths

BugLink: https://bugs.launchpad.net/bugs/1950949
commit 907767da8f3a925b060c740e0b5c92ea7dbec440 upstream.

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: a03bb00e50ab ("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>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/comedi/drivers/ni_usb6501.c