Skip to content

Commit a5880b8

Browse files
Leon Romanovskydledford
authored andcommitted
RDMA/ucma: Check that user doesn't overflow QP state
The QP state is limited and declared in enum ib_qp_state, but ucma user was able to supply any possible (u32) value. Reported-by: syzbot+0df1ab766f8924b1edba@syzkaller.appspotmail.com Fixes: 7521663 ("RDMA/cma: Export rdma cm interface to userspace") Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent aa0de36 commit a5880b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/infiniband/core/ucma.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,
11491149
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
11501150
return -EFAULT;
11511151

1152+
if (cmd.qp_state > IB_QPS_ERR)
1153+
return -EINVAL;
1154+
11521155
ctx = ucma_get_ctx(file, cmd.id);
11531156
if (IS_ERR(ctx))
11541157
return PTR_ERR(ctx);

0 commit comments

Comments
 (0)