diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2018-03-19 15:20:15 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-03-19 23:01:35 +0300 |
commit | ed65a4dc22083e73bac599ded6a262318cad7baf (patch) | |
tree | 65a163114b83699744dcbd7f299afbe1c6ca28e3 /drivers/infiniband/core | |
parent | 2975d5de6428ff6d9317e9948f0968f7d42e5d74 (diff) | |
download | linux-ed65a4dc22083e73bac599ded6a262318cad7baf.tar.xz |
RDMA/ucma: Fix use-after-free access in ucma_close
The error in ucma_create_id() left ctx in the list of contexts belong
to ucma file descriptor. The attempt to close this file descriptor causes
to use-after-free accesses while iterating over such list.
Fixes: 75216638572f ("RDMA/cma: Export rdma cm interface to userspace")
Reported-by: <syzbot+dcfd344365a56fbebd0f@syzkaller.appspotmail.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Reviewed-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/ucma.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c index 3f3f7bbc4528..14c260ed63cb 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -497,6 +497,9 @@ err1: mutex_lock(&mut); idr_remove(&ctx_idr, ctx->id); mutex_unlock(&mut); + mutex_lock(&file->mut); + list_del(&ctx->list); + mutex_unlock(&file->mut); kfree(ctx); return ret; } |