]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/cxgb4: Do not dma memory off of the stack
authorGreg KH <gregkh@linuxfoundation.org>
Tue, 1 Oct 2019 16:56:11 +0000 (18:56 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 4 Oct 2019 18:13:27 +0000 (15:13 -0300)
commit9386c3e3fc54a4ef858215d12c36f391079e9bab
treeb82191530895a388ffe0019a42f1d939f4299c2c
parent7d5690e192ef371de7ae694a74aad25a11c42c11
RDMA/cxgb4: Do not dma memory off of the stack

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Potnuri Bharat Teja <bharat@chelsio.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/cxgb4/mem.c