aboutsummaryrefslogtreecommitdiff
path: root/sys/ofed
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2022-06-13 14:55:14 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2022-06-13 15:00:16 +0000
commit66a0bc2105e43e54abfaa9f48b76c28371fa2d62 (patch)
tree5dc370e602eae6fb31a3830a5be172b6e8f9490a /sys/ofed
parente4d178d093281419c5ad9dea1c497bceb54d0018 (diff)
downloadsrc-66a0bc2105e43e54abfaa9f48b76c28371fa2d62.tar.gz
src-66a0bc2105e43e54abfaa9f48b76c28371fa2d62.zip
ibcore: 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. Linux commit: ed65a4dc22083e73bac599ded6a262318cad7baf PR: 264650 MFC after: 1 week Sponsored by: NVIDIA Networking
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/drivers/infiniband/core/ib_ucma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/ofed/drivers/infiniband/core/ib_ucma.c b/sys/ofed/drivers/infiniband/core/ib_ucma.c
index 878e4d348234..0082c60f0b6c 100644
--- a/sys/ofed/drivers/infiniband/core/ib_ucma.c
+++ b/sys/ofed/drivers/infiniband/core/ib_ucma.c
@@ -508,6 +508,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;
}