linux-stable/drivers/infiniband
Douglas Miller 29952ab85d RDMA/hfi1: Prevent panic when SDMA is disabled
[ Upstream commit 629e052d0c ]

If the hfi1 module is loaded with HFI1_CAP_SDMA off, a call to
hfi1_write_iter() will dereference a NULL pointer and panic. A typical
stack frame is:

  sdma_select_user_engine [hfi1]
  hfi1_user_sdma_process_request [hfi1]
  hfi1_write_iter [hfi1]
  do_iter_readv_writev
  do_iter_write
  vfs_writev
  do_writev
  do_syscall_64

The fix is to test for SDMA in hfi1_write_iter() and fail the I/O with
EINVAL.

Link: https://lore.kernel.org/r/20220520183706.48973.79803.stgit@awfm-01.cornelisnetworks.com
Signed-off-by: Douglas Miller <doug.miller@cornelisnetworks.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-06-09 10:25:35 +02:00
..
core IB/cm: Cancel mad on the DREQ event when the state is MRA_REP_RCVD 2022-04-13 19:27:30 +02:00
hw RDMA/hfi1: Prevent panic when SDMA is disabled 2022-06-09 10:25:35 +02:00
sw IB/rdmavt: add missing locks in rvt_ruc_loopback 2022-06-09 10:25:31 +02:00
ulp RDMA/rtrs-clt: Do stop and failover outside reconnect work. 2022-04-13 19:27:10 +02:00
Kconfig RDMA/irdma: Add irdma Kconfig/Makefile and remove i40iw 2021-06-02 20:06:36 -03:00
Makefile