Skip to content

Commit 54e7e48

Browse files
Awik84dledford
authored andcommitted
IB/uverbs: Fix kernel crash during MR deregistration flow
This patch fixes a crash that happens due to access to an uninitialized DM pointer within the MR object. The change makes sure the DM pointer in the MR object is set to NULL during a non-DM MR creation to prevent a false indication that this MR is related to a DM in the dereg flow. Fixes: be934cc ("IB/uverbs: Add device memory registration ioctl support") Reported-by: Lijun Ou <[email protected]> Signed-off-by: Ariel Levkovich <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 5ccbf63 commit 54e7e48

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -691,6 +691,7 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
691691

692692
mr->device = pd->device;
693693
mr->pd = pd;
694+
mr->dm = NULL;
694695
mr->uobject = uobj;
695696
atomic_inc(&pd->usecnt);
696697
mr->res.type = RDMA_RESTRACK_MR;

drivers/infiniband/core/verbs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,6 +1656,7 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd,
16561656
if (!IS_ERR(mr)) {
16571657
mr->device = pd->device;
16581658
mr->pd = pd;
1659+
mr->dm = NULL;
16591660
mr->uobject = NULL;
16601661
atomic_inc(&pd->usecnt);
16611662
mr->need_inval = false;

0 commit comments

Comments
 (0)