]> git.baikalelectronics.ru Git - kernel.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>
Sat, 30 Oct 2021 08:54:47 +0000 (10:54 +0200)
commit7579e9d05890b229fb35973dac755efdc6a405f5
tree3df2148b413d031ca41cbc158920d8165d4c6924
parent548fd52165b60cd908f21f0ecb947616d7d9011d
comedi: dt9812: fix DMA buffers on stack

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: e474b5b11d3c ("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/comedi/drivers/dt9812.c