USB: usblp: fix DMA to stack
authorJohan Hovold <johan@kernel.org>
Mon, 4 Jan 2021 14:53:02 +0000 (15:53 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jan 2021 19:18:20 +0000 (20:18 +0100)
commit0a5b28c99dc45ee7bb16cd8e168e3bd561fc050d
tree258649b91aecd4f22269f0b6934646774dee9aa3
parent4f7e97ffb4eb6413799f80a7af8595db534bec45
USB: usblp: fix DMA to stack

commit 020a1f453449294926ca548d8d5ca970926e8dfd upstream.

Stack-allocated buffers cannot be used for DMA (on all architectures).

Replace the HP-channel macro with a helper function that allocates a
dedicated transfer buffer so that it can continue to be used with
arguments from the stack.

Note that the buffer is cleared on allocation as usblp_ctrl_msg()
returns success also on short transfers (the buffer is only used for
debugging).

Cc: stable@vger.kernel.org
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20210104145302.2087-1-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/class/usblp.c