]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Sun, 28 Aug 2022 14:31:04 +0000 (10:31 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 28 Aug 2022 14:31:04 +0000 (10:31 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
18 files changed:
queue-4.14/af_key-do-not-call-xfrm_probe_algs-in-parallel.patch [new file with mode: 0644]
queue-4.14/bonding-802.3ad-fix-no-transmission-of-lacpdus.patch [new file with mode: 0644]
queue-4.14/ixgbe-stop-resetting-systime-in-ixgbe_ptp_start_cycl.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-netdev_budget.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-netdev_budget_usecs.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_poll.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_read.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-sysctl_somaxconn.patch [new file with mode: 0644]
queue-4.14/net-fix-a-data-race-around-sysctl_tstamp_allow_data.patch [new file with mode: 0644]
queue-4.14/net-fix-data-races-around-weight_p-and-dev_weight_-r.patch [new file with mode: 0644]
queue-4.14/net-ipvtap-add-__init-__exit-annotations-to-module-i.patch [new file with mode: 0644]
queue-4.14/netfilter-ebtables-reject-blobs-that-don-t-provide-a.patch [new file with mode: 0644]
queue-4.14/netfilter-nft_payload-do-not-truncate-csum_offset-an.patch [new file with mode: 0644]
queue-4.14/netfilter-nft_payload-report-erange-for-too-long-off.patch [new file with mode: 0644]
queue-4.14/ratelimit-fix-data-races-in-___ratelimit.patch [new file with mode: 0644]
queue-4.14/rose-check-null-rose_loopback_neigh-loopback.patch [new file with mode: 0644]
queue-4.14/series
queue-4.14/xfrm-fix-refcount-leak-in-__xfrm_policy_check.patch [new file with mode: 0644]

diff --git a/queue-4.14/af_key-do-not-call-xfrm_probe_algs-in-parallel.patch b/queue-4.14/af_key-do-not-call-xfrm_probe_algs-in-parallel.patch
new file mode 100644 (file)
index 0000000..b66e980
--- /dev/null
@@ -0,0 +1,42 @@
+From d6cf0317bb0df5a49612615b2f585f5295e62b6d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Aug 2022 18:03:46 +0800
+Subject: af_key: Do not call xfrm_probe_algs in parallel
+
+From: Herbert Xu <herbert@gondor.apana.org.au>
+
+[ Upstream commit ba953a9d89a00c078b85f4b190bc1dde66fe16b5 ]
+
+When namespace support was added to xfrm/afkey, it caused the
+previously single-threaded call to xfrm_probe_algs to become
+multi-threaded.  This is buggy and needs to be fixed with a mutex.
+
+Reported-by: Abhishek Shah <abhishek.shah@columbia.edu>
+Fixes: 283bc9f35bbb ("xfrm: Namespacify xfrm state/policy locks")
+Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/key/af_key.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/net/key/af_key.c b/net/key/af_key.c
+index 035123bf7259b..5f0d6a567a1e3 100644
+--- a/net/key/af_key.c
++++ b/net/key/af_key.c
+@@ -1707,9 +1707,12 @@ static int pfkey_register(struct sock *sk, struct sk_buff *skb, const struct sad
+               pfk->registered |= (1<<hdr->sadb_msg_satype);
+       }
++      mutex_lock(&pfkey_mutex);
+       xfrm_probe_algs();
+       supp_skb = compose_sadb_supported(hdr, GFP_KERNEL | __GFP_ZERO);
++      mutex_unlock(&pfkey_mutex);
++
+       if (!supp_skb) {
+               if (hdr->sadb_msg_satype != SADB_SATYPE_UNSPEC)
+                       pfk->registered &= ~(1<<hdr->sadb_msg_satype);
+-- 
+2.35.1
+
diff --git a/queue-4.14/bonding-802.3ad-fix-no-transmission-of-lacpdus.patch b/queue-4.14/bonding-802.3ad-fix-no-transmission-of-lacpdus.patch
new file mode 100644 (file)
index 0000000..86c15e6
--- /dev/null
@@ -0,0 +1,137 @@
+From a6c3c52edb732fbef27436b751a4421d3962bcda Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 19 Aug 2022 11:15:13 -0400
+Subject: bonding: 802.3ad: fix no transmission of LACPDUs
+
+From: Jonathan Toppins <jtoppins@redhat.com>
+
+[ Upstream commit d745b5062ad2b5da90a5e728d7ca884fc07315fd ]
+
+This is caused by the global variable ad_ticks_per_sec being zero as
+demonstrated by the reproducer script discussed below. This causes
+all timer values in __ad_timer_to_ticks to be zero, resulting
+in the periodic timer to never fire.
+
+To reproduce:
+Run the script in
+`tools/testing/selftests/drivers/net/bonding/bond-break-lacpdu-tx.sh` which
+puts bonding into a state where it never transmits LACPDUs.
+
+line 44: ip link add fbond type bond mode 4 miimon 200 \
+            xmit_hash_policy 1 ad_actor_sys_prio 65535 lacp_rate fast
+setting bond param: ad_actor_sys_prio
+given:
+    params.ad_actor_system = 0
+call stack:
+    bond_option_ad_actor_sys_prio()
+    -> bond_3ad_update_ad_actor_settings()
+       -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
+       -> ad.system.sys_mac_addr = bond->dev->dev_addr; because
+            params.ad_actor_system == 0
+results:
+     ad.system.sys_mac_addr = bond->dev->dev_addr
+
+line 48: ip link set fbond address 52:54:00:3B:7C:A6
+setting bond MAC addr
+call stack:
+    bond->dev->dev_addr = new_mac
+
+line 52: ip link set fbond type bond ad_actor_sys_prio 65535
+setting bond param: ad_actor_sys_prio
+given:
+    params.ad_actor_system = 0
+call stack:
+    bond_option_ad_actor_sys_prio()
+    -> bond_3ad_update_ad_actor_settings()
+       -> set ad.system.sys_priority = bond->params.ad_actor_sys_prio
+       -> ad.system.sys_mac_addr = bond->dev->dev_addr; because
+            params.ad_actor_system == 0
+results:
+     ad.system.sys_mac_addr = bond->dev->dev_addr
+
+line 60: ip link set veth1-bond down master fbond
+given:
+    params.ad_actor_system = 0
+    params.mode = BOND_MODE_8023AD
+    ad.system.sys_mac_addr == bond->dev->dev_addr
+call stack:
+    bond_enslave
+    -> bond_3ad_initialize(); because first slave
+       -> if ad.system.sys_mac_addr != bond->dev->dev_addr
+          return
+results:
+     Nothing is run in bond_3ad_initialize() because dev_addr equals
+     sys_mac_addr leaving the global ad_ticks_per_sec zero as it is
+     never initialized anywhere else.
+
+The if check around the contents of bond_3ad_initialize() is no longer
+needed due to commit 5ee14e6d336f ("bonding: 3ad: apply ad_actor settings
+changes immediately") which sets ad.system.sys_mac_addr if any one of
+the bonding parameters whos set function calls
+bond_3ad_update_ad_actor_settings(). This is because if
+ad.system.sys_mac_addr is zero it will be set to the current bond mac
+address, this causes the if check to never be true.
+
+Fixes: 5ee14e6d336f ("bonding: 3ad: apply ad_actor settings changes immediately")
+Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
+Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/bonding/bond_3ad.c | 38 ++++++++++++++--------------------
+ 1 file changed, 16 insertions(+), 22 deletions(-)
+
+diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c
+index b3eaef31b7673..a6bb7e915f74f 100644
+--- a/drivers/net/bonding/bond_3ad.c
++++ b/drivers/net/bonding/bond_3ad.c
+@@ -1977,30 +1977,24 @@ void bond_3ad_initiate_agg_selection(struct bonding *bond, int timeout)
+  */
+ void bond_3ad_initialize(struct bonding *bond, u16 tick_resolution)
+ {
+-      /* check that the bond is not initialized yet */
+-      if (!MAC_ADDRESS_EQUAL(&(BOND_AD_INFO(bond).system.sys_mac_addr),
+-                              bond->dev->dev_addr)) {
+-
+-              BOND_AD_INFO(bond).aggregator_identifier = 0;
+-
+-              BOND_AD_INFO(bond).system.sys_priority =
+-                      bond->params.ad_actor_sys_prio;
+-              if (is_zero_ether_addr(bond->params.ad_actor_system))
+-                      BOND_AD_INFO(bond).system.sys_mac_addr =
+-                          *((struct mac_addr *)bond->dev->dev_addr);
+-              else
+-                      BOND_AD_INFO(bond).system.sys_mac_addr =
+-                          *((struct mac_addr *)bond->params.ad_actor_system);
++      BOND_AD_INFO(bond).aggregator_identifier = 0;
++      BOND_AD_INFO(bond).system.sys_priority =
++              bond->params.ad_actor_sys_prio;
++      if (is_zero_ether_addr(bond->params.ad_actor_system))
++              BOND_AD_INFO(bond).system.sys_mac_addr =
++                  *((struct mac_addr *)bond->dev->dev_addr);
++      else
++              BOND_AD_INFO(bond).system.sys_mac_addr =
++                  *((struct mac_addr *)bond->params.ad_actor_system);
+-              /* initialize how many times this module is called in one
+-               * second (should be about every 100ms)
+-               */
+-              ad_ticks_per_sec = tick_resolution;
++      /* initialize how many times this module is called in one
++       * second (should be about every 100ms)
++       */
++      ad_ticks_per_sec = tick_resolution;
+-              bond_3ad_initiate_agg_selection(bond,
+-                                              AD_AGGREGATOR_SELECTION_TIMER *
+-                                              ad_ticks_per_sec);
+-      }
++      bond_3ad_initiate_agg_selection(bond,
++                                      AD_AGGREGATOR_SELECTION_TIMER *
++                                      ad_ticks_per_sec);
+ }
+ /**
+-- 
+2.35.1
+
diff --git a/queue-4.14/ixgbe-stop-resetting-systime-in-ixgbe_ptp_start_cycl.patch b/queue-4.14/ixgbe-stop-resetting-systime-in-ixgbe_ptp_start_cycl.patch
new file mode 100644 (file)
index 0000000..ed029e7
--- /dev/null
@@ -0,0 +1,137 @@
+From 39dfec6e573b258bfd573d2a293c341da34876e6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 1 Aug 2022 17:24:19 -0700
+Subject: ixgbe: stop resetting SYSTIME in ixgbe_ptp_start_cyclecounter
+
+From: Jacob Keller <jacob.e.keller@intel.com>
+
+[ Upstream commit 25d7a5f5a6bb15a2dae0a3f39ea5dda215024726 ]
+
+The ixgbe_ptp_start_cyclecounter is intended to be called whenever the
+cyclecounter parameters need to be changed.
+
+Since commit a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x
+devices"), this function has cleared the SYSTIME registers and reset the
+TSAUXC DISABLE_SYSTIME bit.
+
+While these need to be cleared during ixgbe_ptp_reset, it is wrong to clear
+them during ixgbe_ptp_start_cyclecounter. This function may be called
+during both reset and link status change. When link changes, the SYSTIME
+counter is still operating normally, but the cyclecounter should be updated
+to account for the possibly changed parameters.
+
+Clearing SYSTIME when link changes causes the timecounter to jump because
+the cycle counter now reads zero.
+
+Extract the SYSTIME initialization out to a new function and call this
+during ixgbe_ptp_reset. This prevents the timecounter adjustment and avoids
+an unnecessary reset of the current time.
+
+This also restores the original SYSTIME clearing that occurred during
+ixgbe_ptp_reset before the commit above.
+
+Reported-by: Steve Payne <spayne@aurora.tech>
+Reported-by: Ilya Evenbach <ievenbach@aurora.tech>
+Fixes: a9763f3cb54c ("ixgbe: Update PTP to support X550EM_x devices")
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Tested-by: Gurucharan <gurucharanx.g@intel.com> (A Contingent worker at Intel)
+Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c | 59 +++++++++++++++-----
+ 1 file changed, 46 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+index 86d6924a2b714..ad51b521e693a 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c
+@@ -1090,7 +1090,6 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
+       struct cyclecounter cc;
+       unsigned long flags;
+       u32 incval = 0;
+-      u32 tsauxc = 0;
+       u32 fuse0 = 0;
+       /* For some of the boards below this mask is technically incorrect.
+@@ -1125,18 +1124,6 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
+       case ixgbe_mac_x550em_a:
+       case ixgbe_mac_X550:
+               cc.read = ixgbe_ptp_read_X550;
+-
+-              /* enable SYSTIME counter */
+-              IXGBE_WRITE_REG(hw, IXGBE_SYSTIMR, 0);
+-              IXGBE_WRITE_REG(hw, IXGBE_SYSTIML, 0);
+-              IXGBE_WRITE_REG(hw, IXGBE_SYSTIMH, 0);
+-              tsauxc = IXGBE_READ_REG(hw, IXGBE_TSAUXC);
+-              IXGBE_WRITE_REG(hw, IXGBE_TSAUXC,
+-                              tsauxc & ~IXGBE_TSAUXC_DISABLE_SYSTIME);
+-              IXGBE_WRITE_REG(hw, IXGBE_TSIM, IXGBE_TSIM_TXTS);
+-              IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_TIMESYNC);
+-
+-              IXGBE_WRITE_FLUSH(hw);
+               break;
+       case ixgbe_mac_X540:
+               cc.read = ixgbe_ptp_read_82599;
+@@ -1168,6 +1155,50 @@ void ixgbe_ptp_start_cyclecounter(struct ixgbe_adapter *adapter)
+       spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+ }
++/**
++ * ixgbe_ptp_init_systime - Initialize SYSTIME registers
++ * @adapter: the ixgbe private board structure
++ *
++ * Initialize and start the SYSTIME registers.
++ */
++static void ixgbe_ptp_init_systime(struct ixgbe_adapter *adapter)
++{
++      struct ixgbe_hw *hw = &adapter->hw;
++      u32 tsauxc;
++
++      switch (hw->mac.type) {
++      case ixgbe_mac_X550EM_x:
++      case ixgbe_mac_x550em_a:
++      case ixgbe_mac_X550:
++              tsauxc = IXGBE_READ_REG(hw, IXGBE_TSAUXC);
++
++              /* Reset SYSTIME registers to 0 */
++              IXGBE_WRITE_REG(hw, IXGBE_SYSTIMR, 0);
++              IXGBE_WRITE_REG(hw, IXGBE_SYSTIML, 0);
++              IXGBE_WRITE_REG(hw, IXGBE_SYSTIMH, 0);
++
++              /* Reset interrupt settings */
++              IXGBE_WRITE_REG(hw, IXGBE_TSIM, IXGBE_TSIM_TXTS);
++              IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_TIMESYNC);
++
++              /* Activate the SYSTIME counter */
++              IXGBE_WRITE_REG(hw, IXGBE_TSAUXC,
++                              tsauxc & ~IXGBE_TSAUXC_DISABLE_SYSTIME);
++              break;
++      case ixgbe_mac_X540:
++      case ixgbe_mac_82599EB:
++              /* Reset SYSTIME registers to 0 */
++              IXGBE_WRITE_REG(hw, IXGBE_SYSTIML, 0);
++              IXGBE_WRITE_REG(hw, IXGBE_SYSTIMH, 0);
++              break;
++      default:
++              /* Other devices aren't supported */
++              return;
++      };
++
++      IXGBE_WRITE_FLUSH(hw);
++}
++
+ /**
+  * ixgbe_ptp_reset
+  * @adapter: the ixgbe private board structure
+@@ -1194,6 +1225,8 @@ void ixgbe_ptp_reset(struct ixgbe_adapter *adapter)
+       ixgbe_ptp_start_cyclecounter(adapter);
++      ixgbe_ptp_init_systime(adapter);
++
+       spin_lock_irqsave(&adapter->tmreg_lock, flags);
+       timecounter_init(&adapter->hw_tc, &adapter->hw_cc,
+                        ktime_to_ns(ktime_get_real()));
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-netdev_budget.patch b/queue-4.14/net-fix-a-data-race-around-netdev_budget.patch
new file mode 100644 (file)
index 0000000..98935e9
--- /dev/null
@@ -0,0 +1,36 @@
+From 480827e9fa8be089b0f2c309a8b098667e95d0f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:53 -0700
+Subject: net: Fix a data-race around netdev_budget.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 2e0c42374ee32e72948559d2ae2f7ba3dc6b977c ]
+
+While reading netdev_budget, it can be changed concurrently.
+Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: 51b0bdedb8e7 ("[NET]: Separate two usages of netdev_max_backlog.")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/dev.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index 51721fb2e30cf..f6d3cbc57425c 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -5649,7 +5649,7 @@ static __latent_entropy void net_rx_action(struct softirq_action *h)
+       struct softnet_data *sd = this_cpu_ptr(&softnet_data);
+       unsigned long time_limit = jiffies +
+               usecs_to_jiffies(netdev_budget_usecs);
+-      int budget = netdev_budget;
++      int budget = READ_ONCE(netdev_budget);
+       LIST_HEAD(list);
+       LIST_HEAD(repoll);
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-netdev_budget_usecs.patch b/queue-4.14/net-fix-a-data-race-around-netdev_budget_usecs.patch
new file mode 100644 (file)
index 0000000..c84c70b
--- /dev/null
@@ -0,0 +1,36 @@
+From 89fc07d8955ef4c8aaf68edefd1f6b0f08cbb4ac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:55 -0700
+Subject: net: Fix a data-race around netdev_budget_usecs.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit fa45d484c52c73f79db2c23b0cdfc6c6455093ad ]
+
+While reading netdev_budget_usecs, it can be changed concurrently.
+Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: 7acf8a1e8a28 ("Replace 2 jiffies with sysctl netdev_budget_usecs to enable softirq tuning")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/dev.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index f6d3cbc57425c..4741c239af170 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -5648,7 +5648,7 @@ static __latent_entropy void net_rx_action(struct softirq_action *h)
+ {
+       struct softnet_data *sd = this_cpu_ptr(&softnet_data);
+       unsigned long time_limit = jiffies +
+-              usecs_to_jiffies(netdev_budget_usecs);
++              usecs_to_jiffies(READ_ONCE(netdev_budget_usecs));
+       int budget = READ_ONCE(netdev_budget);
+       LIST_HEAD(list);
+       LIST_HEAD(repoll);
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_poll.patch b/queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_poll.patch
new file mode 100644 (file)
index 0000000..8dfb75e
--- /dev/null
@@ -0,0 +1,36 @@
+From 178a92dc4426713855ddebfb55d03f50f97e7f57 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:51 -0700
+Subject: net: Fix a data-race around sysctl_net_busy_poll.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit c42b7cddea47503411bfb5f2f93a4154aaffa2d9 ]
+
+While reading sysctl_net_busy_poll, it can be changed concurrently.
+Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: 060212928670 ("net: add low latency socket poll")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/net/busy_poll.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
+index 5dd22b740f9ce..4a9fc96317a9e 100644
+--- a/include/net/busy_poll.h
++++ b/include/net/busy_poll.h
+@@ -43,7 +43,7 @@ extern unsigned int sysctl_net_busy_poll __read_mostly;
+ static inline bool net_busy_loop_on(void)
+ {
+-      return sysctl_net_busy_poll;
++      return READ_ONCE(sysctl_net_busy_poll);
+ }
+ static inline bool sk_can_busy_loop(const struct sock *sk)
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_read.patch b/queue-4.14/net-fix-a-data-race-around-sysctl_net_busy_read.patch
new file mode 100644 (file)
index 0000000..aa1d0e0
--- /dev/null
@@ -0,0 +1,36 @@
+From 0163bacee4054f376ef2470cbf771edc7e762db1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:52 -0700
+Subject: net: Fix a data-race around sysctl_net_busy_read.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit e59ef36f0795696ab229569c153936bfd068d21c ]
+
+While reading sysctl_net_busy_read, it can be changed concurrently.
+Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: 2d48d67fa8cd ("net: poll/select low latency socket support")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/sock.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/sock.c b/net/core/sock.c
+index bbf9517218ff3..002c91dd7191f 100644
+--- a/net/core/sock.c
++++ b/net/core/sock.c
+@@ -2783,7 +2783,7 @@ void sock_init_data(struct socket *sock, struct sock *sk)
+ #ifdef CONFIG_NET_RX_BUSY_POLL
+       sk->sk_napi_id          =       0;
+-      sk->sk_ll_usec          =       sysctl_net_busy_read;
++      sk->sk_ll_usec          =       READ_ONCE(sysctl_net_busy_read);
+ #endif
+       sk->sk_max_pacing_rate = ~0U;
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-sysctl_somaxconn.patch b/queue-4.14/net-fix-a-data-race-around-sysctl_somaxconn.patch
new file mode 100644 (file)
index 0000000..5e9775f
--- /dev/null
@@ -0,0 +1,36 @@
+From 4a097eb046f311942d6cffa3472d21b42f0ab9a2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:47:00 -0700
+Subject: net: Fix a data-race around sysctl_somaxconn.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 3c9ba81d72047f2e81bb535d42856517b613aba7 ]
+
+While reading sysctl_somaxconn, it can be changed concurrently.
+Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/socket.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/socket.c b/net/socket.c
+index c74cfe1ee1699..7bcd7053e61f2 100644
+--- a/net/socket.c
++++ b/net/socket.c
+@@ -1509,7 +1509,7 @@ SYSCALL_DEFINE2(listen, int, fd, int, backlog)
+       sock = sockfd_lookup_light(fd, &err, &fput_needed);
+       if (sock) {
+-              somaxconn = sock_net(sock->sk)->core.sysctl_somaxconn;
++              somaxconn = READ_ONCE(sock_net(sock->sk)->core.sysctl_somaxconn);
+               if ((unsigned int)backlog > somaxconn)
+                       backlog = somaxconn;
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-a-data-race-around-sysctl_tstamp_allow_data.patch b/queue-4.14/net-fix-a-data-race-around-sysctl_tstamp_allow_data.patch
new file mode 100644 (file)
index 0000000..929bbc1
--- /dev/null
@@ -0,0 +1,36 @@
+From c2eb66af1943726e635c6adfd368b82ef7b5cbc7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:50 -0700
+Subject: net: Fix a data-race around sysctl_tstamp_allow_data.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit d2154b0afa73c0159b2856f875c6b4fe7cf6a95e ]
+
+While reading sysctl_tstamp_allow_data, it can be changed
+concurrently.  Thus, we need to add READ_ONCE() to its reader.
+
+Fixes: b245be1f4db1 ("net-timestamp: no-payload only sysctl")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/skbuff.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/core/skbuff.c b/net/core/skbuff.c
+index 629997753f69b..11d0ffc51c24a 100644
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -4352,7 +4352,7 @@ static bool skb_may_tx_timestamp(struct sock *sk, bool tsonly)
+ {
+       bool ret;
+-      if (likely(sysctl_tstamp_allow_data || tsonly))
++      if (likely(READ_ONCE(sysctl_tstamp_allow_data) || tsonly))
+               return true;
+       read_lock_bh(&sk->sk_callback_lock);
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-fix-data-races-around-weight_p-and-dev_weight_-r.patch b/queue-4.14/net-fix-data-races-around-weight_p-and-dev_weight_-r.patch
new file mode 100644 (file)
index 0000000..8240e09
--- /dev/null
@@ -0,0 +1,85 @@
+From 835e887a1aedf1d60430bf1e5c64fa82ace01c54 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:45 -0700
+Subject: net: Fix data-races around weight_p and dev_weight_[rt]x_bias.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit bf955b5ab8f6f7b0632cdef8e36b14e4f6e77829 ]
+
+While reading weight_p, it can be changed concurrently.  Thus, we need
+to add READ_ONCE() to its reader.
+
+Also, dev_[rt]x_weight can be read/written at the same time.  So, we
+need to use READ_ONCE() and WRITE_ONCE() for its access.  Moreover, to
+use the same weight_p while changing dev_[rt]x_weight, we add a mutex
+in proc_do_dev_weight().
+
+Fixes: 3d48b53fb2ae ("net: dev_weight: TX/RX orthogonality")
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/core/dev.c             |  2 +-
+ net/core/sysctl_net_core.c | 15 +++++++++------
+ net/sched/sch_generic.c    |  2 +-
+ 3 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/net/core/dev.c b/net/core/dev.c
+index ea09e0809c122..51721fb2e30cf 100644
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -5186,7 +5186,7 @@ static int process_backlog(struct napi_struct *napi, int quota)
+               net_rps_action_and_irq_enable(sd);
+       }
+-      napi->weight = dev_rx_weight;
++      napi->weight = READ_ONCE(dev_rx_weight);
+       while (again) {
+               struct sk_buff *skb;
+diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
+index ac1a32d5cad3c..1b5749f2ef9c0 100644
+--- a/net/core/sysctl_net_core.c
++++ b/net/core/sysctl_net_core.c
+@@ -229,14 +229,17 @@ static int set_default_qdisc(struct ctl_table *table, int write,
+ static int proc_do_dev_weight(struct ctl_table *table, int write,
+                          void __user *buffer, size_t *lenp, loff_t *ppos)
+ {
+-      int ret;
++      static DEFINE_MUTEX(dev_weight_mutex);
++      int ret, weight;
++      mutex_lock(&dev_weight_mutex);
+       ret = proc_dointvec(table, write, buffer, lenp, ppos);
+-      if (ret != 0)
+-              return ret;
+-
+-      dev_rx_weight = weight_p * dev_weight_rx_bias;
+-      dev_tx_weight = weight_p * dev_weight_tx_bias;
++      if (!ret && write) {
++              weight = READ_ONCE(weight_p);
++              WRITE_ONCE(dev_rx_weight, weight * dev_weight_rx_bias);
++              WRITE_ONCE(dev_tx_weight, weight * dev_weight_tx_bias);
++      }
++      mutex_unlock(&dev_weight_mutex);
+       return ret;
+ }
+diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
+index 82752dcbf2a2c..4a76ceeca6fdd 100644
+--- a/net/sched/sch_generic.c
++++ b/net/sched/sch_generic.c
+@@ -251,7 +251,7 @@ static inline int qdisc_restart(struct Qdisc *q, int *packets)
+ void __qdisc_run(struct Qdisc *q)
+ {
+-      int quota = dev_tx_weight;
++      int quota = READ_ONCE(dev_tx_weight);
+       int packets;
+       while (qdisc_restart(q, &packets)) {
+-- 
+2.35.1
+
diff --git a/queue-4.14/net-ipvtap-add-__init-__exit-annotations-to-module-i.patch b/queue-4.14/net-ipvtap-add-__init-__exit-annotations-to-module-i.patch
new file mode 100644 (file)
index 0000000..02a9fb6
--- /dev/null
@@ -0,0 +1,50 @@
+From 283defd394ab2a32d1ab53aedcf0597b603e1f38 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 21 Aug 2022 06:08:08 -0700
+Subject: net: ipvtap - add __init/__exit annotations to module init/exit funcs
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Maciej Żenczykowski <maze@google.com>
+
+[ Upstream commit 4b2e3a17e9f279325712b79fb01d1493f9e3e005 ]
+
+Looks to have been left out in an oversight.
+
+Cc: Mahesh Bandewar <maheshb@google.com>
+Cc: Sainath Grandhi <sainath.grandhi@intel.com>
+Fixes: 235a9d89da97 ('ipvtap: IP-VLAN based tap driver')
+Signed-off-by: Maciej Żenczykowski <maze@google.com>
+Link: https://lore.kernel.org/r/20220821130808.12143-1-zenczykowski@gmail.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ipvlan/ipvtap.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c
+index 0bcc07f346c3e..2e517e30c5ac1 100644
+--- a/drivers/net/ipvlan/ipvtap.c
++++ b/drivers/net/ipvlan/ipvtap.c
+@@ -193,7 +193,7 @@ static struct notifier_block ipvtap_notifier_block __read_mostly = {
+       .notifier_call  = ipvtap_device_event,
+ };
+-static int ipvtap_init(void)
++static int __init ipvtap_init(void)
+ {
+       int err;
+@@ -227,7 +227,7 @@ static int ipvtap_init(void)
+ }
+ module_init(ipvtap_init);
+-static void ipvtap_exit(void)
++static void __exit ipvtap_exit(void)
+ {
+       rtnl_link_unregister(&ipvtap_link_ops);
+       unregister_netdevice_notifier(&ipvtap_notifier_block);
+-- 
+2.35.1
+
diff --git a/queue-4.14/netfilter-ebtables-reject-blobs-that-don-t-provide-a.patch b/queue-4.14/netfilter-ebtables-reject-blobs-that-don-t-provide-a.patch
new file mode 100644 (file)
index 0000000..b74adfa
--- /dev/null
@@ -0,0 +1,165 @@
+From 0e0f7e5ae77f47ea5eb9c4e6d3c8d28f14984388 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 20 Aug 2022 17:38:37 +0200
+Subject: netfilter: ebtables: reject blobs that don't provide all entry points
+
+From: Florian Westphal <fw@strlen.de>
+
+[ Upstream commit 7997eff82828304b780dc0a39707e1946d6f1ebf ]
+
+Harshit Mogalapalli says:
+ In ebt_do_table() function dereferencing 'private->hook_entry[hook]'
+ can lead to NULL pointer dereference. [..] Kernel panic:
+
+general protection fault, probably for non-canonical address 0xdffffc0000000005: 0000 [#1] PREEMPT SMP KASAN
+KASAN: null-ptr-deref in range [0x0000000000000028-0x000000000000002f]
+[..]
+RIP: 0010:ebt_do_table+0x1dc/0x1ce0
+Code: 89 fa 48 c1 ea 03 80 3c 02 00 0f 85 5c 16 00 00 48 b8 00 00 00 00 00 fc ff df 49 8b 6c df 08 48 8d 7d 2c 48 89 fa 48 c1 ea 03 <0f> b6 14 02 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 88
+[..]
+Call Trace:
+ nf_hook_slow+0xb1/0x170
+ __br_forward+0x289/0x730
+ maybe_deliver+0x24b/0x380
+ br_flood+0xc6/0x390
+ br_dev_xmit+0xa2e/0x12c0
+
+For some reason ebtables rejects blobs that provide entry points that are
+not supported by the table, but what it should instead reject is the
+opposite: blobs that DO NOT provide an entry point supported by the table.
+
+t->valid_hooks is the bitmask of hooks (input, forward ...) that will see
+packets.  Providing an entry point that is not support is harmless
+(never called/used), but the inverse isn't: it results in a crash
+because the ebtables traverser doesn't expect a NULL blob for a location
+its receiving packets for.
+
+Instead of fixing all the individual checks, do what iptables is doing and
+reject all blobs that differ from the expected hooks.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Reported-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
+Reported-by: syzkaller <syzkaller@googlegroups.com>
+Signed-off-by: Florian Westphal <fw@strlen.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/netfilter_bridge/ebtables.h | 4 ----
+ net/bridge/netfilter/ebtable_broute.c     | 8 --------
+ net/bridge/netfilter/ebtable_filter.c     | 8 --------
+ net/bridge/netfilter/ebtable_nat.c        | 8 --------
+ net/bridge/netfilter/ebtables.c           | 8 +-------
+ 5 files changed, 1 insertion(+), 35 deletions(-)
+
+diff --git a/include/linux/netfilter_bridge/ebtables.h b/include/linux/netfilter_bridge/ebtables.h
+index 0773b5a032f1f..f014aee2f7184 100644
+--- a/include/linux/netfilter_bridge/ebtables.h
++++ b/include/linux/netfilter_bridge/ebtables.h
+@@ -98,10 +98,6 @@ struct ebt_table {
+       struct ebt_replace_kernel *table;
+       unsigned int valid_hooks;
+       rwlock_t lock;
+-      /* e.g. could be the table explicitly only allows certain
+-       * matches, targets, ... 0 == let it in */
+-      int (*check)(const struct ebt_table_info *info,
+-         unsigned int valid_hooks);
+       /* the data used by the kernel */
+       struct ebt_table_info *private;
+       struct module *me;
+diff --git a/net/bridge/netfilter/ebtable_broute.c b/net/bridge/netfilter/ebtable_broute.c
+index 276b60262981c..b21c8a317be73 100644
+--- a/net/bridge/netfilter/ebtable_broute.c
++++ b/net/bridge/netfilter/ebtable_broute.c
+@@ -33,18 +33,10 @@ static struct ebt_replace_kernel initial_table = {
+       .entries        = (char *)&initial_chain,
+ };
+-static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
+-{
+-      if (valid_hooks & ~(1 << NF_BR_BROUTING))
+-              return -EINVAL;
+-      return 0;
+-}
+-
+ static const struct ebt_table broute_table = {
+       .name           = "broute",
+       .table          = &initial_table,
+       .valid_hooks    = 1 << NF_BR_BROUTING,
+-      .check          = check,
+       .me             = THIS_MODULE,
+ };
+diff --git a/net/bridge/netfilter/ebtable_filter.c b/net/bridge/netfilter/ebtable_filter.c
+index c41da5fac84f4..c59021989af32 100644
+--- a/net/bridge/netfilter/ebtable_filter.c
++++ b/net/bridge/netfilter/ebtable_filter.c
+@@ -41,18 +41,10 @@ static struct ebt_replace_kernel initial_table = {
+       .entries        = (char *)initial_chains,
+ };
+-static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
+-{
+-      if (valid_hooks & ~FILTER_VALID_HOOKS)
+-              return -EINVAL;
+-      return 0;
+-}
+-
+ static const struct ebt_table frame_filter = {
+       .name           = "filter",
+       .table          = &initial_table,
+       .valid_hooks    = FILTER_VALID_HOOKS,
+-      .check          = check,
+       .me             = THIS_MODULE,
+ };
+diff --git a/net/bridge/netfilter/ebtable_nat.c b/net/bridge/netfilter/ebtable_nat.c
+index 08df7406ecb38..1bb12157ce09d 100644
+--- a/net/bridge/netfilter/ebtable_nat.c
++++ b/net/bridge/netfilter/ebtable_nat.c
+@@ -41,18 +41,10 @@ static struct ebt_replace_kernel initial_table = {
+       .entries        = (char *)initial_chains,
+ };
+-static int check(const struct ebt_table_info *info, unsigned int valid_hooks)
+-{
+-      if (valid_hooks & ~NAT_VALID_HOOKS)
+-              return -EINVAL;
+-      return 0;
+-}
+-
+ static const struct ebt_table frame_nat = {
+       .name           = "nat",
+       .table          = &initial_table,
+       .valid_hooks    = NAT_VALID_HOOKS,
+-      .check          = check,
+       .me             = THIS_MODULE,
+ };
+diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
+index a1834ad7422ce..a54149f10f7ef 100644
+--- a/net/bridge/netfilter/ebtables.c
++++ b/net/bridge/netfilter/ebtables.c
+@@ -991,8 +991,7 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
+               goto free_iterate;
+       }
+-      /* the table doesn't like it */
+-      if (t->check && (ret = t->check(newinfo, repl->valid_hooks)))
++      if (repl->valid_hooks != t->valid_hooks)
+               goto free_unlock;
+       if (repl->num_counters && repl->num_counters != t->private->nentries) {
+@@ -1200,11 +1199,6 @@ int ebt_register_table(struct net *net, const struct ebt_table *input_table,
+       if (ret != 0)
+               goto free_chainstack;
+-      if (table->check && table->check(newinfo, table->valid_hooks)) {
+-              ret = -EINVAL;
+-              goto free_chainstack;
+-      }
+-
+       table->private = newinfo;
+       rwlock_init(&table->lock);
+       mutex_lock(&ebt_mutex);
+-- 
+2.35.1
+
diff --git a/queue-4.14/netfilter-nft_payload-do-not-truncate-csum_offset-an.patch b/queue-4.14/netfilter-nft_payload-do-not-truncate-csum_offset-an.patch
new file mode 100644 (file)
index 0000000..1ae20f2
--- /dev/null
@@ -0,0 +1,72 @@
+From 9b61174ff4ed72a2598f2211f98fd06169e00765 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 21 Aug 2022 11:55:19 +0200
+Subject: netfilter: nft_payload: do not truncate csum_offset and csum_type
+
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+
+[ Upstream commit 7044ab281febae9e2fa9b0b247693d6026166293 ]
+
+Instead report ERANGE if csum_offset is too long, and EOPNOTSUPP if type
+is not support.
+
+Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nft_payload.c | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
+index 04b9df9e39554..5732b32ab9320 100644
+--- a/net/netfilter/nft_payload.c
++++ b/net/netfilter/nft_payload.c
+@@ -332,6 +332,8 @@ static int nft_payload_set_init(const struct nft_ctx *ctx,
+                               const struct nlattr * const tb[])
+ {
+       struct nft_payload_set *priv = nft_expr_priv(expr);
++      u32 csum_offset, csum_type = NFT_PAYLOAD_CSUM_NONE;
++      int err;
+       priv->base        = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_BASE]));
+       priv->offset      = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_OFFSET]));
+@@ -339,11 +341,15 @@ static int nft_payload_set_init(const struct nft_ctx *ctx,
+       priv->sreg        = nft_parse_register(tb[NFTA_PAYLOAD_SREG]);
+       if (tb[NFTA_PAYLOAD_CSUM_TYPE])
+-              priv->csum_type =
+-                      ntohl(nla_get_be32(tb[NFTA_PAYLOAD_CSUM_TYPE]));
+-      if (tb[NFTA_PAYLOAD_CSUM_OFFSET])
+-              priv->csum_offset =
+-                      ntohl(nla_get_be32(tb[NFTA_PAYLOAD_CSUM_OFFSET]));
++              csum_type = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_CSUM_TYPE]));
++      if (tb[NFTA_PAYLOAD_CSUM_OFFSET]) {
++              err = nft_parse_u32_check(tb[NFTA_PAYLOAD_CSUM_OFFSET], U8_MAX,
++                                        &csum_offset);
++              if (err < 0)
++                      return err;
++
++              priv->csum_offset = csum_offset;
++      }
+       if (tb[NFTA_PAYLOAD_CSUM_FLAGS]) {
+               u32 flags;
+@@ -354,13 +360,14 @@ static int nft_payload_set_init(const struct nft_ctx *ctx,
+               priv->csum_flags = flags;
+       }
+-      switch (priv->csum_type) {
++      switch (csum_type) {
+       case NFT_PAYLOAD_CSUM_NONE:
+       case NFT_PAYLOAD_CSUM_INET:
+               break;
+       default:
+               return -EOPNOTSUPP;
+       }
++      priv->csum_type = csum_type;
+       return nft_validate_register_load(priv->sreg, priv->len);
+ }
+-- 
+2.35.1
+
diff --git a/queue-4.14/netfilter-nft_payload-report-erange-for-too-long-off.patch b/queue-4.14/netfilter-nft_payload-report-erange-for-too-long-off.patch
new file mode 100644 (file)
index 0000000..2305563
--- /dev/null
@@ -0,0 +1,49 @@
+From 6619ea1ef2e84b84d5da2d70b4ff159c286e820f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 21 Aug 2022 11:47:04 +0200
+Subject: netfilter: nft_payload: report ERANGE for too long offset and length
+
+From: Pablo Neira Ayuso <pablo@netfilter.org>
+
+[ Upstream commit 94254f990c07e9ddf1634e0b727fab821c3b5bf9 ]
+
+Instead of offset and length are truncation to u8, report ERANGE.
+
+Fixes: 96518518cc41 ("netfilter: add nftables")
+Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/netfilter/nft_payload.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
+index fd87216bc0a99..04b9df9e39554 100644
+--- a/net/netfilter/nft_payload.c
++++ b/net/netfilter/nft_payload.c
+@@ -398,6 +398,7 @@ nft_payload_select_ops(const struct nft_ctx *ctx,
+ {
+       enum nft_payload_bases base;
+       unsigned int offset, len;
++      int err;
+       if (tb[NFTA_PAYLOAD_BASE] == NULL ||
+           tb[NFTA_PAYLOAD_OFFSET] == NULL ||
+@@ -423,8 +424,13 @@ nft_payload_select_ops(const struct nft_ctx *ctx,
+       if (tb[NFTA_PAYLOAD_DREG] == NULL)
+               return ERR_PTR(-EINVAL);
+-      offset = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_OFFSET]));
+-      len    = ntohl(nla_get_be32(tb[NFTA_PAYLOAD_LEN]));
++      err = nft_parse_u32_check(tb[NFTA_PAYLOAD_OFFSET], U8_MAX, &offset);
++      if (err < 0)
++              return ERR_PTR(err);
++
++      err = nft_parse_u32_check(tb[NFTA_PAYLOAD_LEN], U8_MAX, &len);
++      if (err < 0)
++              return ERR_PTR(err);
+       if (len <= 4 && is_power_of_2(len) && IS_ALIGNED(offset, len) &&
+           base != NFT_PAYLOAD_LL_HEADER)
+-- 
+2.35.1
+
diff --git a/queue-4.14/ratelimit-fix-data-races-in-___ratelimit.patch b/queue-4.14/ratelimit-fix-data-races-in-___ratelimit.patch
new file mode 100644 (file)
index 0000000..afe989d
--- /dev/null
@@ -0,0 +1,64 @@
+From 45de03ef4f5d6302244bc0193105732e26e8fdff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Aug 2022 10:46:48 -0700
+Subject: ratelimit: Fix data-races in ___ratelimit().
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 6bae8ceb90ba76cdba39496db936164fa672b9be ]
+
+While reading rs->interval and rs->burst, they can be changed
+concurrently via sysctl (e.g. net_ratelimit_state).  Thus, we
+need to add READ_ONCE() to their readers.
+
+Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/ratelimit.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/lib/ratelimit.c b/lib/ratelimit.c
+index d01f471352390..b805702de84dd 100644
+--- a/lib/ratelimit.c
++++ b/lib/ratelimit.c
+@@ -27,10 +27,16 @@
+  */
+ int ___ratelimit(struct ratelimit_state *rs, const char *func)
+ {
++      /* Paired with WRITE_ONCE() in .proc_handler().
++       * Changing two values seperately could be inconsistent
++       * and some message could be lost.  (See: net_ratelimit_state).
++       */
++      int interval = READ_ONCE(rs->interval);
++      int burst = READ_ONCE(rs->burst);
+       unsigned long flags;
+       int ret;
+-      if (!rs->interval)
++      if (!interval)
+               return 1;
+       /*
+@@ -45,7 +51,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
+       if (!rs->begin)
+               rs->begin = jiffies;
+-      if (time_is_before_jiffies(rs->begin + rs->interval)) {
++      if (time_is_before_jiffies(rs->begin + interval)) {
+               if (rs->missed) {
+                       if (!(rs->flags & RATELIMIT_MSG_ON_RELEASE)) {
+                               printk_deferred(KERN_WARNING
+@@ -57,7 +63,7 @@ int ___ratelimit(struct ratelimit_state *rs, const char *func)
+               rs->begin   = jiffies;
+               rs->printed = 0;
+       }
+-      if (rs->burst && rs->burst > rs->printed) {
++      if (burst && burst > rs->printed) {
+               rs->printed++;
+               ret = 1;
+       } else {
+-- 
+2.35.1
+
diff --git a/queue-4.14/rose-check-null-rose_loopback_neigh-loopback.patch b/queue-4.14/rose-check-null-rose_loopback_neigh-loopback.patch
new file mode 100644 (file)
index 0000000..41a74c4
--- /dev/null
@@ -0,0 +1,69 @@
+From 89da49e9b17c5caaf295eae652645f1bf0967f89 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 18 Aug 2022 02:02:13 +0200
+Subject: rose: check NULL rose_loopback_neigh->loopback
+
+From: Bernard Pidoux <f6bvp@free.fr>
+
+[ Upstream commit 3c53cd65dece47dd1f9d3a809f32e59d1d87b2b8 ]
+
+Commit 3b3fd068c56e3fbea30090859216a368398e39bf added NULL check for
+`rose_loopback_neigh->dev` in rose_loopback_timer() but omitted to
+check rose_loopback_neigh->loopback.
+
+It thus prevents *all* rose connect.
+
+The reason is that a special rose_neigh loopback has a NULL device.
+
+/proc/net/rose_neigh illustrates it via rose_neigh_show() function :
+[...]
+seq_printf(seq, "%05d %-9s %-4s   %3d %3d  %3s     %3s %3lu %3lu",
+          rose_neigh->number,
+          (rose_neigh->loopback) ? "RSLOOP-0" : ax2asc(buf, &rose_neigh->callsign),
+          rose_neigh->dev ? rose_neigh->dev->name : "???",
+          rose_neigh->count,
+
+/proc/net/rose_neigh displays special rose_loopback_neigh->loopback as
+callsign RSLOOP-0:
+
+addr  callsign  dev  count use mode restart  t0  tf digipeaters
+00001 RSLOOP-0  ???      1   2  DCE     yes   0   0
+
+By checking rose_loopback_neigh->loopback, rose_rx_call_request() is called
+even in case rose_loopback_neigh->dev is NULL. This repairs rose connections.
+
+Verification with rose client application FPAC:
+
+FPAC-Node v 4.1.3 (built Aug  5 2022) for LINUX (help = h)
+F6BVP-4 (Commands = ?) : u
+Users - AX.25 Level 2 sessions :
+Port   Callsign     Callsign  AX.25 state  ROSE state  NetRom status
+axudp  F6BVP-5   -> F6BVP-9   Connected    Connected   ---------
+
+Fixes: 3b3fd068c56e ("rose: Fix Null pointer dereference in rose_send_frame()")
+Signed-off-by: Bernard Pidoux <f6bvp@free.fr>
+Suggested-by: Francois Romieu <romieu@fr.zoreil.com>
+Cc: Thomas DL9SAU Osterried <thomas@osterried.de>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/rose/rose_loopback.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/net/rose/rose_loopback.c b/net/rose/rose_loopback.c
+index c318e5c9f6df3..56eea298b8ef7 100644
+--- a/net/rose/rose_loopback.c
++++ b/net/rose/rose_loopback.c
+@@ -99,7 +99,8 @@ static void rose_loopback_timer(struct timer_list *unused)
+               }
+               if (frametype == ROSE_CALL_REQUEST) {
+-                      if (!rose_loopback_neigh->dev) {
++                      if (!rose_loopback_neigh->dev &&
++                          !rose_loopback_neigh->loopback) {
+                               kfree_skb(skb);
+                               continue;
+                       }
+-- 
+2.35.1
+
index b6243f9eb98ad662355efdc71c6af31b05036ee4..fa5ddc2c6f1554b5ca975d37174eb02dfbe1afc1 100644 (file)
@@ -1,3 +1,20 @@
 audit-fix-potential-double-free-on-error-path-from-fsnotify_add_inode_mark.patch
 parisc-fix-exception-handler-for-fldw-and-fstw-instructions.patch
 pinctrl-amd-don-t-save-restore-interrupt-status-and-wake-status-bits.patch
+xfrm-fix-refcount-leak-in-__xfrm_policy_check.patch
+af_key-do-not-call-xfrm_probe_algs-in-parallel.patch
+rose-check-null-rose_loopback_neigh-loopback.patch
+bonding-802.3ad-fix-no-transmission-of-lacpdus.patch
+net-ipvtap-add-__init-__exit-annotations-to-module-i.patch
+netfilter-ebtables-reject-blobs-that-don-t-provide-a.patch
+netfilter-nft_payload-report-erange-for-too-long-off.patch
+netfilter-nft_payload-do-not-truncate-csum_offset-an.patch
+net-fix-data-races-around-weight_p-and-dev_weight_-r.patch
+ratelimit-fix-data-races-in-___ratelimit.patch
+net-fix-a-data-race-around-sysctl_tstamp_allow_data.patch
+net-fix-a-data-race-around-sysctl_net_busy_poll.patch
+net-fix-a-data-race-around-sysctl_net_busy_read.patch
+net-fix-a-data-race-around-netdev_budget.patch
+net-fix-a-data-race-around-netdev_budget_usecs.patch
+net-fix-a-data-race-around-sysctl_somaxconn.patch
+ixgbe-stop-resetting-systime-in-ixgbe_ptp_start_cycl.patch
diff --git a/queue-4.14/xfrm-fix-refcount-leak-in-__xfrm_policy_check.patch b/queue-4.14/xfrm-fix-refcount-leak-in-__xfrm_policy_check.patch
new file mode 100644 (file)
index 0000000..d19a717
--- /dev/null
@@ -0,0 +1,41 @@
+From 4242b983544a6b70c2e45072f025a8294e77fb96 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 24 Jul 2022 17:55:58 +0800
+Subject: xfrm: fix refcount leak in __xfrm_policy_check()
+
+From: Xin Xiong <xiongx18@fudan.edu.cn>
+
+[ Upstream commit 9c9cb23e00ddf45679b21b4dacc11d1ae7961ebe ]
+
+The issue happens on an error path in __xfrm_policy_check(). When the
+fetching process of the object `pols[1]` fails, the function simply
+returns 0, forgetting to decrement the reference count of `pols[0]`,
+which is incremented earlier by either xfrm_sk_policy_lookup() or
+xfrm_policy_lookup(). This may result in memory leaks.
+
+Fix it by decreasing the reference count of `pols[0]` in that path.
+
+Fixes: 134b0fc544ba ("IPsec: propagate security module errors up from flow_cache_lookup")
+Signed-off-by: Xin Xiong <xiongx18@fudan.edu.cn>
+Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
+Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/xfrm/xfrm_policy.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
+index e1840f70c0ff0..66c23a1b8758f 100644
+--- a/net/xfrm/xfrm_policy.c
++++ b/net/xfrm/xfrm_policy.c
+@@ -2332,6 +2332,7 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
+               if (pols[1]) {
+                       if (IS_ERR(pols[1])) {
+                               XFRM_INC_STATS(net, LINUX_MIB_XFRMINPOLERROR);
++                              xfrm_pol_put(pols[0]);
+                               return 0;
+                       }
+                       pols[1]->curlft.use_time = get_seconds();
+-- 
+2.35.1
+