diff options
-rw-r--r-- | patches/cve/4.1.x.scc | 3 | ||||
-rw-r--r-- | patches/cve/CVE-2017-1000111-packet-fix-tp_reserve-race-in-packet_set_ring.patch | 53 |
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 |
20 | patch CVE-2017-18017-netfilter-xt_TCPMSS-add-more-sanity-tests-on-tcph-do.patch | 20 | patch CVE-2017-18017-netfilter-xt_TCPMSS-add-more-sanity-tests-on-tcph-do.patch |
21 | 21 | ||
22 | #fixed in 4.1.44 | ||
23 | patch 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 @@ | |||
1 | From 79373d4f60b9167bb68ce2c7d8decc8c3b66cc43 Mon Sep 17 00:00:00 2001 | ||
2 | From: Andreas Wellving <andreas.wellving@enea.com> | ||
3 | Date: Wed, 17 Oct 2018 12:38:53 +0200 | ||
4 | Subject: [PATCH] packet: fix tp_reserve race in packet_set_ring | ||
5 | |||
6 | [ Upstream commit c27927e372f0785f3303e8fad94b85945e2c97b7 ] | ||
7 | |||
8 | Updates to tp_reserve can race with reads of the field in | ||
9 | packet_set_ring. Avoid this by holding the socket lock during | ||
10 | updates in setsockopt PACKET_RESERVE. | ||
11 | |||
12 | This bug was discovered by syzkaller. | ||
13 | |||
14 | CVE: CVE-2017-1000111 | ||
15 | Upstream-Status: Backport | ||
16 | |||
17 | Fixes: 8913336a7e8d ("packet: add PACKET_RESERVE sockopt") | ||
18 | Reported-by: Andrey Konovalov <andreyknvl@google.com> | ||
19 | Signed-off-by: Willem de Bruijn <willemb@google.com> | ||
20 | Signed-off-by: David S. Miller <davem@davemloft.net> | ||
21 | Signed-off-by: Sasha Levin <alexander.levin@verizon.com> | ||
22 | Signed-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 | |||
27 | diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c | ||
28 | index 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 | |||