]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Nov 2020 09:42:58 +0000 (10:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Nov 2020 09:42:58 +0000 (10:42 +0100)
added patches:
ipv6-set-sit-tunnel-hard_header_len-to-zero.patch
net-af_iucv-fix-null-pointer-dereference-on-shutdown.patch
net-update-window_clamp-if-sock_rcvbuf-is-set.patch
net-x25-fix-null-ptr-deref-in-x25_connect.patch

queue-4.4/ipv6-set-sit-tunnel-hard_header_len-to-zero.patch [new file with mode: 0644]
queue-4.4/net-af_iucv-fix-null-pointer-dereference-on-shutdown.patch [new file with mode: 0644]
queue-4.4/net-update-window_clamp-if-sock_rcvbuf-is-set.patch [new file with mode: 0644]
queue-4.4/net-x25-fix-null-ptr-deref-in-x25_connect.patch [new file with mode: 0644]
queue-4.4/series

diff --git a/queue-4.4/ipv6-set-sit-tunnel-hard_header_len-to-zero.patch b/queue-4.4/ipv6-set-sit-tunnel-hard_header_len-to-zero.patch
new file mode 100644 (file)
index 0000000..153ff09
--- /dev/null
@@ -0,0 +1,52 @@
+From foo@baz Tue Nov 17 10:41:39 AM CET 2020
+From: Oliver Herms <oliver.peter.herms@gmail.com>
+Date: Tue, 3 Nov 2020 11:41:33 +0100
+Subject: IPv6: Set SIT tunnel hard_header_len to zero
+
+From: Oliver Herms <oliver.peter.herms@gmail.com>
+
+[ Upstream commit 8ef9ba4d666614497a057d09b0a6eafc1e34eadf ]
+
+Due to the legacy usage of hard_header_len for SIT tunnels while
+already using infrastructure from net/ipv4/ip_tunnel.c the
+calculation of the path MTU in tnl_update_pmtu is incorrect.
+This leads to unnecessary creation of MTU exceptions for any
+flow going over a SIT tunnel.
+
+As SIT tunnels do not have a header themsevles other than their
+transport (L3, L2) headers we're leaving hard_header_len set to zero
+as tnl_update_pmtu is already taking care of the transport headers
+sizes.
+
+This will also help avoiding unnecessary IPv6 GC runs and spinlock
+contention seen when using SIT tunnels and for more than
+net.ipv6.route.gc_thresh flows.
+
+Fixes: c54419321455 ("GRE: Refactor GRE tunneling code.")
+Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
+Acked-by: Willem de Bruijn <willemb@google.com>
+Link: https://lore.kernel.org/r/20201103104133.GA1573211@tws
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/sit.c |    2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/net/ipv6/sit.c
++++ b/net/ipv6/sit.c
+@@ -1079,7 +1079,6 @@ static void ipip6_tunnel_bind_dev(struct
+       if (tdev && !netif_is_l3_master(tdev)) {
+               int t_hlen = tunnel->hlen + sizeof(struct iphdr);
+-              dev->hard_header_len = tdev->hard_header_len + sizeof(struct iphdr);
+               dev->mtu = tdev->mtu - t_hlen;
+               if (dev->mtu < IPV6_MIN_MTU)
+                       dev->mtu = IPV6_MIN_MTU;
+@@ -1371,7 +1370,6 @@ static void ipip6_tunnel_setup(struct ne
+       dev->destructor         = ipip6_dev_free;
+       dev->type               = ARPHRD_SIT;
+-      dev->hard_header_len    = LL_MAX_HEADER + t_hlen;
+       dev->mtu                = ETH_DATA_LEN - t_hlen;
+       dev->flags              = IFF_NOARP;
+       netif_keep_dst(dev);
diff --git a/queue-4.4/net-af_iucv-fix-null-pointer-dereference-on-shutdown.patch b/queue-4.4/net-af_iucv-fix-null-pointer-dereference-on-shutdown.patch
new file mode 100644 (file)
index 0000000..0a8ec19
--- /dev/null
@@ -0,0 +1,61 @@
+From foo@baz Tue Nov 17 10:41:39 AM CET 2020
+From: Ursula Braun <ubraun@linux.ibm.com>
+Date: Mon, 9 Nov 2020 08:57:05 +0100
+Subject: net/af_iucv: fix null pointer dereference on shutdown
+
+From: Ursula Braun <ubraun@linux.ibm.com>
+
+[ Upstream commit 4031eeafa71eaf22ae40a15606a134ae86345daf ]
+
+syzbot reported the following KASAN finding:
+
+BUG: KASAN: nullptr-dereference in iucv_send_ctrl+0x390/0x3f0 net/iucv/af_iucv.c:385
+Read of size 2 at addr 000000000000021e by task syz-executor907/519
+
+CPU: 0 PID: 519 Comm: syz-executor907 Not tainted 5.9.0-syzkaller-07043-gbcf9877ad213 #0
+Hardware name: IBM 3906 M04 701 (KVM/Linux)
+Call Trace:
+ [<00000000c576af60>] unwind_start arch/s390/include/asm/unwind.h:65 [inline]
+ [<00000000c576af60>] show_stack+0x180/0x228 arch/s390/kernel/dumpstack.c:135
+ [<00000000c9dcd1f8>] __dump_stack lib/dump_stack.c:77 [inline]
+ [<00000000c9dcd1f8>] dump_stack+0x268/0x2f0 lib/dump_stack.c:118
+ [<00000000c5fed016>] print_address_description.constprop.0+0x5e/0x218 mm/kasan/report.c:383
+ [<00000000c5fec82a>] __kasan_report mm/kasan/report.c:517 [inline]
+ [<00000000c5fec82a>] kasan_report+0x11a/0x168 mm/kasan/report.c:534
+ [<00000000c98b5b60>] iucv_send_ctrl+0x390/0x3f0 net/iucv/af_iucv.c:385
+ [<00000000c98b6262>] iucv_sock_shutdown+0x44a/0x4c0 net/iucv/af_iucv.c:1457
+ [<00000000c89d3a54>] __sys_shutdown+0x12c/0x1c8 net/socket.c:2204
+ [<00000000c89d3b70>] __do_sys_shutdown net/socket.c:2212 [inline]
+ [<00000000c89d3b70>] __s390x_sys_shutdown+0x38/0x48 net/socket.c:2210
+ [<00000000c9e36eac>] system_call+0xe0/0x28c arch/s390/kernel/entry.S:415
+
+There is nothing to shutdown if a connection has never been established.
+Besides that iucv->hs_dev is not yet initialized if a socket is in
+IUCV_OPEN state and iucv->path is not yet initialized if socket is in
+IUCV_BOUND state.
+So, just skip the shutdown calls for a socket in these states.
+
+Fixes: eac3731bd04c ("[S390]: Add AF_IUCV socket support")
+Fixes: 82492a355fac ("af_iucv: add shutdown for HS transport")
+Reviewed-by: Vasily Gorbik <gor@linux.ibm.com>
+Signed-off-by: Ursula Braun <ubraun@linux.ibm.com>
+[jwi: correct one Fixes tag]
+Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/iucv/af_iucv.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/iucv/af_iucv.c
++++ b/net/iucv/af_iucv.c
+@@ -1513,7 +1513,8 @@ static int iucv_sock_shutdown(struct soc
+               break;
+       }
+-      if (how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) {
++      if ((how == SEND_SHUTDOWN || how == SHUTDOWN_MASK) &&
++          sk->sk_state == IUCV_CONNECTED) {
+               if (iucv->transport == AF_IUCV_TRANS_IUCV) {
+                       txmsg.class = 0;
+                       txmsg.tag = 0;
diff --git a/queue-4.4/net-update-window_clamp-if-sock_rcvbuf-is-set.patch b/queue-4.4/net-update-window_clamp-if-sock_rcvbuf-is-set.patch
new file mode 100644 (file)
index 0000000..b683e74
--- /dev/null
@@ -0,0 +1,82 @@
+From foo@baz Tue Nov 17 10:36:22 AM CET 2020
+From: Mao Wenan <wenan.mao@linux.alibaba.com>
+Date: Tue, 10 Nov 2020 08:16:31 +0800
+Subject: net: Update window_clamp if SOCK_RCVBUF is set
+
+From: Mao Wenan <wenan.mao@linux.alibaba.com>
+
+[ Upstream commit 909172a149749242990a6e64cb55d55460d4e417 ]
+
+When net.ipv4.tcp_syncookies=1 and syn flood is happened,
+cookie_v4_check or cookie_v6_check tries to redo what
+tcp_v4_send_synack or tcp_v6_send_synack did,
+rsk_window_clamp will be changed if SOCK_RCVBUF is set,
+which will make rcv_wscale is different, the client
+still operates with initial window scale and can overshot
+granted window, the client use the initial scale but local
+server use new scale to advertise window value, and session
+work abnormally.
+
+Fixes: e88c64f0a425 ("tcp: allow effective reduction of TCP's rcv-buffer via setsockopt")
+Signed-off-by: Mao Wenan <wenan.mao@linux.alibaba.com>
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/1604967391-123737-1-git-send-email-wenan.mao@linux.alibaba.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/syncookies.c |    9 +++++++--
+ net/ipv6/syncookies.c |   10 ++++++++--
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+--- a/net/ipv4/syncookies.c
++++ b/net/ipv4/syncookies.c
+@@ -307,7 +307,7 @@ struct sock *cookie_v4_check(struct sock
+       __u32 cookie = ntohl(th->ack_seq) - 1;
+       struct sock *ret = sk;
+       struct request_sock *req;
+-      int mss;
++      int full_space, mss;
+       struct rtable *rt;
+       __u8 rcv_wscale;
+       struct flowi4 fl4;
+@@ -391,8 +391,13 @@ struct sock *cookie_v4_check(struct sock
+       /* Try to redo what tcp_v4_send_synack did. */
+       req->rsk_window_clamp = tp->window_clamp ? :dst_metric(&rt->dst, RTAX_WINDOW);
++      /* limit the window selection if the user enforce a smaller rx buffer */
++      full_space = tcp_full_space(sk);
++      if (sk->sk_userlocks & SOCK_RCVBUF_LOCK &&
++          (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0))
++              req->rsk_window_clamp = full_space;
+-      tcp_select_initial_window(tcp_full_space(sk), req->mss,
++      tcp_select_initial_window(full_space, req->mss,
+                                 &req->rsk_rcv_wnd, &req->rsk_window_clamp,
+                                 ireq->wscale_ok, &rcv_wscale,
+                                 dst_metric(&rt->dst, RTAX_INITRWND));
+--- a/net/ipv6/syncookies.c
++++ b/net/ipv6/syncookies.c
+@@ -144,7 +144,7 @@ struct sock *cookie_v6_check(struct sock
+       __u32 cookie = ntohl(th->ack_seq) - 1;
+       struct sock *ret = sk;
+       struct request_sock *req;
+-      int mss;
++      int full_space, mss;
+       struct dst_entry *dst;
+       __u8 rcv_wscale;
+@@ -237,7 +237,13 @@ struct sock *cookie_v6_check(struct sock
+       }
+       req->rsk_window_clamp = tp->window_clamp ? :dst_metric(dst, RTAX_WINDOW);
+-      tcp_select_initial_window(tcp_full_space(sk), req->mss,
++      /* limit the window selection if the user enforce a smaller rx buffer */
++      full_space = tcp_full_space(sk);
++      if (sk->sk_userlocks & SOCK_RCVBUF_LOCK &&
++          (req->rsk_window_clamp > full_space || req->rsk_window_clamp == 0))
++              req->rsk_window_clamp = full_space;
++
++      tcp_select_initial_window(full_space, req->mss,
+                                 &req->rsk_rcv_wnd, &req->rsk_window_clamp,
+                                 ireq->wscale_ok, &rcv_wscale,
+                                 dst_metric(dst, RTAX_INITRWND));
diff --git a/queue-4.4/net-x25-fix-null-ptr-deref-in-x25_connect.patch b/queue-4.4/net-x25-fix-null-ptr-deref-in-x25_connect.patch
new file mode 100644 (file)
index 0000000..db57d69
--- /dev/null
@@ -0,0 +1,39 @@
+From foo@baz Tue Nov 17 10:41:39 AM CET 2020
+From: Martin Schiller <ms@dev.tdt.de>
+Date: Mon, 9 Nov 2020 07:54:49 +0100
+Subject: net/x25: Fix null-ptr-deref in x25_connect
+
+From: Martin Schiller <ms@dev.tdt.de>
+
+[ Upstream commit 361182308766a265b6c521879b34302617a8c209 ]
+
+This fixes a regression for blocking connects introduced by commit
+4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect").
+
+The x25->neighbour is already set to "NULL" by x25_disconnect() now,
+while a blocking connect is waiting in
+x25_wait_for_connection_establishment(). Therefore x25->neighbour must
+not be accessed here again and x25->state is also already set to
+X25_STATE_0 by x25_disconnect().
+
+Fixes: 4becb7ee5b3d ("net/x25: Fix x25_neigh refcnt leak when x25 disconnect")
+Signed-off-by: Martin Schiller <ms@dev.tdt.de>
+Reviewed-by: Xie He <xie.he.0141@gmail.com>
+Link: https://lore.kernel.org/r/20201109065449.9014-1-ms@dev.tdt.de
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/x25/af_x25.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/x25/af_x25.c
++++ b/net/x25/af_x25.c
+@@ -823,7 +823,7 @@ static int x25_connect(struct socket *so
+       sock->state = SS_CONNECTED;
+       rc = 0;
+ out_put_neigh:
+-      if (rc) {
++      if (rc && x25->neighbour) {
+               read_lock_bh(&x25_list_lock);
+               x25_neigh_put(x25->neighbour);
+               x25->neighbour = NULL;
index a3918d6bb4279becd6e37b236ff7795dc450216a..0398ec949cf537ce10647ecca71379b971f62c5b 100644 (file)
@@ -39,3 +39,7 @@ drm-gma500-fix-out-of-bounds-access-to-struct-drm_device.vblank.patch
 pinctrl-amd-use-higher-precision-for-512-rtcclk.patch
 pinctrl-amd-fix-incorrect-way-to-disable-debounce-filter.patch
 swiotlb-fix-x86-don-t-panic-if-can-not-alloc-buffer-for-swiotlb.patch
+ipv6-set-sit-tunnel-hard_header_len-to-zero.patch
+net-af_iucv-fix-null-pointer-dereference-on-shutdown.patch
+net-x25-fix-null-ptr-deref-in-x25_connect.patch
+net-update-window_clamp-if-sock_rcvbuf-is-set.patch