]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
comedi: dt9812: fix DMA buffers on stack
authorJohan Hovold <johan@kernel.org>
Wed, 27 Oct 2021 09:35:29 +0000 (11:35 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Nov 2021 12:18:02 +0000 (13:18 +0100)
commit365a346cda82f51d835c49136a00a9df8a78c7f2
tree7961ae9f917a487de22470293bf8d5414a501f16
parent9ec33a9b8790c212cc926a88c5e2105f97f3f57e
comedi: dt9812: fix DMA buffers on stack

commit 536de747bc48262225889a533db6650731ab25d3 upstream.

USB transfer buffers are typically mapped for DMA and must not be
allocated on the stack or transfers will fail.

Allocate proper transfer buffers in the various command helpers and
return an error on short transfers instead of acting on random stack
data.

Note that this also fixes a stack info leak on systems where DMA is not
used as 32 bytes are always sent to the device regardless of how short
the command is.

Fixes: 63274cd7d38a ("Staging: comedi: add usb dt9812 driver")
Cc: stable@vger.kernel.org # 2.6.29
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211027093529.30896-3-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/dt9812.c