提交 8435168d 编写于 作者: R Roland Dreier 提交者: Jason Gunthorpe

RDMA/ucma: Don't allow setting RDMA_OPTION_IB_PATH without an RDMA device

Check to make sure that ctx->cm_id->device is set before we use it.
Otherwise userspace can trigger a NULL dereference by doing
RDMA_USER_CM_CMD_SET_OPTION on an ID that is not bound to a device.

Cc: <stable@vger.kernel.org>
Reported-by: <syzbot+a67bc93e14682d92fc2f@syzkaller.appspotmail.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 ca486a3b
...@@ -1231,6 +1231,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx, ...@@ -1231,6 +1231,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx,
if (!optlen) if (!optlen)
return -EINVAL; return -EINVAL;
if (!ctx->cm_id->device)
return -EINVAL;
memset(&sa_path, 0, sizeof(sa_path)); memset(&sa_path, 0, sizeof(sa_path));
sa_path.rec_type = SA_PATH_REC_TYPE_IB; sa_path.rec_type = SA_PATH_REC_TYPE_IB;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册