summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Dudau <Adrian.Dudau@enea.com>2018-10-12 14:03:55 +0200
committerGerrit Code Review <gerrit2@sestogerrit02>2018-10-12 14:03:55 +0200
commit58665fc89591736d369c90c985252b4059a564fe (patch)
treee45941cb24c125e0fc824c1165cdec155dc8d7e1
parent6f22577823a2d818760a1ad9898963c467f85e96 (diff)
parent367a52ce054c9cdc5bd389349c42000c7c2f0d56 (diff)
downloadenea-kernel-cache-58665fc89591736d369c90c985252b4059a564fe.tar.gz
Merge "infiniband: CVE-2018-14734" into intel-4.9
-rw-r--r--patches/cve/4.9.x.scc2
-rw-r--r--patches/cve/CVE-2018-14734-infiniband-fix-a-possible-use-after-free-bug.patch58
2 files changed, 60 insertions, 0 deletions
diff --git a/patches/cve/4.9.x.scc b/patches/cve/4.9.x.scc
new file mode 100644
index 0000000..fb8cc06
--- /dev/null
+++ b/patches/cve/4.9.x.scc
@@ -0,0 +1,2 @@
1#CVEs fixed in 4.9.117:
2patch CVE-2018-14734-infiniband-fix-a-possible-use-after-free-bug.patch
diff --git a/patches/cve/CVE-2018-14734-infiniband-fix-a-possible-use-after-free-bug.patch b/patches/cve/CVE-2018-14734-infiniband-fix-a-possible-use-after-free-bug.patch
new file mode 100644
index 0000000..4756a18
--- /dev/null
+++ b/patches/cve/CVE-2018-14734-infiniband-fix-a-possible-use-after-free-bug.patch
@@ -0,0 +1,58 @@
1From cb2595c1393b4a5211534e6f0a0fbad369e21ad8 Mon Sep 17 00:00:00 2001
2From: Cong Wang <xiyou.wangcong@gmail.com>
3Date: Fri, 1 Jun 2018 11:31:44 -0700
4Subject: [PATCH] infiniband: fix a possible use-after-free bug
5
6ucma_process_join() will free the new allocated "mc" struct,
7if there is any error after that, especially the copy_to_user().
8
9But in parallel, ucma_leave_multicast() could find this "mc"
10through idr_find() before ucma_process_join() frees it, since it
11is already published.
12
13So "mc" could be used in ucma_leave_multicast() after it is been
14allocated and freed in ucma_process_join(), since we don't refcnt
15it.
16
17Fix this by separating "publish" from ID allocation, so that we
18can get an ID first and publish it later after copy_to_user().
19
20CVE: CVE-2018-14734
21Upstream-Status: Backport
22
23Fixes: c8f6a362bf3e ("RDMA/cma: Add multicast communication support")
24Reported-by: Noam Rathaus <noamr@beyondsecurity.com>
25Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
26Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
27Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
28---
29 drivers/infiniband/core/ucma.c | 6 +++++-
30 1 file changed, 5 insertions(+), 1 deletion(-)
31
32diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
33index eab43b1..ec8fb28 100644
34--- a/drivers/infiniband/core/ucma.c
35+++ b/drivers/infiniband/core/ucma.c
36@@ -235,7 +235,7 @@ static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx)
37 return NULL;
38
39 mutex_lock(&mut);
40- mc->id = idr_alloc(&multicast_idr, mc, 0, 0, GFP_KERNEL);
41+ mc->id = idr_alloc(&multicast_idr, NULL, 0, 0, GFP_KERNEL);
42 mutex_unlock(&mut);
43 if (mc->id < 0)
44 goto error;
45@@ -1421,6 +1421,10 @@ static ssize_t ucma_process_join(struct ucma_file *file,
46 goto err3;
47 }
48
49+ mutex_lock(&mut);
50+ idr_replace(&multicast_idr, mc, mc->id);
51+ mutex_unlock(&mut);
52+
53 mutex_unlock(&file->mut);
54 ucma_put_ctx(ctx);
55 return 0;
56--
572.7.4
58