RDMA/cxgb4: Do not dma memory off of the stack
commit1db19d6805d9dc5c79f8a19dddde324dbf0a33f9
authorGreg KH <gregkh@linuxfoundation.org>
Tue, 1 Oct 2019 16:56:11 +0000 (1 18:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Oct 2019 08:17:49 +0000 (29 09:17 +0100)
tree9cbe6f740f57b6d3fbc6ec76b227826ae4297a73
parentb425d011e83d220d3be0a19561d6b33d11358fa5
RDMA/cxgb4: Do not dma memory off of the stack

commit 3840c5b78803b2b6cc1ff820100a74a092c40cbb upstream.

Nicolas pointed out that the cxgb4 driver is doing dma off of the stack,
which is generally considered a very bad thing.  On some architectures it
could be a security problem, but odds are none of them actually run this
driver, so it's just a "normal" bug.

Resolve this by allocating the memory for a message off of the heap
instead of the stack.  kmalloc() always will give us a proper memory
location that DMA will work correctly from.

Link: https://lore.kernel.org/r/20191001165611.GA3542072@kroah.com
Reported-by: Nicolas Waisman <nico@semmle.com>
Tested-by: Potnuri Bharat Teja <bharat@chelsio.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/hw/cxgb4/mem.c