Skip to content

Commit ee84146

Browse files
Yuuoniyrleon
authored andcommitted
RDMA/erdma: Fix refcount leak in erdma_mmap
rdma_user_mmap_entry_get() take reference, we should release it when not need anymore, add the missing rdma_user_mmap_entry_put() in the error path to fix it. Fixes: 1550557 ("RDMA/erdma: Add verbs implementation") Signed-off-by: Miaoqian Lin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: Cheng Xu <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent cab30a9 commit ee84146

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/infiniband/hw/erdma/erdma_verbs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1110,12 +1110,14 @@ int erdma_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma)
11101110
prot = pgprot_device(vma->vm_page_prot);
11111111
break;
11121112
default:
1113-
return -EINVAL;
1113+
err = -EINVAL;
1114+
goto put_entry;
11141115
}
11151116

11161117
err = rdma_user_mmap_io(ctx, vma, PFN_DOWN(entry->address), PAGE_SIZE,
11171118
prot, rdma_entry);
11181119

1120+
put_entry:
11191121
rdma_user_mmap_entry_put(rdma_entry);
11201122
return err;
11211123
}

0 commit comments

Comments
 (0)