mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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: <[email protected]> Reported-by: <[email protected]> Signed-off-by: Roland Dreier <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
This commit is contained in:
parent
ca486a3b33
commit
8435168d50
1 changed files with 3 additions and 0 deletions
|
|
@ -1231,6 +1231,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx,
|
|||
if (!optlen)
|
||||
return -EINVAL;
|
||||
|
||||
if (!ctx->cm_id->device)
|
||||
return -EINVAL;
|
||||
|
||||
memset(&sa_path, 0, sizeof(sa_path));
|
||||
|
||||
sa_path.rec_type = SA_PATH_REC_TYPE_IB;
|
||||
|
|
|
|||
Loading…
Reference in a new issue