From: Greg Kroah-Hartman Date: Sat, 24 Oct 2020 09:17:05 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v4.4.241~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9f61a5cc70fb899ed04ed9a69ebf028e66e9e284;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: chelsio-chtls-correct-function-return-and-return-type.patch chelsio-chtls-correct-netdevice-for-vlan-interface.patch chelsio-chtls-fix-socket-lock.patch icmp-randomize-the-global-rate-limiter.patch net-hdlc-in-hdlc_rcv-check-to-make-sure-dev-is-an-hdlc-device.patch net-hdlc_raw_eth-clear-the-iff_tx_skb_sharing-flag-after-calling-ether_setup.patch net-sched-act_tunnel_key-fix-oob-write-in-case-of-ipv6-erspan-tunnels.patch nfc-ensure-presence-of-nfc_attr_firmware_name-attribute-in-nfc_genl_fw_download.patch r8169-fix-operation-under-forced-interrupt-threading.patch tcp-fix-to-update-snd_wl1-in-bulk-receiver-fast-path.patch --- diff --git a/queue-4.19/chelsio-chtls-correct-function-return-and-return-type.patch b/queue-4.19/chelsio-chtls-correct-function-return-and-return-type.patch new file mode 100644 index 00000000000..661a4517673 --- /dev/null +++ b/queue-4.19/chelsio-chtls-correct-function-return-and-return-type.patch @@ -0,0 +1,34 @@ +From foo@baz Sat Oct 24 11:10:05 AM CEST 2020 +From: Vinay Kumar Yadav +Date: Mon, 19 Oct 2020 17:20:24 +0530 +Subject: chelsio/chtls: correct function return and return type + +From: Vinay Kumar Yadav + +[ Upstream commit 8580a61aede28d441e1c80588803411ee86aa299 ] + +csk_mem_free() should return true if send buffer is available, +false otherwise. + +Fixes: 3b8305f5c844 ("crypto: chtls - wait for memory sendmsg, sendpage") +Signed-off-by: Vinay Kumar Yadav +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/chelsio/chtls/chtls_io.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/crypto/chelsio/chtls/chtls_io.c ++++ b/drivers/crypto/chelsio/chtls/chtls_io.c +@@ -914,9 +914,9 @@ static int tls_header_read(struct tls_hd + return (__force int)cpu_to_be16(thdr->length); + } + +-static int csk_mem_free(struct chtls_dev *cdev, struct sock *sk) ++static bool csk_mem_free(struct chtls_dev *cdev, struct sock *sk) + { +- return (cdev->max_host_sndbuf - sk->sk_wmem_queued); ++ return (cdev->max_host_sndbuf - sk->sk_wmem_queued > 0); + } + + static int csk_wait_memory(struct chtls_dev *cdev, diff --git a/queue-4.19/chelsio-chtls-correct-netdevice-for-vlan-interface.patch b/queue-4.19/chelsio-chtls-correct-netdevice-for-vlan-interface.patch new file mode 100644 index 00000000000..1ed01b7c7cb --- /dev/null +++ b/queue-4.19/chelsio-chtls-correct-netdevice-for-vlan-interface.patch @@ -0,0 +1,32 @@ +From foo@baz Sat Oct 24 11:10:05 AM CEST 2020 +From: Vinay Kumar Yadav +Date: Mon, 19 Oct 2020 17:20:21 +0530 +Subject: chelsio/chtls: correct netdevice for vlan interface + +From: Vinay Kumar Yadav + +[ Upstream commit 81519d1f7df7ed1bd5b1397540c8884438f57ae2 ] + +Check if netdevice is a vlan interface and find real vlan netdevice. + +Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition") +Signed-off-by: Venkatesh Ellapu +Signed-off-by: Vinay Kumar Yadav +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/chelsio/chtls/chtls_cm.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/crypto/chelsio/chtls/chtls_cm.c ++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c +@@ -1057,6 +1057,9 @@ static struct sock *chtls_recv_sock(stru + ndev = n->dev; + if (!ndev) + goto free_dst; ++ if (is_vlan_dev(ndev)) ++ ndev = vlan_dev_real_dev(ndev); ++ + port_id = cxgb4_port_idx(ndev); + + csk = chtls_sock_create(cdev); diff --git a/queue-4.19/chelsio-chtls-fix-socket-lock.patch b/queue-4.19/chelsio-chtls-fix-socket-lock.patch new file mode 100644 index 00000000000..464474c4076 --- /dev/null +++ b/queue-4.19/chelsio-chtls-fix-socket-lock.patch @@ -0,0 +1,30 @@ +From foo@baz Sat Oct 24 11:10:05 AM CEST 2020 +From: Vinay Kumar Yadav +Date: Mon, 19 Oct 2020 17:20:20 +0530 +Subject: chelsio/chtls: fix socket lock + +From: Vinay Kumar Yadav + +[ Upstream commit 0fb5f0160a36d7acaa8e84ce873af99f94b60484 ] + +In chtls_sendpage() socket lock is released but not acquired, +fix it by taking lock. + +Fixes: 36bedb3f2e5b ("crypto: chtls - Inline TLS record Tx") +Signed-off-by: Vinay Kumar Yadav +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/chelsio/chtls/chtls_io.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/crypto/chelsio/chtls/chtls_io.c ++++ b/drivers/crypto/chelsio/chtls/chtls_io.c +@@ -1217,6 +1217,7 @@ int chtls_sendpage(struct sock *sk, stru + copied = 0; + csk = rcu_dereference_sk_user_data(sk); + cdev = csk->cdev; ++ lock_sock(sk); + timeo = sock_sndtimeo(sk, flags & MSG_DONTWAIT); + + err = sk_stream_wait_connect(sk, &timeo); diff --git a/queue-4.19/icmp-randomize-the-global-rate-limiter.patch b/queue-4.19/icmp-randomize-the-global-rate-limiter.patch new file mode 100644 index 00000000000..43b1ba5360d --- /dev/null +++ b/queue-4.19/icmp-randomize-the-global-rate-limiter.patch @@ -0,0 +1,67 @@ +From foo@baz Sat Oct 24 11:00:25 AM CEST 2020 +From: Eric Dumazet +Date: Thu, 15 Oct 2020 11:42:00 -0700 +Subject: icmp: randomize the global rate limiter + +From: Eric Dumazet + +[ Upstream commit b38e7819cae946e2edf869e604af1e65a5d241c5 ] + +Keyu Man reported that the ICMP rate limiter could be used +by attackers to get useful signal. Details will be provided +in an upcoming academic publication. + +Our solution is to add some noise, so that the attackers +no longer can get help from the predictable token bucket limiter. + +Fixes: 4cdf507d5452 ("icmp: add a global rate limitation") +Signed-off-by: Eric Dumazet +Reported-by: Keyu Man +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + Documentation/networking/ip-sysctl.txt | 4 +++- + net/ipv4/icmp.c | 7 +++++-- + 2 files changed, 8 insertions(+), 3 deletions(-) + +--- a/Documentation/networking/ip-sysctl.txt ++++ b/Documentation/networking/ip-sysctl.txt +@@ -934,12 +934,14 @@ icmp_ratelimit - INTEGER + icmp_msgs_per_sec - INTEGER + Limit maximal number of ICMP packets sent per second from this host. + Only messages whose type matches icmp_ratemask (see below) are +- controlled by this limit. ++ controlled by this limit. For security reasons, the precise count ++ of messages per second is randomized. + Default: 1000 + + icmp_msgs_burst - INTEGER + icmp_msgs_per_sec controls number of ICMP packets sent per second, + while icmp_msgs_burst controls the burst size of these packets. ++ For security reasons, the precise burst size is randomized. + Default: 50 + + icmp_ratemask - INTEGER +--- a/net/ipv4/icmp.c ++++ b/net/ipv4/icmp.c +@@ -244,7 +244,7 @@ static struct { + /** + * icmp_global_allow - Are we allowed to send one more ICMP message ? + * +- * Uses a token bucket to limit our ICMP messages to sysctl_icmp_msgs_per_sec. ++ * Uses a token bucket to limit our ICMP messages to ~sysctl_icmp_msgs_per_sec. + * Returns false if we reached the limit and can not send another packet. + * Note: called with BH disabled + */ +@@ -272,7 +272,10 @@ bool icmp_global_allow(void) + } + credit = min_t(u32, icmp_global.credit + incr, sysctl_icmp_msgs_burst); + if (credit) { +- credit--; ++ /* We want to use a credit of one in average, but need to randomize ++ * it for security reasons. ++ */ ++ credit = max_t(int, credit - prandom_u32_max(3), 0); + rc = true; + } + WRITE_ONCE(icmp_global.credit, credit); diff --git a/queue-4.19/net-hdlc-in-hdlc_rcv-check-to-make-sure-dev-is-an-hdlc-device.patch b/queue-4.19/net-hdlc-in-hdlc_rcv-check-to-make-sure-dev-is-an-hdlc-device.patch new file mode 100644 index 00000000000..af3d51c17de --- /dev/null +++ b/queue-4.19/net-hdlc-in-hdlc_rcv-check-to-make-sure-dev-is-an-hdlc-device.patch @@ -0,0 +1,56 @@ +From foo@baz Sat Oct 24 11:10:05 AM CEST 2020 +From: Xie He +Date: Mon, 19 Oct 2020 18:31:52 -0700 +Subject: net: hdlc: In hdlc_rcv, check to make sure dev is an HDLC device + +From: Xie He + +[ Upstream commit 01c4ceae0a38a0bdbfea6896f41efcd985a9c064 ] + +The hdlc_rcv function is used as hdlc_packet_type.func to process any +skb received in the kernel with skb->protocol == htons(ETH_P_HDLC). +The purpose of this function is to provide second-stage processing for +skbs not assigned a "real" L3 skb->protocol value in the first stage. + +This function assumes the device from which the skb is received is an +HDLC device (a device created by this module). It assumes that +netdev_priv(dev) returns a pointer to "struct hdlc_device". + +However, it is possible that some driver in the kernel (not necessarily +in our control) submits a received skb with skb->protocol == +htons(ETH_P_HDLC), from a non-HDLC device. In this case, the skb would +still be received by hdlc_rcv. This will cause problems. + +hdlc_rcv should be able to recognize and drop invalid skbs. It should +first make sure "dev" is actually an HDLC device, before starting its +processing. This patch adds this check to hdlc_rcv. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Cc: Krzysztof Halasa +Signed-off-by: Xie He +Link: https://lore.kernel.org/r/20201020013152.89259-1-xie.he.0141@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wan/hdlc.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +--- a/drivers/net/wan/hdlc.c ++++ b/drivers/net/wan/hdlc.c +@@ -49,7 +49,15 @@ static struct hdlc_proto *first_proto; + static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev, + struct packet_type *p, struct net_device *orig_dev) + { +- struct hdlc_device *hdlc = dev_to_hdlc(dev); ++ struct hdlc_device *hdlc; ++ ++ /* First make sure "dev" is an HDLC device */ ++ if (!(dev->priv_flags & IFF_WAN_HDLC)) { ++ kfree_skb(skb); ++ return NET_RX_SUCCESS; ++ } ++ ++ hdlc = dev_to_hdlc(dev); + + if (!net_eq(dev_net(dev), &init_net)) { + kfree_skb(skb); diff --git a/queue-4.19/net-hdlc_raw_eth-clear-the-iff_tx_skb_sharing-flag-after-calling-ether_setup.patch b/queue-4.19/net-hdlc_raw_eth-clear-the-iff_tx_skb_sharing-flag-after-calling-ether_setup.patch new file mode 100644 index 00000000000..baa047145c7 --- /dev/null +++ b/queue-4.19/net-hdlc_raw_eth-clear-the-iff_tx_skb_sharing-flag-after-calling-ether_setup.patch @@ -0,0 +1,38 @@ +From foo@baz Sat Oct 24 11:10:06 AM CEST 2020 +From: Xie He +Date: Mon, 19 Oct 2020 23:34:20 -0700 +Subject: net: hdlc_raw_eth: Clear the IFF_TX_SKB_SHARING flag after calling ether_setup + +From: Xie He + +[ Upstream commit 5fce1e43e2d5bf2f7e3224d7b99b1c65ab2c26e2 ] + +This driver calls ether_setup to set up the network device. +The ether_setup function would add the IFF_TX_SKB_SHARING flag to the +device. This flag indicates that it is safe to transmit shared skbs to +the device. + +However, this is not true. This driver may pad the frame (in eth_tx) +before transmission, so the skb may be modified. + +Fixes: 550fd08c2ceb ("net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared") +Cc: Neil Horman +Cc: Krzysztof Halasa +Signed-off-by: Xie He +Link: https://lore.kernel.org/r/20201020063420.187497-1-xie.he.0141@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/wan/hdlc_raw_eth.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/net/wan/hdlc_raw_eth.c ++++ b/drivers/net/wan/hdlc_raw_eth.c +@@ -102,6 +102,7 @@ static int raw_eth_ioctl(struct net_devi + old_qlen = dev->tx_queue_len; + ether_setup(dev); + dev->tx_queue_len = old_qlen; ++ dev->priv_flags &= ~IFF_TX_SKB_SHARING; + eth_hw_addr_random(dev); + call_netdevice_notifiers(NETDEV_POST_TYPE_CHANGE, dev); + netif_dormant_off(dev); diff --git a/queue-4.19/net-sched-act_tunnel_key-fix-oob-write-in-case-of-ipv6-erspan-tunnels.patch b/queue-4.19/net-sched-act_tunnel_key-fix-oob-write-in-case-of-ipv6-erspan-tunnels.patch new file mode 100644 index 00000000000..8b086bb74f2 --- /dev/null +++ b/queue-4.19/net-sched-act_tunnel_key-fix-oob-write-in-case-of-ipv6-erspan-tunnels.patch @@ -0,0 +1,121 @@ +From foo@baz Sat Oct 24 11:10:06 AM CEST 2020 +From: Davide Caratti +Date: Wed, 21 Oct 2020 00:02:40 +0200 +Subject: net/sched: act_tunnel_key: fix OOB write in case of IPv6 ERSPAN tunnels + +From: Davide Caratti + +[ Upstream commit a7a12b5a0f950bc6b9f7153390634ea798738db9 ] + +the following command + + # tc action add action tunnel_key \ + > set src_ip 2001:db8::1 dst_ip 2001:db8::2 id 10 erspan_opts 1:6789:0:0 + +generates the following splat: + + BUG: KASAN: slab-out-of-bounds in tunnel_key_copy_opts+0xcc9/0x1010 [act_tunnel_key] + Write of size 4 at addr ffff88813f5f1cc8 by task tc/873 + + CPU: 2 PID: 873 Comm: tc Not tainted 5.9.0+ #282 + Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 + Call Trace: + dump_stack+0x99/0xcb + print_address_description.constprop.7+0x1e/0x230 + kasan_report.cold.13+0x37/0x7c + tunnel_key_copy_opts+0xcc9/0x1010 [act_tunnel_key] + tunnel_key_init+0x160c/0x1f40 [act_tunnel_key] + tcf_action_init_1+0x5b5/0x850 + tcf_action_init+0x15d/0x370 + tcf_action_add+0xd9/0x2f0 + tc_ctl_action+0x29b/0x3a0 + rtnetlink_rcv_msg+0x341/0x8d0 + netlink_rcv_skb+0x120/0x380 + netlink_unicast+0x439/0x630 + netlink_sendmsg+0x719/0xbf0 + sock_sendmsg+0xe2/0x110 + ____sys_sendmsg+0x5ba/0x890 + ___sys_sendmsg+0xe9/0x160 + __sys_sendmsg+0xd3/0x170 + do_syscall_64+0x33/0x40 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + RIP: 0033:0x7f872a96b338 + Code: 89 02 48 c7 c0 ff ff ff ff eb b5 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 25 43 2c 00 8b 00 85 c0 75 17 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 41 89 d4 55 + RSP: 002b:00007ffffe367518 EFLAGS: 00000246 ORIG_RAX: 000000000000002e + RAX: ffffffffffffffda RBX: 000000005f8f5aed RCX: 00007f872a96b338 + RDX: 0000000000000000 RSI: 00007ffffe367580 RDI: 0000000000000003 + RBP: 0000000000000000 R08: 0000000000000001 R09: 000000000000001c + R10: 000000000000000b R11: 0000000000000246 R12: 0000000000000001 + R13: 0000000000686760 R14: 0000000000000601 R15: 0000000000000000 + + Allocated by task 873: + kasan_save_stack+0x19/0x40 + __kasan_kmalloc.constprop.7+0xc1/0xd0 + __kmalloc+0x151/0x310 + metadata_dst_alloc+0x20/0x40 + tunnel_key_init+0xfff/0x1f40 [act_tunnel_key] + tcf_action_init_1+0x5b5/0x850 + tcf_action_init+0x15d/0x370 + tcf_action_add+0xd9/0x2f0 + tc_ctl_action+0x29b/0x3a0 + rtnetlink_rcv_msg+0x341/0x8d0 + netlink_rcv_skb+0x120/0x380 + netlink_unicast+0x439/0x630 + netlink_sendmsg+0x719/0xbf0 + sock_sendmsg+0xe2/0x110 + ____sys_sendmsg+0x5ba/0x890 + ___sys_sendmsg+0xe9/0x160 + __sys_sendmsg+0xd3/0x170 + do_syscall_64+0x33/0x40 + entry_SYSCALL_64_after_hwframe+0x44/0xa9 + + The buggy address belongs to the object at ffff88813f5f1c00 + which belongs to the cache kmalloc-256 of size 256 + The buggy address is located 200 bytes inside of + 256-byte region [ffff88813f5f1c00, ffff88813f5f1d00) + The buggy address belongs to the page: + page:0000000011b48a19 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x13f5f0 + head:0000000011b48a19 order:1 compound_mapcount:0 + flags: 0x17ffffc0010200(slab|head) + raw: 0017ffffc0010200 0000000000000000 0000000d00000001 ffff888107c43400 + raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 + page dumped because: kasan: bad access detected + + Memory state around the buggy address: + ffff88813f5f1b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff88813f5f1c00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + >ffff88813f5f1c80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc + ^ + ffff88813f5f1d00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + ffff88813f5f1d80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc + +using IPv6 tunnels, act_tunnel_key allocates a fixed amount of memory for +the tunnel metadata, but then it expects additional bytes to store tunnel +specific metadata with tunnel_key_copy_opts(). + +Fix the arguments of __ipv6_tun_set_dst(), so that 'md_size' contains the +size previously computed by tunnel_key_get_opts_len(), like it's done for +IPv4 tunnels. + +Fixes: 0ed5269f9e41 ("net/sched: add tunnel option support to act_tunnel_key") +Reported-by: Shuang Li +Signed-off-by: Davide Caratti +Acked-by: Cong Wang +Link: https://lore.kernel.org/r/36ebe969f6d13ff59912d6464a4356fe6f103766.1603231100.git.dcaratti@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/sched/act_tunnel_key.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/sched/act_tunnel_key.c ++++ b/net/sched/act_tunnel_key.c +@@ -314,7 +314,7 @@ static int tunnel_key_init(struct net *n + + metadata = __ipv6_tun_set_dst(&saddr, &daddr, tos, ttl, dst_port, + 0, flags, +- key_id, 0); ++ key_id, opts_len); + } else { + NL_SET_ERR_MSG(extack, "Missing either ipv4 or ipv6 src and dst"); + ret = -EINVAL; diff --git a/queue-4.19/nfc-ensure-presence-of-nfc_attr_firmware_name-attribute-in-nfc_genl_fw_download.patch b/queue-4.19/nfc-ensure-presence-of-nfc_attr_firmware_name-attribute-in-nfc_genl_fw_download.patch new file mode 100644 index 00000000000..d29feaf781f --- /dev/null +++ b/queue-4.19/nfc-ensure-presence-of-nfc_attr_firmware_name-attribute-in-nfc_genl_fw_download.patch @@ -0,0 +1,37 @@ +From foo@baz Sat Oct 24 11:10:06 AM CEST 2020 +From: Defang Bo +Date: Mon, 19 Oct 2020 19:38:58 +0800 +Subject: nfc: Ensure presence of NFC_ATTR_FIRMWARE_NAME attribute in nfc_genl_fw_download() + +From: Defang Bo + +[ Upstream commit 280e3ebdafb863b3cb50d5842f056267e15bf40c ] + +Check that the NFC_ATTR_FIRMWARE_NAME attributes are provided by +the netlink client prior to accessing them.This prevents potential +unhandled NULL pointer dereference exceptions which can be triggered +by malicious user-mode programs, if they omit one or both of these +attributes. + +Similar to commit a0323b979f81 ("nfc: Ensure presence of required attributes in the activate_target handler"). + +Fixes: 9674da8759df ("NFC: Add firmware upload netlink command") +Signed-off-by: Defang Bo +Link: https://lore.kernel.org/r/1603107538-4744-1-git-send-email-bodefang@126.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/nfc/netlink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/net/nfc/netlink.c ++++ b/net/nfc/netlink.c +@@ -1235,7 +1235,7 @@ static int nfc_genl_fw_download(struct s + u32 idx; + char firmware_name[NFC_FIRMWARE_NAME_MAXSIZE + 1]; + +- if (!info->attrs[NFC_ATTR_DEVICE_INDEX]) ++ if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || !info->attrs[NFC_ATTR_FIRMWARE_NAME]) + return -EINVAL; + + idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); diff --git a/queue-4.19/r8169-fix-operation-under-forced-interrupt-threading.patch b/queue-4.19/r8169-fix-operation-under-forced-interrupt-threading.patch new file mode 100644 index 00000000000..56f4c5d2035 --- /dev/null +++ b/queue-4.19/r8169-fix-operation-under-forced-interrupt-threading.patch @@ -0,0 +1,58 @@ +From foo@baz Sat Oct 24 11:10:06 AM CEST 2020 +From: Heiner Kallweit +Date: Sun, 18 Oct 2020 18:38:59 +0200 +Subject: r8169: fix operation under forced interrupt threading + +From: Heiner Kallweit + +[ Upstream commit 424a646e072a887aa87283b53aa6f8b19c2a7bef ] + +For several network drivers it was reported that using +__napi_schedule_irqoff() is unsafe with forced threading. One way to +fix this is switching back to __napi_schedule, but then we lose the +benefit of the irqoff version in general. As stated by Eric it doesn't +make sense to make the minimal hard irq handlers in drivers using NAPI +a thread. Therefore ensure that the hard irq handler is never +thread-ified. + +Fixes: 9a899a35b0d6 ("r8169: switch to napi_schedule_irqoff") +Link: https://lkml.org/lkml/2020/10/18/19 +Signed-off-by: Heiner Kallweit +Link: https://lore.kernel.org/r/4d3ef84a-c812-5072-918a-22a6f6468310@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/ethernet/realtek/r8169.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.c ++++ b/drivers/net/ethernet/realtek/r8169.c +@@ -6830,7 +6830,7 @@ static int rtl8169_close(struct net_devi + + phy_disconnect(dev->phydev); + +- pci_free_irq(pdev, 0, tp); ++ free_irq(pci_irq_vector(pdev, 0), tp); + + dma_free_coherent(&pdev->dev, R8169_RX_RING_BYTES, tp->RxDescArray, + tp->RxPhyAddr); +@@ -6885,8 +6885,8 @@ static int rtl_open(struct net_device *d + + rtl_request_firmware(tp); + +- retval = pci_request_irq(pdev, 0, rtl8169_interrupt, NULL, tp, +- dev->name); ++ retval = request_irq(pci_irq_vector(pdev, 0), rtl8169_interrupt, ++ IRQF_NO_THREAD | IRQF_SHARED, dev->name, tp); + if (retval < 0) + goto err_release_fw_2; + +@@ -6919,7 +6919,7 @@ out: + return retval; + + err_free_irq: +- pci_free_irq(pdev, 0, tp); ++ free_irq(pci_irq_vector(pdev, 0), tp); + err_release_fw_2: + rtl_release_firmware(tp); + rtl8169_rx_clear(tp); diff --git a/queue-4.19/series b/queue-4.19/series index 2f7f8a84bbf..9ad5b4fc3ef 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -13,3 +13,13 @@ r8169-fix-data-corruption-issue-on-rtl8402.patch net-tls-sendfile-fails-with-ktls-offload.patch binder-fix-uaf-when-releasing-todo-list.patch alsa-bebob-potential-info-leak-in-hwdep_read.patch +chelsio-chtls-fix-socket-lock.patch +chelsio-chtls-correct-netdevice-for-vlan-interface.patch +chelsio-chtls-correct-function-return-and-return-type.patch +net-hdlc-in-hdlc_rcv-check-to-make-sure-dev-is-an-hdlc-device.patch +net-hdlc_raw_eth-clear-the-iff_tx_skb_sharing-flag-after-calling-ether_setup.patch +net-sched-act_tunnel_key-fix-oob-write-in-case-of-ipv6-erspan-tunnels.patch +nfc-ensure-presence-of-nfc_attr_firmware_name-attribute-in-nfc_genl_fw_download.patch +tcp-fix-to-update-snd_wl1-in-bulk-receiver-fast-path.patch +r8169-fix-operation-under-forced-interrupt-threading.patch +icmp-randomize-the-global-rate-limiter.patch diff --git a/queue-4.19/tcp-fix-to-update-snd_wl1-in-bulk-receiver-fast-path.patch b/queue-4.19/tcp-fix-to-update-snd_wl1-in-bulk-receiver-fast-path.patch new file mode 100644 index 00000000000..b4a90ecf7d1 --- /dev/null +++ b/queue-4.19/tcp-fix-to-update-snd_wl1-in-bulk-receiver-fast-path.patch @@ -0,0 +1,65 @@ +From foo@baz Sat Oct 24 11:10:06 AM CEST 2020 +From: Neal Cardwell +Date: Thu, 22 Oct 2020 10:33:31 -0400 +Subject: tcp: fix to update snd_wl1 in bulk receiver fast path + +From: Neal Cardwell + +[ Upstream commit 18ded910b589839e38a51623a179837ab4cc3789 ] + +In the header prediction fast path for a bulk data receiver, if no +data is newly acknowledged then we do not call tcp_ack() and do not +call tcp_ack_update_window(). This means that a bulk receiver that +receives large amounts of data can have the incoming sequence numbers +wrap, so that the check in tcp_may_update_window fails: + after(ack_seq, tp->snd_wl1) + +If the incoming receive windows are zero in this state, and then the +connection that was a bulk data receiver later wants to send data, +that connection can find itself persistently rejecting the window +updates in incoming ACKs. This means the connection can persistently +fail to discover that the receive window has opened, which in turn +means that the connection is unable to send anything, and the +connection's sending process can get permanently "stuck". + +The fix is to update snd_wl1 in the header prediction fast path for a +bulk data receiver, so that it keeps up and does not see wrapping +problems. + +This fix is based on a very nice and thorough analysis and diagnosis +by Apollon Oikonomopoulos (see link below). + +This is a stable candidate but there is no Fixes tag here since the +bug predates current git history. Just for fun: looks like the bug +dates back to when header prediction was added in Linux v2.1.8 in Nov +1996. In that version tcp_rcv_established() was added, and the code +only updates snd_wl1 in tcp_ack(), and in the new "Bulk data transfer: +receiver" code path it does not call tcp_ack(). This fix seems to +apply cleanly at least as far back as v3.2. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Neal Cardwell +Reported-by: Apollon Oikonomopoulos +Tested-by: Apollon Oikonomopoulos +Link: https://www.spinics.net/lists/netdev/msg692430.html +Acked-by: Soheil Hassas Yeganeh +Acked-by: Yuchung Cheng +Signed-off-by: Eric Dumazet +Link: https://lore.kernel.org/r/20201022143331.1887495-1-ncardwell.kernel@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/tcp_input.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/net/ipv4/tcp_input.c ++++ b/net/ipv4/tcp_input.c +@@ -5631,6 +5631,8 @@ void tcp_rcv_established(struct sock *sk + tcp_data_snd_check(sk); + if (!inet_csk_ack_scheduled(sk)) + goto no_ack; ++ } else { ++ tcp_update_wl(tp, TCP_SKB_CB(skb)->seq); + } + + __tcp_ack_snd_check(sk, 0);