--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:11 +0530
+Subject: chtls: Added a check to avoid NULL pointer dereference
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit eade1e0a4fb31d48eeb1589d9bb859ae4dd6181d ]
+
+In case of server removal lookup_stid() may return NULL pointer, which
+is used as listen_ctx. So added a check before accessing this pointer.
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -1453,6 +1453,11 @@ static int chtls_pass_establish(struct c
+ sk_wake_async(sk, 0, POLL_OUT);
+
+ data = lookup_stid(cdev->tids, stid);
++ if (!data) {
++ /* listening server close */
++ kfree_skb(skb);
++ goto unlock;
++ }
+ lsk = ((struct listen_ctx *)data)->lsk;
+
+ bh_lock_sock(lsk);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:12 +0530
+Subject: chtls: Fix chtls resources release sequence
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit 15ef6b0e30b354253e2c10b3836bc59767eb162b ]
+
+CPL_ABORT_RPL is sent after releasing the resources by calling
+chtls_release_resources(sk); and chtls_conn_done(sk);
+eventually causing kernel panic. Fixing it by calling release
+in appropriate order.
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 9 ++++-----
+ 1 file changed, 4 insertions(+), 5 deletions(-)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -1905,9 +1905,9 @@ static void bl_abort_syn_rcv(struct sock
+ queue = csk->txq_idx;
+
+ skb->sk = NULL;
+- do_abort_syn_rcv(child, lsk);
+ chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
+ CPL_ABORT_NO_RST, queue);
++ do_abort_syn_rcv(child, lsk);
+ }
+
+ static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
+@@ -1937,8 +1937,8 @@ static int abort_syn_rcv(struct sock *sk
+ if (!sock_owned_by_user(psk)) {
+ int queue = csk->txq_idx;
+
+- do_abort_syn_rcv(sk, psk);
+ chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
++ do_abort_syn_rcv(sk, psk);
+ } else {
+ skb->sk = sk;
+ BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv;
+@@ -1981,12 +1981,11 @@ static void chtls_abort_req_rss(struct s
+
+ if (sk->sk_state == TCP_SYN_RECV && !abort_syn_rcv(sk, skb))
+ return;
+-
+- chtls_release_resources(sk);
+- chtls_conn_done(sk);
+ }
+
+ chtls_send_abort_rpl(sk, skb, csk->cdev, rst_status, queue);
++ chtls_release_resources(sk);
++ chtls_conn_done(sk);
+ }
+
+ static void chtls_abort_rpl_rss(struct sock *sk, struct sk_buff *skb)
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:06 +0530
+Subject: chtls: Fix hardware tid leak
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit 717df0f4cdc9044c415431a3522b3e9ccca5b4a3 ]
+
+send_abort_rpl() is not calculating cpl_abort_req_rss offset and
+ends up sending wrong TID with abort_rpl WR causng tid leaks.
+Replaced send_abort_rpl() with chtls_send_abort_rpl() as it is
+redundant.
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 39 ++------------------------------
+ 1 file changed, 3 insertions(+), 36 deletions(-)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -1828,39 +1828,6 @@ static void send_defer_abort_rpl(struct
+ kfree_skb(skb);
+ }
+
+-static void send_abort_rpl(struct sock *sk, struct sk_buff *skb,
+- struct chtls_dev *cdev, int status, int queue)
+-{
+- struct cpl_abort_req_rss *req = cplhdr(skb);
+- struct sk_buff *reply_skb;
+- struct chtls_sock *csk;
+-
+- csk = rcu_dereference_sk_user_data(sk);
+-
+- reply_skb = alloc_skb(sizeof(struct cpl_abort_rpl),
+- GFP_KERNEL);
+-
+- if (!reply_skb) {
+- req->status = (queue << 1);
+- send_defer_abort_rpl(cdev, skb);
+- return;
+- }
+-
+- set_abort_rpl_wr(reply_skb, GET_TID(req), status);
+- kfree_skb(skb);
+-
+- set_wr_txq(reply_skb, CPL_PRIORITY_DATA, queue);
+- if (csk_conn_inline(csk)) {
+- struct l2t_entry *e = csk->l2t_entry;
+-
+- if (e && sk->sk_state != TCP_SYN_RECV) {
+- cxgb4_l2t_send(csk->egress_dev, reply_skb, e);
+- return;
+- }
+- }
+- cxgb4_ofld_send(cdev->lldi->ports[0], reply_skb);
+-}
+-
+ /*
+ * Add an skb to the deferred skb queue for processing from process context.
+ */
+@@ -1924,8 +1891,8 @@ static void bl_abort_syn_rcv(struct sock
+
+ skb->sk = NULL;
+ do_abort_syn_rcv(child, lsk);
+- send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
+- CPL_ABORT_NO_RST, queue);
++ chtls_send_abort_rpl(child, skb, BLOG_SKB_CB(skb)->cdev,
++ CPL_ABORT_NO_RST, queue);
+ }
+
+ static int abort_syn_rcv(struct sock *sk, struct sk_buff *skb)
+@@ -1956,7 +1923,7 @@ static int abort_syn_rcv(struct sock *sk
+ int queue = csk->txq_idx;
+
+ do_abort_syn_rcv(sk, psk);
+- send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
++ chtls_send_abort_rpl(sk, skb, cdev, CPL_ABORT_NO_RST, queue);
+ } else {
+ skb->sk = sk;
+ BLOG_SKB_CB(skb)->backlog_rcv = bl_abort_syn_rcv;
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:08 +0530
+Subject: chtls: Fix panic when route to peer not configured
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit 5a5fac9966bb6d513198634b0b1357be7e8447d2 ]
+
+If route to peer is not configured, we might get non tls
+devices from dst_neigh_lookup() which is invalid, adding a
+check to avoid it.
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -1021,6 +1021,7 @@ static struct sock *chtls_recv_sock(stru
+ const struct cpl_pass_accept_req *req,
+ struct chtls_dev *cdev)
+ {
++ struct adapter *adap = pci_get_drvdata(cdev->pdev);
+ struct inet_sock *newinet;
+ const struct iphdr *iph;
+ struct tls_context *ctx;
+@@ -1030,9 +1031,10 @@ static struct sock *chtls_recv_sock(stru
+ struct neighbour *n;
+ struct tcp_sock *tp;
+ struct sock *newsk;
++ bool found = false;
+ u16 port_id;
+ int rxq_idx;
+- int step;
++ int step, i;
+
+ iph = (const struct iphdr *)network_hdr;
+ newsk = tcp_create_openreq_child(lsk, oreq, cdev->askb);
+@@ -1044,7 +1046,7 @@ static struct sock *chtls_recv_sock(stru
+ goto free_sk;
+
+ n = dst_neigh_lookup(dst, &iph->saddr);
+- if (!n)
++ if (!n || !n->dev)
+ goto free_sk;
+
+ ndev = n->dev;
+@@ -1053,6 +1055,13 @@ static struct sock *chtls_recv_sock(stru
+ if (is_vlan_dev(ndev))
+ ndev = vlan_dev_real_dev(ndev);
+
++ for_each_port(adap, i)
++ if (cdev->ports[i] == ndev)
++ found = true;
++
++ if (!found)
++ goto free_dst;
++
+ port_id = cxgb4_port_idx(ndev);
+
+ csk = chtls_sock_create(cdev);
+@@ -1108,6 +1117,7 @@ static struct sock *chtls_recv_sock(stru
+ free_csk:
+ chtls_sock_release(&csk->kref);
+ free_dst:
++ neigh_release(n);
+ dst_release(dst);
+ free_sk:
+ inet_csk_prepare_forced_close(newsk);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:07 +0530
+Subject: chtls: Remove invalid set_tcb call
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit 827d329105bfde6701f0077e34a09c4a86e27145 ]
+
+At the time of SYN_RECV, connection information is not
+initialized at FW, updating tcb flag over uninitialized
+connection causes adapter crash. We don't need to
+update the flag during SYN_RECV state, so avoid this.
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Rohit Maheshwari <rohitm@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -1941,9 +1941,6 @@ static void chtls_abort_req_rss(struct s
+ int queue = csk->txq_idx;
+
+ if (is_neg_adv(req->status)) {
+- if (sk->sk_state == TCP_SYN_RECV)
+- chtls_set_tcb_tflag(sk, 0, 0);
+-
+ kfree_skb(skb);
+ return;
+ }
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+Date: Wed, 6 Jan 2021 09:59:10 +0530
+Subject: chtls: Replace skb_dequeue with skb_peek
+
+From: Ayush Sawal <ayush.sawal@chelsio.com>
+
+[ Upstream commit a84b2c0d5fa23da6d6c8c0d5f5c93184a2744d3e ]
+
+The skb is unlinked twice, one in __skb_dequeue in function
+chtls_reset_synq() and another in cleanup_syn_rcv_conn().
+So in this patch using skb_peek() instead of __skb_dequeue(),
+so that unlink will be handled only in cleanup_syn_rcv_conn().
+
+Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
+Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
+Signed-off-by: Ayush Sawal <ayush.sawal@chelsio.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/crypto/chelsio/chtls/chtls_cm.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/crypto/chelsio/chtls/chtls_cm.c
++++ b/drivers/crypto/chelsio/chtls/chtls_cm.c
+@@ -577,7 +577,7 @@ static void chtls_reset_synq(struct list
+
+ while (!skb_queue_empty(&listen_ctx->synq)) {
+ struct chtls_sock *csk =
+- container_of((struct synq *)__skb_dequeue
++ container_of((struct synq *)skb_peek
+ (&listen_ctx->synq), struct chtls_sock, synq);
+ struct sock *child = csk->sk;
+
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: "Jouni K. Seppänen" <jks@iki.fi>
+Date: Tue, 5 Jan 2021 06:52:49 +0200
+Subject: net: cdc_ncm: correct overhead in delayed_ndp_size
+
+From: "Jouni K. Seppänen" <jks@iki.fi>
+
+[ Upstream commit 7a68d725e4ea384977445e0bcaed3d7de83ab5b3 ]
+
+Aligning to tx_ndp_modulus is not sufficient because the next align
+call can be cdc_ncm_align_tail, which can add up to ctx->tx_modulus +
+ctx->tx_remainder - 1 bytes. This used to lead to occasional crashes
+on a Huawei 909s-120 LTE module as follows:
+
+- the condition marked /* if there is a remaining skb [...] */ is true
+ so the swaps happen
+- skb_out is set from ctx->tx_curr_skb
+- skb_out->len is exactly 0x3f52
+- ctx->tx_curr_size is 0x4000 and delayed_ndp_size is 0xac
+ (note that the sum of skb_out->len and delayed_ndp_size is 0x3ffe)
+- the for loop over n is executed once
+- the cdc_ncm_align_tail call marked /* align beginning of next frame */
+ increases skb_out->len to 0x3f56 (the sum is now 0x4002)
+- the condition marked /* check if we had enough room left [...] */ is
+ false so we break out of the loop
+- the condition marked /* If requested, put NDP at end of frame. */ is
+ true so the NDP is written into skb_out
+- now skb_out->len is 0x4002, so padding_count is minus two interpreted
+ as an unsigned number, which is used as the length argument to memset,
+ leading to a crash with various symptoms but usually including
+
+> Call Trace:
+> <IRQ>
+> cdc_ncm_fill_tx_frame+0x83a/0x970 [cdc_ncm]
+> cdc_mbim_tx_fixup+0x1d9/0x240 [cdc_mbim]
+> usbnet_start_xmit+0x5d/0x720 [usbnet]
+
+The cdc_ncm_align_tail call first aligns on a ctx->tx_modulus
+boundary (adding at most ctx->tx_modulus-1 bytes), then adds
+ctx->tx_remainder bytes. Alternatively, the next alignment call can
+occur in cdc_ncm_ndp16 or cdc_ncm_ndp32, in which case at most
+ctx->tx_ndp_modulus-1 bytes are added.
+
+A similar problem has occurred before, and the code is nontrivial to
+reason about, so add a guard before the crashing call. By that time it
+is too late to prevent any memory corruption (we'll have written past
+the end of the buffer already) but we can at least try to get a warning
+written into an on-disk log by avoiding the hard crash caused by padding
+past the buffer with a huge number of zeros.
+
+Signed-off-by: Jouni K. Seppänen <jks@iki.fi>
+Fixes: 4a0e3e989d66 ("cdc_ncm: Add support for moving NDP to end of NCM frame")
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=209407
+Reported-by: kernel test robot <lkp@intel.com>
+Reviewed-by: Bjørn Mork <bjorn@mork.no>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/usb/cdc_ncm.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/usb/cdc_ncm.c
++++ b/drivers/net/usb/cdc_ncm.c
+@@ -1126,7 +1126,10 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev
+ * accordingly. Otherwise, we should check here.
+ */
+ if (ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END)
+- delayed_ndp_size = ALIGN(ctx->max_ndp_size, ctx->tx_ndp_modulus);
++ delayed_ndp_size = ctx->max_ndp_size +
++ max_t(u32,
++ ctx->tx_ndp_modulus,
++ ctx->tx_modulus + ctx->tx_remainder) - 1;
+ else
+ delayed_ndp_size = 0;
+
+@@ -1307,7 +1310,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev
+ if (!(dev->driver_info->flags & FLAG_SEND_ZLP) &&
+ skb_out->len > ctx->min_tx_pkt) {
+ padding_count = ctx->tx_curr_size - skb_out->len;
+- skb_put_zero(skb_out, padding_count);
++ if (!WARN_ON(padding_count > ctx->tx_curr_size))
++ skb_put_zero(skb_out, padding_count);
+ } else if (skb_out->len < ctx->tx_curr_size &&
+ (skb_out->len % dev->maxpacket) == 0) {
+ skb_put_u8(skb_out, 0); /* force short packet */
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Aleksander Jan Bajkowski <olek2@wp.pl>
+Date: Thu, 7 Jan 2021 20:58:18 +0100
+Subject: net: dsa: lantiq_gswip: Exclude RMII from modes that report 1 GbE
+
+From: Aleksander Jan Bajkowski <olek2@wp.pl>
+
+[ Upstream commit 3545454c7801e391b0d966f82c98614d45394770 ]
+
+Exclude RMII from modes that report 1 GbE support. Reduced MII supports
+up to 100 MbE.
+
+Fixes: 14fceff4771e ("net: dsa: Add Lantiq / Intel DSA driver for vrx200")
+Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
+Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
+Link: https://lore.kernel.org/r/20210107195818.3878-1-olek2@wp.pl
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/dsa/lantiq_gswip.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/dsa/lantiq_gswip.c
++++ b/drivers/net/dsa/lantiq_gswip.c
+@@ -1419,11 +1419,12 @@ static void gswip_phylink_validate(struc
+ phylink_set(mask, Pause);
+ phylink_set(mask, Asym_Pause);
+
+- /* With the exclusion of MII and Reverse MII, we support Gigabit,
+- * including Half duplex
++ /* With the exclusion of MII, Reverse MII and Reduced MII, we
++ * support Gigabit, including Half duplex
+ */
+ if (state->interface != PHY_INTERFACE_MODE_MII &&
+- state->interface != PHY_INTERFACE_MODE_REVMII) {
++ state->interface != PHY_INTERFACE_MODE_REVMII &&
++ state->interface != PHY_INTERFACE_MODE_RMII) {
+ phylink_set(mask, 1000baseT_Full);
+ phylink_set(mask, 1000baseT_Half);
+ }
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Florian Westphal <fw@strlen.de>
+Date: Wed, 6 Jan 2021 00:15:22 +0100
+Subject: net: fix pmtu check in nopmtudisc mode
+
+From: Florian Westphal <fw@strlen.de>
+
+[ Upstream commit 50c661670f6a3908c273503dfa206dfc7aa54c07 ]
+
+For some reason ip_tunnel insist on setting the DF bit anyway when the
+inner header has the DF bit set, EVEN if the tunnel was configured with
+'nopmtudisc'.
+
+This means that the script added in the previous commit
+cannot be made to work by adding the 'nopmtudisc' flag to the
+ip tunnel configuration. Doing so breaks connectivity even for the
+without-conntrack/netfilter scenario.
+
+When nopmtudisc is set, the tunnel will skip the mtu check, so no
+icmp error is sent to client. Then, because inner header has DF set,
+the outer header gets added with DF bit set as well.
+
+IP stack then sends an error to itself because the packet exceeds
+the device MTU.
+
+Fixes: 23a3647bc4f93 ("ip_tunnels: Use skb-len to PMTU check.")
+Cc: Stefano Brivio <sbrivio@redhat.com>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/ip_tunnel.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+--- a/net/ipv4/ip_tunnel.c
++++ b/net/ipv4/ip_tunnel.c
+@@ -765,8 +765,11 @@ void ip_tunnel_xmit(struct sk_buff *skb,
+ goto tx_error;
+ }
+
+- if (tnl_update_pmtu(dev, skb, rt, tnl_params->frag_off, inner_iph,
+- 0, 0, false)) {
++ df = tnl_params->frag_off;
++ if (skb->protocol == htons(ETH_P_IP) && !tunnel->ignore_df)
++ df |= (inner_iph->frag_off & htons(IP_DF));
++
++ if (tnl_update_pmtu(dev, skb, rt, df, inner_iph, 0, 0, false)) {
+ ip_rt_put(rt);
+ goto tx_error;
+ }
+@@ -794,10 +797,6 @@ void ip_tunnel_xmit(struct sk_buff *skb,
+ ttl = ip4_dst_hoplimit(&rt->dst);
+ }
+
+- df = tnl_params->frag_off;
+- if (skb->protocol == htons(ETH_P_IP) && !tunnel->ignore_df)
+- df |= (inner_iph->frag_off&htons(IP_DF));
+-
+ max_headroom = LL_RESERVED_SPACE(rt->dst.dev) + sizeof(struct iphdr)
+ + rt->dst.header_len + ip_encap_hlen(&tunnel->encap);
+ if (max_headroom > dev->needed_headroom)
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Yonglong Liu <liuyonglong@huawei.com>
+Date: Tue, 5 Jan 2021 11:37:26 +0800
+Subject: net: hns3: fix a phy loopback fail issue
+
+From: Yonglong Liu <liuyonglong@huawei.com>
+
+[ Upstream commit f04bbcbf1e38d192e94bbfa126731a52332c40b1 ]
+
+When phy driver does not implement the set_loopback interface,
+phy loopback test will return -EOPNOTSUPP, and the loopback test
+will fail. So when phy driver does not implement the set_loopback
+interface, don't do phy loopback test.
+
+Fixes: c9765a89d142 ("net: hns3: add phy selftest function")
+Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
+Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+@@ -746,7 +746,8 @@ static int hclge_get_sset_count(struct h
+ handle->flags |= HNAE3_SUPPORT_SERDES_SERIAL_LOOPBACK;
+ handle->flags |= HNAE3_SUPPORT_SERDES_PARALLEL_LOOPBACK;
+
+- if (hdev->hw.mac.phydev) {
++ if (hdev->hw.mac.phydev && hdev->hw.mac.phydev->drv &&
++ hdev->hw.mac.phydev->drv->set_loopback) {
+ count += 1;
+ handle->flags |= HNAE3_SUPPORT_PHY_LOOPBACK;
+ }
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Yufeng Mo <moyufeng@huawei.com>
+Date: Tue, 5 Jan 2021 11:37:27 +0800
+Subject: net: hns3: fix the number of queues actually used by ARQ
+
+From: Yufeng Mo <moyufeng@huawei.com>
+
+[ Upstream commit 65e61e3c2a619c4d4b873885b2d5394025ed117b ]
+
+HCLGE_MBX_MAX_ARQ_MSG_NUM is used to apply memory for the number
+of queues used by ARQ(Asynchronous Receive Queue), so the head
+and tail pointers should also use this macro.
+
+Fixes: 07a0556a3a73 ("net: hns3: Changes to support ARQ(Asynchronous Receive Queue)")
+Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
+Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
++++ b/drivers/net/ethernet/hisilicon/hns3/hclge_mbx.h
+@@ -123,7 +123,7 @@ struct hclgevf_mbx_arq_ring {
+ #define hclge_mbx_ring_ptr_move_crq(crq) \
+ (crq->next_to_use = (crq->next_to_use + 1) % crq->desc_num)
+ #define hclge_mbx_tail_ptr_move_arq(arq) \
+- (arq.tail = (arq.tail + 1) % HCLGE_MBX_MAX_ARQ_MSG_SIZE)
++ (arq.tail = (arq.tail + 1) % HCLGE_MBX_MAX_ARQ_MSG_NUM)
+ #define hclge_mbx_head_ptr_move_arq(arq) \
+- (arq.head = (arq.head + 1) % HCLGE_MBX_MAX_ARQ_MSG_SIZE)
++ (arq.head = (arq.head + 1) % HCLGE_MBX_MAX_ARQ_MSG_NUM)
+ #endif
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Florian Westphal <fw@strlen.de>
+Date: Wed, 6 Jan 2021 00:15:23 +0100
+Subject: net: ip: always refragment ip defragmented packets
+
+From: Florian Westphal <fw@strlen.de>
+
+[ Upstream commit bb4cc1a18856a73f0ff5137df0c2a31f4c50f6cf ]
+
+Conntrack reassembly records the largest fragment size seen in IPCB.
+However, when this gets forwarded/transmitted, fragmentation will only
+be forced if one of the fragmented packets had the DF bit set.
+
+In that case, a flag in IPCB will force fragmentation even if the
+MTU is large enough.
+
+This should work fine, but this breaks with ip tunnels.
+Consider client that sends a UDP datagram of size X to another host.
+
+The client fragments the datagram, so two packets, of size y and z, are
+sent. DF bit is not set on any of these packets.
+
+Middlebox netfilter reassembles those packets back to single size-X
+packet, before routing decision.
+
+packet-size-vs-mtu checks in ip_forward are irrelevant, because DF bit
+isn't set. At output time, ip refragmentation is skipped as well
+because x is still smaller than the mtu of the output device.
+
+If ttransmit device is an ip tunnel, the packet size increases to
+x+overhead.
+
+Also, tunnel might be configured to force DF bit on outer header.
+
+In this case, packet will be dropped (exceeds MTU) and an ICMP error is
+generated back to sender.
+
+But sender already respects the announced MTU, all the packets that
+it sent did fit the announced mtu.
+
+Force refragmentation as per original sizes unconditionally so ip tunnel
+will encapsulate the fragments instead.
+
+The only other solution I see is to place ip refragmentation in
+the ip_tunnel code to handle this case.
+
+Fixes: d6b915e29f4ad ("ip_fragment: don't forward defragmented DF packet")
+Reported-by: Christian Perle <christian.perle@secunet.com>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/ip_output.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/ipv4/ip_output.c
++++ b/net/ipv4/ip_output.c
+@@ -303,7 +303,7 @@ static int __ip_finish_output(struct net
+ if (skb_is_gso(skb))
+ return ip_finish_output_gso(net, sk, skb, mtu);
+
+- if (skb->len > mtu || (IPCB(skb)->flags & IPSKB_FRAG_PMTU))
++ if (skb->len > mtu || IPCB(skb)->frag_max_size)
+ return ip_fragment(net, sk, skb, mtu, ip_finish_output2);
+
+ return ip_finish_output2(net, sk, skb);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Sean Tranchetti <stranche@codeaurora.org>
+Date: Tue, 5 Jan 2021 16:22:25 -0800
+Subject: net: ipv6: fib: flush exceptions when purging route
+
+From: Sean Tranchetti <stranche@codeaurora.org>
+
+[ Upstream commit d8f5c29653c3f6995e8979be5623d263e92f6b86 ]
+
+Route removal is handled by two code paths. The main removal path is via
+fib6_del_route() which will handle purging any PMTU exceptions from the
+cache, removing all per-cpu copies of the DST entry used by the route, and
+releasing the fib6_info struct.
+
+The second removal location is during fib6_add_rt2node() during a route
+replacement operation. This path also calls fib6_purge_rt() to handle
+cleaning up the per-cpu copies of the DST entries and releasing the
+fib6_info associated with the older route, but it does not flush any PMTU
+exceptions that the older route had. Since the older route is removed from
+the tree during the replacement, we lose any way of accessing it again.
+
+As these lingering DSTs and the fib6_info struct are holding references to
+the underlying netdevice struct as well, unregistering that device from the
+kernel can never complete.
+
+Fixes: 2b760fcf5cfb3 ("ipv6: hook up exception table to store dst cache")
+Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Link: https://lore.kernel.org/r/1609892546-11389-1-git-send-email-stranche@quicinc.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv6/ip6_fib.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/net/ipv6/ip6_fib.c
++++ b/net/ipv6/ip6_fib.c
+@@ -973,6 +973,8 @@ static void fib6_purge_rt(struct fib6_in
+ {
+ struct fib6_table *table = rt->fib6_table;
+
++ /* Flush all cached dst in exception table */
++ rt6_flush_exceptions(rt);
+ fib6_drop_pcpu_from(rt, table);
+
+ if (rt->nh && !list_empty(&rt->nh_list))
+@@ -1839,9 +1841,6 @@ static void fib6_del_route(struct fib6_t
+ net->ipv6.rt6_stats->fib_rt_entries--;
+ net->ipv6.rt6_stats->fib_discarded_routes++;
+
+- /* Flush all cached dst in exception table */
+- rt6_flush_exceptions(rt);
+-
+ /* Reset round-robin state, if necessary */
+ if (rcu_access_pointer(fn->rr_ptr) == rt)
+ fn->rr_ptr = NULL;
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Mark Zhang <markzhang@nvidia.com>
+Date: Mon, 14 Dec 2020 03:38:40 +0200
+Subject: net/mlx5: Use port_num 1 instead of 0 when delete a RoCE address
+
+From: Mark Zhang <markzhang@nvidia.com>
+
+[ Upstream commit 0f2dcade69f2af56b74bce432e48ff3957830ce2 ]
+
+In multi-port mode, FW reports syndrome 0x2ea48 (invalid vhca_port_number)
+if the port_num is not 1 or 2.
+
+Fixes: 80f09dfc237f ("net/mlx5: Eswitch, enable RoCE loopback traffic")
+Signed-off-by: Mark Zhang <markzhang@nvidia.com>
+Reviewed-by: Maor Gottlieb <maorg@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/rdma.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/rdma.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/rdma.c
+@@ -116,7 +116,7 @@ free:
+ static void mlx5_rdma_del_roce_addr(struct mlx5_core_dev *dev)
+ {
+ mlx5_core_roce_gid_set(dev, 0, 0, 0,
+- NULL, NULL, false, 0, 0);
++ NULL, NULL, false, 0, 1);
+ }
+
+ static void mlx5_rdma_make_default_gid(struct mlx5_core_dev *dev, union ib_gid *gid)
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Aya Levin <ayal@nvidia.com>
+Date: Sun, 27 Dec 2020 16:33:19 +0200
+Subject: net/mlx5e: ethtool, Fix restriction of autoneg with 56G
+
+From: Aya Levin <ayal@nvidia.com>
+
+[ Upstream commit b1c0aca3d3ddeebeec57ada9c2df9ed647939249 ]
+
+Prior to this patch, configuring speed to 50G with autoneg off over
+devices supporting 50G per lane failed.
+Support for 50G per lane introduced a new set of link-modes, on which
+driver always performed a speed validation as if only legacy link-modes
+were configured. Fix driver speed validation to force setting autoneg
+over 56G only if in legacy link-mode.
+
+Fixes: 3d7cadae51f1 ("net/mlx5e: ethtool, Fix analysis of speed setting")
+Signed-off-by: Aya Levin <ayal@nvidia.com>
+Reviewed-by: Eran Ben Elisha <eranbe@nvidia.com>
+Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c | 24 ++++++++++++++-----
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
+@@ -976,6 +976,22 @@ static int mlx5e_get_link_ksettings(stru
+ return mlx5e_ethtool_get_link_ksettings(priv, link_ksettings);
+ }
+
++static int mlx5e_speed_validate(struct net_device *netdev, bool ext,
++ const unsigned long link_modes, u8 autoneg)
++{
++ /* Extended link-mode has no speed limitations. */
++ if (ext)
++ return 0;
++
++ if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
++ autoneg != AUTONEG_ENABLE) {
++ netdev_err(netdev, "%s: 56G link speed requires autoneg enabled\n",
++ __func__);
++ return -EINVAL;
++ }
++ return 0;
++}
++
+ static u32 mlx5e_ethtool2ptys_adver_link(const unsigned long *link_modes)
+ {
+ u32 i, ptys_modes = 0;
+@@ -1068,13 +1084,9 @@ int mlx5e_ethtool_set_link_ksettings(str
+ link_modes = autoneg == AUTONEG_ENABLE ? ethtool2ptys_adver_func(adver) :
+ mlx5e_port_speed2linkmodes(mdev, speed, !ext);
+
+- if ((link_modes & MLX5E_PROT_MASK(MLX5E_56GBASE_R4)) &&
+- autoneg != AUTONEG_ENABLE) {
+- netdev_err(priv->netdev, "%s: 56G link speed requires autoneg enabled\n",
+- __func__);
+- err = -EINVAL;
++ err = mlx5e_speed_validate(priv->netdev, ext, link_modes, autoneg);
++ if (err)
+ goto out;
+- }
+
+ link_modes = link_modes & eproto.cap;
+ if (!link_modes) {
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Date: Sun, 3 Jan 2021 11:26:26 +1100
+Subject: net/sonic: Fix some resource leaks in error handling paths
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit 0f7ba7bc46fa0b574ccacf5672991b321e028492 ]
+
+A call to dma_alloc_coherent() is wrapped by sonic_alloc_descriptors().
+
+This is correctly freed in the remove function, but not in the error
+handling path of the probe function. Fix this by adding the missing
+dma_free_coherent() call.
+
+While at it, rename a label in order to be slightly more informative.
+
+Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Cc: Chris Zankel <chris@zankel.net>
+References: commit 10e3cc180e64 ("net/sonic: Fix a resource leak in an error handling path in 'jazz_sonic_probe()'")
+Fixes: 74f2a5f0ef64 ("xtensa: Add support for the Sonic Ethernet device for the XT2000 board.")
+Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/natsemi/macsonic.c | 12 ++++++++++--
+ drivers/net/ethernet/natsemi/xtsonic.c | 7 +++++--
+ 2 files changed, 15 insertions(+), 4 deletions(-)
+
+--- a/drivers/net/ethernet/natsemi/macsonic.c
++++ b/drivers/net/ethernet/natsemi/macsonic.c
+@@ -540,10 +540,14 @@ static int mac_sonic_platform_probe(stru
+
+ err = register_netdev(dev);
+ if (err)
+- goto out;
++ goto undo_probe;
+
+ return 0;
+
++undo_probe:
++ dma_free_coherent(lp->device,
++ SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
++ lp->descriptors, lp->descriptors_laddr);
+ out:
+ free_netdev(dev);
+
+@@ -618,12 +622,16 @@ static int mac_sonic_nubus_probe(struct
+
+ err = register_netdev(ndev);
+ if (err)
+- goto out;
++ goto undo_probe;
+
+ nubus_set_drvdata(board, ndev);
+
+ return 0;
+
++undo_probe:
++ dma_free_coherent(lp->device,
++ SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
++ lp->descriptors, lp->descriptors_laddr);
+ out:
+ free_netdev(ndev);
+ return err;
+--- a/drivers/net/ethernet/natsemi/xtsonic.c
++++ b/drivers/net/ethernet/natsemi/xtsonic.c
+@@ -265,11 +265,14 @@ int xtsonic_probe(struct platform_device
+ sonic_msg_init(dev);
+
+ if ((err = register_netdev(dev)))
+- goto out1;
++ goto undo_probe1;
+
+ return 0;
+
+-out1:
++undo_probe1:
++ dma_free_coherent(lp->device,
++ SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
++ lp->descriptors, lp->descriptors_laddr);
+ release_region(dev->base_addr, SONIC_MEM_SIZE);
+ out:
+ free_netdev(dev);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Jan 2021 05:17:43 -0600
+Subject: net: stmmac: dwmac-sun8i: Balance internal PHY power
+
+From: Samuel Holland <samuel@sholland.org>
+
+[ Upstream commit b8239638853e3e37b287e4bd4d57b41f14c78550 ]
+
+sun8i_dwmac_exit calls sun8i_dwmac_unpower_internal_phy, but
+sun8i_dwmac_init did not call sun8i_dwmac_power_internal_phy. This
+caused PHY power to remain off after a suspend/resume cycle. Fix this by
+recording if PHY power should be restored, and if so, restoring it.
+
+Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 31 ++++++++++++++++------
+ 1 file changed, 23 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -64,6 +64,7 @@ struct emac_variant {
+ * @variant: reference to the current board variant
+ * @regmap: regmap for using the syscon
+ * @internal_phy_powered: Does the internal PHY is enabled
++ * @use_internal_phy: Is the internal PHY selected for use
+ * @mux_handle: Internal pointer used by mdio-mux lib
+ */
+ struct sunxi_priv_data {
+@@ -74,6 +75,7 @@ struct sunxi_priv_data {
+ const struct emac_variant *variant;
+ struct regmap_field *regmap_field;
+ bool internal_phy_powered;
++ bool use_internal_phy;
+ void *mux_handle;
+ };
+
+@@ -523,8 +525,11 @@ static const struct stmmac_dma_ops sun8i
+ .dma_interrupt = sun8i_dwmac_dma_interrupt,
+ };
+
++static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv);
++
+ static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
+ {
++ struct net_device *ndev = platform_get_drvdata(pdev);
+ struct sunxi_priv_data *gmac = priv;
+ int ret;
+
+@@ -538,13 +543,25 @@ static int sun8i_dwmac_init(struct platf
+
+ ret = clk_prepare_enable(gmac->tx_clk);
+ if (ret) {
+- if (gmac->regulator)
+- regulator_disable(gmac->regulator);
+ dev_err(&pdev->dev, "Could not enable AHB clock\n");
+- return ret;
++ goto err_disable_regulator;
++ }
++
++ if (gmac->use_internal_phy) {
++ ret = sun8i_dwmac_power_internal_phy(netdev_priv(ndev));
++ if (ret)
++ goto err_disable_clk;
+ }
+
+ return 0;
++
++err_disable_clk:
++ clk_disable_unprepare(gmac->tx_clk);
++err_disable_regulator:
++ if (gmac->regulator)
++ regulator_disable(gmac->regulator);
++
++ return ret;
+ }
+
+ static void sun8i_dwmac_core_init(struct mac_device_info *hw,
+@@ -815,7 +832,6 @@ static int mdio_mux_syscon_switch_fn(int
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
+ u32 reg, val;
+ int ret = 0;
+- bool need_power_ephy = false;
+
+ if (current_child ^ desired_child) {
+ regmap_field_read(gmac->regmap_field, ®);
+@@ -823,13 +839,12 @@ static int mdio_mux_syscon_switch_fn(int
+ case DWMAC_SUN8I_MDIO_MUX_INTERNAL_ID:
+ dev_info(priv->device, "Switch mux to internal PHY");
+ val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SELECT;
+-
+- need_power_ephy = true;
++ gmac->use_internal_phy = true;
+ break;
+ case DWMAC_SUN8I_MDIO_MUX_EXTERNAL_ID:
+ dev_info(priv->device, "Switch mux to external PHY");
+ val = (reg & ~H3_EPHY_MUX_MASK) | H3_EPHY_SHUTDOWN;
+- need_power_ephy = false;
++ gmac->use_internal_phy = false;
+ break;
+ default:
+ dev_err(priv->device, "Invalid child ID %x\n",
+@@ -837,7 +852,7 @@ static int mdio_mux_syscon_switch_fn(int
+ return -EINVAL;
+ }
+ regmap_field_write(gmac->regmap_field, val);
+- if (need_power_ephy) {
++ if (gmac->use_internal_phy) {
+ ret = sun8i_dwmac_power_internal_phy(priv);
+ if (ret)
+ return ret;
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Samuel Holland <samuel@sholland.org>
+Date: Sun, 3 Jan 2021 05:17:42 -0600
+Subject: net: stmmac: dwmac-sun8i: Balance internal PHY resource references
+
+From: Samuel Holland <samuel@sholland.org>
+
+[ Upstream commit 529254216773acd5039c07aa18cf06fd1f9fccdd ]
+
+While stmmac_pltfr_remove calls sun8i_dwmac_exit, the sun8i_dwmac_init
+and sun8i_dwmac_exit functions are also called by the stmmac_platform
+suspend/resume callbacks. They may be called many times during the
+device's lifetime and should not release resources used by the driver.
+
+Furthermore, there was no error handling in case registering the MDIO
+mux failed during probe, and the EPHY clock was never released at all.
+
+Fix all of these issues by moving the deinitialization code to a driver
+removal callback. Also ensure the EPHY is powered down before removal.
+
+Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")
+Signed-off-by: Samuel Holland <samuel@sholland.org>
+Reviewed-by: Chen-Yu Tsai <wens@csie.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 27 +++++++++++++++++-----
+ 1 file changed, 21 insertions(+), 6 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+@@ -988,17 +988,12 @@ static void sun8i_dwmac_exit(struct plat
+ struct sunxi_priv_data *gmac = priv;
+
+ if (gmac->variant->soc_has_internal_phy) {
+- /* sun8i_dwmac_exit could be called with mdiomux uninit */
+- if (gmac->mux_handle)
+- mdio_mux_uninit(gmac->mux_handle);
+ if (gmac->internal_phy_powered)
+ sun8i_dwmac_unpower_internal_phy(gmac);
+ }
+
+ sun8i_dwmac_unset_syscon(gmac);
+
+- reset_control_put(gmac->rst_ephy);
+-
+ clk_disable_unprepare(gmac->tx_clk);
+
+ if (gmac->regulator)
+@@ -1227,12 +1222,32 @@ static int sun8i_dwmac_probe(struct plat
+
+ return ret;
+ dwmac_mux:
++ reset_control_put(gmac->rst_ephy);
++ clk_put(gmac->ephy_clk);
+ sun8i_dwmac_unset_syscon(gmac);
+ dwmac_exit:
+ stmmac_pltfr_remove(pdev);
+ return ret;
+ }
+
++static int sun8i_dwmac_remove(struct platform_device *pdev)
++{
++ struct net_device *ndev = platform_get_drvdata(pdev);
++ struct stmmac_priv *priv = netdev_priv(ndev);
++ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
++
++ if (gmac->variant->soc_has_internal_phy) {
++ mdio_mux_uninit(gmac->mux_handle);
++ sun8i_dwmac_unpower_internal_phy(gmac);
++ reset_control_put(gmac->rst_ephy);
++ clk_put(gmac->ephy_clk);
++ }
++
++ stmmac_pltfr_remove(pdev);
++
++ return 0;
++}
++
+ static const struct of_device_id sun8i_dwmac_match[] = {
+ { .compatible = "allwinner,sun8i-h3-emac",
+ .data = &emac_variant_h3 },
+@@ -1252,7 +1267,7 @@ MODULE_DEVICE_TABLE(of, sun8i_dwmac_matc
+
+ static struct platform_driver sun8i_dwmac_driver = {
+ .probe = sun8i_dwmac_probe,
+- .remove = stmmac_pltfr_remove,
++ .remove = sun8i_dwmac_remove,
+ .driver = {
+ .name = "dwmac-sun8i",
+ .pm = &stmmac_pltfr_pm_ops,
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Jakub Kicinski <kuba@kernel.org>
+Date: Wed, 30 Dec 2020 19:40:27 -0800
+Subject: net: vlan: avoid leaks on register_vlan_dev() failures
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+[ Upstream commit 55b7ab1178cbf41f979ff83236d3321ad35ed2ad ]
+
+VLAN checks for NETREG_UNINITIALIZED to distinguish between
+registration failure and unregistration in progress.
+
+Since commit cb626bf566eb ("net-sysfs: Fix reference count leak")
+registration failure may, however, result in NETREG_UNREGISTERED
+as well as NETREG_UNINITIALIZED.
+
+This fix is similer to cebb69754f37 ("rtnetlink: Fix
+memory(net_device) leak when ->newlink fails")
+
+Fixes: cb626bf566eb ("net-sysfs: Fix reference count leak")
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/8021q/vlan.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/net/8021q/vlan.c
++++ b/net/8021q/vlan.c
+@@ -280,7 +280,8 @@ static int register_vlan_device(struct n
+ return 0;
+
+ out_free_newdev:
+- if (new_dev->reg_state == NETREG_UNINITIALIZED)
++ if (new_dev->reg_state == NETREG_UNINITIALIZED ||
++ new_dev->reg_state == NETREG_UNREGISTERED)
+ free_netdev(new_dev);
+ return err;
+ }
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ido Schimmel <idosch@nvidia.com>
+Date: Thu, 7 Jan 2021 16:48:21 +0200
+Subject: nexthop: Fix off-by-one error in error path
+
+From: Ido Schimmel <idosch@nvidia.com>
+
+[ Upstream commit 07e61a979ca4dddb3661f59328b3cd109f6b0070 ]
+
+A reference was not taken for the current nexthop entry, so do not try
+to put it in the error path.
+
+Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
+Signed-off-by: Ido Schimmel <idosch@nvidia.com>
+Reviewed-by: Petr Machata <petrm@nvidia.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/nexthop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/ipv4/nexthop.c
++++ b/net/ipv4/nexthop.c
+@@ -1157,7 +1157,7 @@ static struct nexthop *nexthop_create_gr
+ return nh;
+
+ out_no_nh:
+- for (; i >= 0; --i)
++ for (i--; i >= 0; --i)
+ nexthop_put(nhg->nh_entries[i].nh);
+
+ kfree(nhg->spare);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Ido Schimmel <idosch@nvidia.com>
+Date: Thu, 7 Jan 2021 16:48:22 +0200
+Subject: nexthop: Unlink nexthop group entry in error path
+
+From: Ido Schimmel <idosch@nvidia.com>
+
+[ Upstream commit 7b01e53eee6dce7a8a6736e06b99b68cd0cc7a27 ]
+
+In case of error, remove the nexthop group entry from the list to which
+it was previously added.
+
+Fixes: 430a049190de ("nexthop: Add support for nexthop groups")
+Signed-off-by: Ido Schimmel <idosch@nvidia.com>
+Reviewed-by: Petr Machata <petrm@nvidia.com>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/ipv4/nexthop.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/net/ipv4/nexthop.c
++++ b/net/ipv4/nexthop.c
+@@ -1157,8 +1157,10 @@ static struct nexthop *nexthop_create_gr
+ return nh;
+
+ out_no_nh:
+- for (i--; i >= 0; --i)
++ for (i--; i >= 0; --i) {
++ list_del(&nhg->nh_entries[i].nh_list);
+ nexthop_put(nhg->nh_entries[i].nh);
++ }
+
+ kfree(nhg->spare);
+ kfree(nhg);
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Colin Ian King <colin.king@canonical.com>
+Date: Thu, 7 Jan 2021 12:39:16 +0000
+Subject: octeontx2-af: fix memory leak of lmac and lmac->name
+
+From: Colin Ian King <colin.king@canonical.com>
+
+[ Upstream commit ac7996d680d8b4a51bb99bbdcee3dc838b985498 ]
+
+Currently the error return paths don't kfree lmac and lmac->name
+leading to some memory leaks. Fix this by adding two error return
+paths that kfree these objects
+
+Addresses-Coverity: ("Resource leak")
+Fixes: 1463f382f58d ("octeontx2-af: Add support for CGX link management")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+Link: https://lore.kernel.org/r/20210107123916.189748-1-colin.king@canonical.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
++++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c
+@@ -725,8 +725,10 @@ static int cgx_lmac_init(struct cgx *cgx
+ if (!lmac)
+ return -ENOMEM;
+ lmac->name = kcalloc(1, sizeof("cgx_fwi_xxx_yyy"), GFP_KERNEL);
+- if (!lmac->name)
+- return -ENOMEM;
++ if (!lmac->name) {
++ err = -ENOMEM;
++ goto err_lmac_free;
++ }
+ sprintf(lmac->name, "cgx_fwi_%d_%d", cgx->cgx_id, i);
+ lmac->lmac_id = i;
+ lmac->cgx = cgx;
+@@ -737,7 +739,7 @@ static int cgx_lmac_init(struct cgx *cgx
+ CGX_LMAC_FWI + i * 9),
+ cgx_fwi_event_handler, 0, lmac->name, lmac);
+ if (err)
+- return err;
++ goto err_irq;
+
+ /* Enable interrupt */
+ cgx_write(cgx, lmac->lmac_id, CGXX_CMRX_INT_ENA_W1S,
+@@ -748,6 +750,12 @@ static int cgx_lmac_init(struct cgx *cgx
+ }
+
+ return cgx_lmac_verify_fwi_version(cgx);
++
++err_irq:
++ kfree(lmac->name);
++err_lmac_free:
++ kfree(lmac);
++ return err;
+ }
+
+ static int cgx_lmac_exit(struct cgx *cgx)
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Julian Wiedmann <jwi@linux.ibm.com>
+Date: Thu, 7 Jan 2021 18:24:42 +0100
+Subject: s390/qeth: fix L2 header access in qeth_l3_osa_features_check()
+
+From: Julian Wiedmann <jwi@linux.ibm.com>
+
+[ Upstream commit f9c4845385c8f6631ebd5dddfb019ea7a285fba4 ]
+
+ip_finish_output_gso() may call .ndo_features_check() even before the
+skb has a L2 header. This conflicts with qeth_get_ip_version()'s attempt
+to inspect the L2 header via vlan_eth_hdr().
+
+Switch to vlan_get_protocol(), as already used further down in the
+common qeth_features_check() path.
+
+Fixes: f13ade199391 ("s390/qeth: run non-offload L3 traffic over common xmit path")
+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>
+---
+ drivers/s390/net/qeth_l3_main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/s390/net/qeth_l3_main.c
++++ b/drivers/s390/net/qeth_l3_main.c
+@@ -2114,7 +2114,7 @@ static netdev_features_t qeth_l3_osa_fea
+ struct net_device *dev,
+ netdev_features_t features)
+ {
+- if (qeth_get_ip_version(skb) != 4)
++ if (vlan_get_protocol(skb) != htons(ETH_P_IP))
+ features &= ~NETIF_F_HW_VLAN_CTAG_TX;
+ return qeth_features_check(skb, dev, features);
+ }
x86-asm-32-add-ends-to-some-functions-and-relabel-wi.patch
vfio-iommu-add-dma-available-capability.patch
+net-cdc_ncm-correct-overhead-in-delayed_ndp_size.patch
+net-hns3-fix-the-number-of-queues-actually-used-by-arq.patch
+net-hns3-fix-a-phy-loopback-fail-issue.patch
+net-stmmac-dwmac-sun8i-balance-internal-phy-resource-references.patch
+net-stmmac-dwmac-sun8i-balance-internal-phy-power.patch
+net-vlan-avoid-leaks-on-register_vlan_dev-failures.patch
+net-sonic-fix-some-resource-leaks-in-error-handling-paths.patch
+net-ipv6-fib-flush-exceptions-when-purging-route.patch
+tools-selftests-add-test-for-changing-routes-with-ptmu-exceptions.patch
+net-fix-pmtu-check-in-nopmtudisc-mode.patch
+net-ip-always-refragment-ip-defragmented-packets.patch
+octeontx2-af-fix-memory-leak-of-lmac-and-lmac-name.patch
+nexthop-fix-off-by-one-error-in-error-path.patch
+nexthop-unlink-nexthop-group-entry-in-error-path.patch
+s390-qeth-fix-l2-header-access-in-qeth_l3_osa_features_check.patch
+net-dsa-lantiq_gswip-exclude-rmii-from-modes-that-report-1-gbe.patch
+net-mlx5-use-port_num-1-instead-of-0-when-delete-a-roce-address.patch
+net-mlx5e-ethtool-fix-restriction-of-autoneg-with-56g.patch
+chtls-fix-hardware-tid-leak.patch
+chtls-remove-invalid-set_tcb-call.patch
+chtls-fix-panic-when-route-to-peer-not-configured.patch
+chtls-replace-skb_dequeue-with-skb_peek.patch
+chtls-added-a-check-to-avoid-null-pointer-dereference.patch
+chtls-fix-chtls-resources-release-sequence.patch
--- /dev/null
+From foo@baz Fri Jan 15 08:22:25 AM CET 2021
+From: Sean Tranchetti <stranche@codeaurora.org>
+Date: Tue, 5 Jan 2021 16:22:26 -0800
+Subject: tools: selftests: add test for changing routes with PTMU exceptions
+
+From: Sean Tranchetti <stranche@codeaurora.org>
+
+[ Upstream commit 5316a7c0130acf09bfc8bb0092407006010fcccc ]
+
+Adds new 2 new tests to the PTMU script: pmtu_ipv4/6_route_change.
+
+These tests explicitly test for a recently discovered problem in the
+IPv6 routing framework where PMTU exceptions were not properly released
+when replacing a route via "ip route change ...".
+
+After creating PMTU exceptions, the route from the device A to R1 will be
+replaced with a new route, then device A will be deleted. If the PMTU
+exceptions were properly cleaned up by the kernel, this device deletion
+will succeed. Otherwise, the unregistration of the device will stall, and
+messages such as the following will be logged in dmesg:
+
+unregister_netdevice: waiting for veth_A-R1 to become free. Usage count = 4
+
+Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Link: https://lore.kernel.org/r/1609892546-11389-2-git-send-email-stranche@quicinc.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/pmtu.sh | 71 ++++++++++++++++++++++++++++++++++--
+ 1 file changed, 69 insertions(+), 2 deletions(-)
+
+--- a/tools/testing/selftests/net/pmtu.sh
++++ b/tools/testing/selftests/net/pmtu.sh
+@@ -119,7 +119,15 @@
+ # - list_flush_ipv6_exception
+ # Using the same topology as in pmtu_ipv6, create exceptions, and check
+ # they are shown when listing exception caches, gone after flushing them
+-
++#
++# - pmtu_ipv4_route_change
++# Use the same topology as in pmtu_ipv4, but issue a route replacement
++# command and delete the corresponding device afterward. This tests for
++# proper cleanup of the PMTU exceptions by the route replacement path.
++# Device unregistration should complete successfully
++#
++# - pmtu_ipv6_route_change
++# Same as above but with IPv6
+
+ # Kselftest framework requirement - SKIP code is 4.
+ ksft_skip=4
+@@ -161,7 +169,9 @@ tests="
+ cleanup_ipv4_exception ipv4: cleanup of cached exceptions 1
+ cleanup_ipv6_exception ipv6: cleanup of cached exceptions 1
+ list_flush_ipv4_exception ipv4: list and flush cached exceptions 1
+- list_flush_ipv6_exception ipv6: list and flush cached exceptions 1"
++ list_flush_ipv6_exception ipv6: list and flush cached exceptions 1
++ pmtu_ipv4_route_change ipv4: PMTU exception w/route replace 1
++ pmtu_ipv6_route_change ipv6: PMTU exception w/route replace 1"
+
+ NS_A="ns-A"
+ NS_B="ns-B"
+@@ -1316,6 +1326,63 @@ test_list_flush_ipv6_exception() {
+ return ${fail}
+ }
+
++test_pmtu_ipvX_route_change() {
++ family=${1}
++
++ setup namespaces routing || return 2
++ trace "${ns_a}" veth_A-R1 "${ns_r1}" veth_R1-A \
++ "${ns_r1}" veth_R1-B "${ns_b}" veth_B-R1 \
++ "${ns_a}" veth_A-R2 "${ns_r2}" veth_R2-A \
++ "${ns_r2}" veth_R2-B "${ns_b}" veth_B-R2
++
++ if [ ${family} -eq 4 ]; then
++ ping=ping
++ dst1="${prefix4}.${b_r1}.1"
++ dst2="${prefix4}.${b_r2}.1"
++ gw="${prefix4}.${a_r1}.2"
++ else
++ ping=${ping6}
++ dst1="${prefix6}:${b_r1}::1"
++ dst2="${prefix6}:${b_r2}::1"
++ gw="${prefix6}:${a_r1}::2"
++ fi
++
++ # Set up initial MTU values
++ mtu "${ns_a}" veth_A-R1 2000
++ mtu "${ns_r1}" veth_R1-A 2000
++ mtu "${ns_r1}" veth_R1-B 1400
++ mtu "${ns_b}" veth_B-R1 1400
++
++ mtu "${ns_a}" veth_A-R2 2000
++ mtu "${ns_r2}" veth_R2-A 2000
++ mtu "${ns_r2}" veth_R2-B 1500
++ mtu "${ns_b}" veth_B-R2 1500
++
++ # Create route exceptions
++ run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst1}
++ run_cmd ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst2}
++
++ # Check that exceptions have been created with the correct PMTU
++ pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"
++ check_pmtu_value "1400" "${pmtu_1}" "exceeding MTU" || return 1
++ pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
++ check_pmtu_value "1500" "${pmtu_2}" "exceeding MTU" || return 1
++
++ # Replace the route from A to R1
++ run_cmd ${ns_a} ip route change default via ${gw}
++
++ # Delete the device in A
++ run_cmd ${ns_a} ip link del "veth_A-R1"
++}
++
++test_pmtu_ipv4_route_change() {
++ test_pmtu_ipvX_route_change 4
++}
++
++test_pmtu_ipv6_route_change() {
++ test_pmtu_ipvX_route_change 6
++}
++
+ usage() {
+ echo
+ echo "$0 [OPTIONS] [TEST]..."