summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Wellving <andreas.wellving@enea.com>2018-10-17 15:08:48 +0200
committerAndreas Wellving <andreas.wellving@enea.com>2018-10-25 13:21:05 +0200
commit260a690d270fd1273f841e65a7eebea46ab34bfc (patch)
tree05bca464c1c356fd4629395fb977d0406af4a7eb
parent7b270f1e59dd4bf0eb91eb9c8955afa51a3deee7 (diff)
downloadenea-kernel-cache-260a690d270fd1273f841e65a7eebea46ab34bfc.tar.gz
packet: CVE-2017-1000111
packet: fix tp_reserve race in packet_set_ring References: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.1.y&id=b7761b0cd80d832e40a46ec0078ab02596dbc350 Change-Id: Ie32504e8ed6d2aefe350f9e501dca7236c3085ed Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
-rw-r--r--patches/cve/4.1.x.scc3
-rw-r--r--patches/cve/CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch53
2 files changed, 56 insertions, 0 deletions
diff --git a/patches/cve/4.1.x.scc b/patches/cve/4.1.x.scc
index 60a7c67..6386a9b 100644
--- a/patches/cve/4.1.x.scc
+++ b/patches/cve/4.1.x.scc
@@ -19,3 +19,6 @@ patch CVE-2017-9074-ipv6-Prevent-overrun-when-parsing-v6-header-options.patch
19#fixed in 4.1.43 19#fixed in 4.1.43
20patch CVE-2017-18017-netfilter-xt_TCPMSS-add-more-sanity-tests-on-tcph-do.patch 20patch CVE-2017-18017-netfilter-xt_TCPMSS-add-more-sanity-tests-on-tcph-do.patch
21 21
22#fixed in 4.1.44
23patch CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch
24
diff --git a/patches/cve/CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch b/patches/cve/CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch
new file mode 100644
index 0000000..6e3f5a4
--- /dev/null
+++ b/patches/cve/CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch
@@ -0,0 +1,53 @@
1From 79373d4f60b9167bb68ce2c7d8decc8c3b66cc43 Mon Sep 17 00:00:00 2001
2From: Andreas Wellving <andreas.wellving@enea.com>
3Date: Wed, 17 Oct 2018 12:38:53 +0200
4Subject: [PATCH] packet: fix tp_reserve race in packet_set_ring
5
6[ Upstream commit c27927e372f0785f3303e8fad94b85945e2c97b7 ]
7
8Updates to tp_reserve can race with reads of the field in
9packet_set_ring. Avoid this by holding the socket lock during
10updates in setsockopt PACKET_RESERVE.
11
12This bug was discovered by syzkaller.
13
14CVE: CVE-2017-1000111
15Upstream-Status: Backport
16
17Fixes: 8913336a7e8d ("packet: add PACKET_RESERVE sockopt")
18Reported-by: Andrey Konovalov <andreyknvl@google.com>
19Signed-off-by: Willem de Bruijn <willemb@google.com>
20Signed-off-by: David S. Miller <davem@davemloft.net>
21Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
22Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
23---
24 net/packet/af_packet.c | 13 +++++++++----
25 1 file changed, 9 insertions(+), 4 deletions(-)
26
27diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
28index 7c1054d..7bd5e7f 100644
29@@ -3365,12 +3373,17 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
30
31 if (optlen != sizeof(val))
32 return -EINVAL;
33- if (po->rx_ring.pg_vec || po->tx_ring.pg_vec)
34- return -EBUSY;
35 if (copy_from_user(&val, optval, sizeof(val)))
36 return -EFAULT;
37- po->tp_reserve = val;
38- return 0;
39+ lock_sock(sk);
40+ if (po->rx_ring.pg_vec || po->tx_ring.pg_vec) {
41+ ret = -EBUSY;
42+ } else {
43+ po->tp_reserve = val;
44+ ret = 0;
45+ }
46+ release_sock(sk);
47+ return ret;
48 }
49 case PACKET_LOSS:
50 {
51---
52
53