mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
RDMA/ucma: Check that device exists prior to accessing it
Ensure that device exists prior to accessing its properties.
Reported-by: <syzbot+71655d44855ac3e76366@syzkaller.appspotmail.com>
Fixes: 7521663857
("RDMA/cma: Export rdma cm interface to userspace")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
parent
4b658d1bbc
commit
c8d3bcbfc5
1 changed files with 4 additions and 2 deletions
|
@ -1336,7 +1336,7 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf,
|
||||||
{
|
{
|
||||||
struct rdma_ucm_notify cmd;
|
struct rdma_ucm_notify cmd;
|
||||||
struct ucma_context *ctx;
|
struct ucma_context *ctx;
|
||||||
int ret;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
|
if (copy_from_user(&cmd, inbuf, sizeof(cmd)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
@ -1345,7 +1345,9 @@ static ssize_t ucma_notify(struct ucma_file *file, const char __user *inbuf,
|
||||||
if (IS_ERR(ctx))
|
if (IS_ERR(ctx))
|
||||||
return PTR_ERR(ctx);
|
return PTR_ERR(ctx);
|
||||||
|
|
||||||
ret = rdma_notify(ctx->cm_id, (enum ib_event_type) cmd.event);
|
if (ctx->cm_id->device)
|
||||||
|
ret = rdma_notify(ctx->cm_id, (enum ib_event_type)cmd.event);
|
||||||
|
|
||||||
ucma_put_ctx(ctx);
|
ucma_put_ctx(ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue