nvmet-rdma: fix null dereference under heavy load
authorRaju Rangoju <rajur@chelsio.com>
Thu, 3 Jan 2019 17:35:31 +0000 (23:05 +0530)
committerJens Axboe <axboe@kernel.dk>
Thu, 24 Jan 2019 00:16:59 +0000 (17:16 -0700)
commit5cbab6303b4791a3e6713dfe2c5fda6a867f9adc
tree1585daaacf96e9b150e616cff6b2a1d32aaa1fc8
parentb1064d3e337b4d0b67d641b5f771187d8f1f027d
nvmet-rdma: fix null dereference under heavy load

Under heavy load if we don't have any pre-allocated rsps left, we
dynamically allocate a rsp, but we are not actually allocating memory
for nvme_completion (rsp->req.rsp). In such a case, accessing pointer
fields (req->rsp->status) in nvmet_req_init() will result in crash.

To fix this, allocate the memory for nvme_completion by calling
nvmet_rdma_alloc_rsp()

Fixes: 8407879c("nvmet-rdma:fix possible bogus dereference under heavy load")

Cc: <stable@vger.kernel.org>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Raju Rangoju <rajur@chelsio.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/target/rdma.c