linux/drivers/infiniband/hw/erdma
Cheng Xu b2abdffb50 RDMA/erdma: Fix NULL pointer access in regmr_cmd
Fix the crash of regmr_cmd called by erdma_ib_alloc_mr. The reason is
that mr->mem.mtt is not initialized but it is accessed in regmr_cmd.

The call trace information:

 BUG: kernel NULL pointer dereference, address: 0000000000000000
 <...>
 RIP: 0010:regmr_cmd+0x170/0x1c0 [erdma]
 <...>
Call Trace:
 ? __die+0x20/0x70
 ? page_fault_oops+0x66/0x150
 ? do_user_addr_fault+0x61/0x660
 ? exc_page_fault+0x65/0x140
 ? asm_exc_page_fault+0x22/0x30
 ? regmr_cmd+0x170/0x1c0 [erdma]
 ? preempt_count_add+0x70/0xa0
 ? _raw_spin_lock_irqsave+0x19/0x50
 ? _raw_spin_unlock_irqrestore+0x1b/0x40
 ? erdma_alloc_idx+0x51/0x90 [erdma]
 erdma_get_dma_mr+0xa3/0x120 [erdma]
 __ib_alloc_pd+0xeb/0x1c0 [ib_core]

Fixes: 7244b4aa42 ("RDMA/erdma: Refactor the storage structure of MTT entries")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/3d140c1d-524a-4dbe-a51c-aee4f7ecafdb@moroto.mountain/
Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230908060559.80203-1-chengyou@linux.alibaba.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2023-09-18 10:42:19 +03:00
..
erdma_cm.c net/sock: Introduce trace_sk_data_ready() 2023-01-23 11:26:50 +00:00
erdma_cm.h RDMA/erdma: Unify byte ordering APIs usage 2023-03-22 13:10:46 +02:00
erdma_cmdq.c RDMA/erdma: Minor refactor of device init flow 2023-03-22 13:10:46 +02:00
erdma_cq.c v6.4 merge window RDMA pull request 2023-04-29 17:21:24 -07:00
erdma_eq.c RDMA/erdma: Eliminate unnecessary casting of EQ doorbells 2023-03-22 13:10:46 +02:00
erdma_hw.h RDMA/erdma: Implement hierarchical MTT 2023-08-19 14:41:01 +03:00
erdma_main.c RDMA/erdma: Refactor the original doorbell allocation mechanism 2023-06-11 11:57:01 +03:00
erdma_qp.c RDMA/erdma: Refactor the storage structure of MTT entries 2023-08-19 14:40:30 +03:00
erdma_verbs.c RDMA/erdma: Fix NULL pointer access in regmr_cmd 2023-09-18 10:42:19 +03:00
erdma_verbs.h RDMA/erdma: Implement hierarchical MTT 2023-08-19 14:41:01 +03:00
erdma.h RDMA/erdma: Refactor the original doorbell allocation mechanism 2023-06-11 11:57:01 +03:00
Kconfig RDMA/erdma: Add driver to kernel build environment 2022-07-27 16:04:05 -03:00
Makefile RDMA/erdma: Add driver to kernel build environment 2022-07-27 16:04:05 -03:00