diff options
author | 2018-03-19 14:20:15 +0200 | |
---|---|---|
committer | 2018-06-01 00:30:23 +0100 | |
commit | e78759ba4d27ab2f19b285f666887bf4d00b7514 (patch) | |
tree | d36c126e036dd676dda92369fad59a6ee214be3e | |
parent | ALSA: usb-audio: Fix parsing descriptor of UAC2 processing unit (diff) | |
download | linux-stable-e78759ba4d27ab2f19b285f666887bf4d00b7514.tar.xz linux-stable-e78759ba4d27ab2f19b285f666887bf4d00b7514.zip |
RDMA/ucma: Fix use-after-free access in ucma_close
commit ed65a4dc22083e73bac599ded6a262318cad7baf upstream.
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>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-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 4396ab6df02a..0a8a39ce332e 100644 --- a/drivers/infiniband/core/ucma.c +++ b/drivers/infiniband/core/ucma.c @@ -433,6 +433,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; } |