Backports Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 00/18] backports: Update for kernel 5.2
@ 2019-07-01 21:48 Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 01/18] patches: update select queue patches Hauke Mehrtens
                   ` (18 more replies)
  0 siblings, 19 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:48 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

This contains multiple fixes needed for kernel 5.2

This was generated based on kernel 5.2-rc7 and compile tested against
these kernel versions:

1   3.12.74             [  OK  ]
2   3.13.11             [  LINK  ]
3   3.14.79             [  LINK  ]
4   3.16.68             [  OK  ]
5   3.18.140            [  OK  ]
6   4.0.9               [  LINK  ]
7   4.1.52              [  OK  ]
8   4.2.8               [  LINK  ]
9   4.3.6               [  LINK  ]
10  4.4.182             [  OK  ]
11  4.5.7               [  OK  ]
12  4.6.7               [  OK  ]
13  4.7.10              [  OK  ]
14  4.8.17              [  OK  ]
15  4.9.182             [  OK  ]
16  4.10.17             [  OK  ]
17  4.11.12             [  OK  ]
18  4.12.14             [  OK  ]
19  4.13.16             [  OK  ]
20  4.14.127            [  OK  ]
21  4.15.18             [  OK  ]
22  4.16.18             [  OK  ]
23  4.17.19             [  OK  ]
24  4.18.20             [  OK  ]
25  4.19.52             [  OK  ]
26  4.20.17             [  OK  ]
27  5.0.21              [  OK  ]
28  5.1.11              [  OK  ]

I did some runtime testes in OpenWrt with kernel 4.9, 4.14 and 4.19 with 
ath9k and ath10k.


Arend van Spriel (3):
  patches: update select queue patches
  backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu
  backport-include: add empty lockdep_map structure in lockdep.h

Hauke Mehrtens (13):
  patches: Make patches apply on top of kernel 5.2-rc6
  header: Add backport-include/net/ipv6_stubs.h
  header: Add sdio_retune*() functions
  header: Add HRTIMER_MODE_{ABS,REL}_SOFT
  patch: Remove usage of DMI_PRODUCT_SKU
  header: Make napi_complete_done() return bool
  header: add hrtimer_forward() and ns_to_ktime()
  dependencies: Add MT7615E dependency
  patches: rtw88: Add missing include on kernel 3.18
  header: Remove include/net/inet_frag.h
  defconfig: update wifi defconfig
  header: fix of_get_mac_address()
  header: add support for GCC7 and GCC8

Johannes Berg (1):
  backport: Extend netlink parsing with strict validation

Luca Coelho (1):
  backport: check for failure when allocating ops in genetlink

 .../backport-include/linux/compiler-gcc8.h    |   1 +
 .../backport-include/linux/compiler-gcc9.h    |   1 +
 backport/backport-include/linux/hrtimer.h     |  13 +
 backport/backport-include/linux/interrupt.h   |  19 +
 backport/backport-include/linux/lockdep.h     |   6 +
 .../backport-include/linux/mmc/sdio_func.h    |  76 ++++
 backport/backport-include/linux/netdevice.h   |  16 +-
 backport/backport-include/linux/of_net.h      |  16 +
 backport/backport-include/linux/rcupdate.h    |  18 +
 backport/backport-include/net/genetlink.h     |  62 +++-
 backport/backport-include/net/inet_frag.h     |  76 ----
 backport/backport-include/net/ipv6_stubs.h    |  13 +
 backport/backport-include/net/netlink.h       | 341 +++++++++++++-----
 backport/compat/Kconfig                       |   7 +-
 backport/compat/Makefile                      |   4 +-
 .../{backport-4.20.c => backport-5.2.c}       | 216 ++++++++---
 backport/compat/backport-genetlink.c          |  30 +-
 backport/compat/compat-3.9.c                  |  12 -
 backport/defconfigs/wifi                      |   6 +-
 copy-list                                     |   1 -
 dependencies                                  |   1 +
 ...2-disable-dump-adjust-on-old-kernels.patch |   4 +-
 .../include_net_cfg80211.patch                |   2 +-
 .../net_wireless_core.patch                   |   2 +-
 patches/0004-disable-wext-kconfig.patch       |   5 +-
 .../net_wireless_core.patch                   |   4 +-
 .../drivers_net_wireless_cw1200_sdio.patch    |   2 +-
 .../0013-fix-makefile-includes/rtw88.patch    |  40 ++
 .../net_wireless_nl80211.patch                |   2 +-
 ...drivers_net_wireless_ipw2x00_ipw2100.patch |   2 +-
 ...drivers_net_wireless_libertas_if_usb.patch |   4 +-
 patches/0022-define-tracing/mt7601u.patch     |   2 +-
 patches/0024-led-blink-api/mac80211.patch     |   4 +-
 patches/0025-usb-sg/usbnet.patch              |  12 +-
 patches/0026-ipv6_stub/cdc_mbim.patch         |   6 +-
 patches/0028-select_queue/mac80211.patch      |  24 +-
 patches/0028-select_queue/mwifiex.patch       |  12 +-
 patches/0028-select_queue/rtl8188eu.patch     |  11 +-
 patches/0028-select_queue/rtl8723bs.patch     |  11 +-
 patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch   |   6 +-
 patches/0053-possible_net_t.patch             |   2 +-
 patches/0060-trace_field_struct/mt7601u.patch |   4 +-
 patches/0069-iwlwifi-pd-string-fix.patch      |  28 +-
 patches/0070-mac80211-fils.patch              |   8 +-
 patches/0071-skb-head_frag/wireless.patch     |   2 +-
 patches/0075-ndo-stats-64/usbnet.patch        |   2 +-
 patches/0077-genl-ro-after-init/hwsim.patch   |   2 +-
 patches/0077-genl-ro-after-init/nl80211.patch |   2 +-
 patches/0083-timer_list.patch                 |   2 +-
 patches/0085-iwlwifi-pci-device-removal.patch |   4 +-
 patches/0089-unknown-dmi/brcmfmac.patch       |  22 ++
 patches/devcoredump.patch                     |   4 +-
 patches/verify.patch                          |  10 +-
 53 files changed, 834 insertions(+), 348 deletions(-)
 create mode 100644 backport/backport-include/linux/compiler-gcc8.h
 create mode 100644 backport/backport-include/linux/compiler-gcc9.h
 create mode 100644 backport/backport-include/linux/hrtimer.h
 delete mode 100644 backport/backport-include/net/inet_frag.h
 create mode 100644 backport/backport-include/net/ipv6_stubs.h
 rename backport/compat/{backport-4.20.c => backport-5.2.c} (58%)
 create mode 100644 patches/0013-fix-makefile-includes/rtw88.patch
 create mode 100644 patches/0089-unknown-dmi/brcmfmac.patch

-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/18] patches: update select queue patches
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
@ 2019-07-01 21:48 ` Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 02/18] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu Hauke Mehrtens
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:48 UTC (permalink / raw)
  To: backports; +Cc: Arend van Spriel, Hauke Mehrtens

From: Arend van Spriel <arend.vanspriel@broadcom.com>

The select queue parameters changed so the patches need to be updated
as well.

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
[Fix compile on kernel > 4.19]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/0028-select_queue/mac80211.patch  | 24 +++++++++++++++--------
 patches/0028-select_queue/mwifiex.patch   | 12 ++++++++----
 patches/0028-select_queue/rtl8188eu.patch | 11 +++++++----
 patches/0028-select_queue/rtl8723bs.patch | 11 +++++++----
 4 files changed, 38 insertions(+), 20 deletions(-)

diff --git a/patches/0028-select_queue/mac80211.patch b/patches/0028-select_queue/mac80211.patch
index bca6793a..f488589d 100644
--- a/patches/0028-select_queue/mac80211.patch
+++ b/patches/0028-select_queue/mac80211.patch
@@ -1,14 +1,18 @@
 --- a/net/mac80211/iface.c
 +++ b/net/mac80211/iface.c
-@@ -1131,10 +1131,25 @@ static void ieee80211_uninit(struct net_
+@@ -1128,9 +1128,29 @@ static void ieee80211_uninit(struct net_
  	ieee80211_teardown_sdata(IEEE80211_DEV_TO_SUB_IF(dev));
  }
  
-+#if LINUX_VERSION_IS_GEQ(4,19,0)
++#if LINUX_VERSION_IS_GEQ(5,2,0)
  static u16 ieee80211_netdev_select_queue(struct net_device *dev,
  					 struct sk_buff *skb,
- 					 struct net_device *sb_dev,
- 					 select_queue_fallback_t fallback)
+ 					 struct net_device *sb_dev)
++#elif LINUX_VERSION_IS_GEQ(4,19,0)
++static u16 ieee80211_netdev_select_queue(struct net_device *dev,
++					 struct sk_buff *skb,
++					 struct net_device *sb_dev,
++					 select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
 +    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
 +static u16 ieee80211_netdev_select_queue(struct net_device *dev,
@@ -26,15 +30,19 @@
  {
  	return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
  }
-@@ -1177,10 +1192,25 @@ static const struct net_device_ops ieee8
+@@ -1173,9 +1193,29 @@ static const struct net_device_ops ieee8
  	.ndo_get_stats64	= ieee80211_get_stats64,
  };
  
-+#if LINUX_VERSION_IS_GEQ(4,19,0)
++#if LINUX_VERSION_IS_GEQ(5,2,0)
  static u16 ieee80211_monitor_select_queue(struct net_device *dev,
  					  struct sk_buff *skb,
- 					  struct net_device *sb_dev,
- 					  select_queue_fallback_t fallback)
+ 					  struct net_device *sb_dev)
++#elif LINUX_VERSION_IS_GEQ(4,19,0)
++static u16 ieee80211_monitor_select_queue(struct net_device *dev,
++					  struct sk_buff *skb,
++					  struct net_device *sb_dev,
++					  select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
 +    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
 +static u16 ieee80211_monitor_select_queue(struct net_device *dev,
diff --git a/patches/0028-select_queue/mwifiex.patch b/patches/0028-select_queue/mwifiex.patch
index 87159fa9..8770aaf7 100644
--- a/patches/0028-select_queue/mwifiex.patch
+++ b/patches/0028-select_queue/mwifiex.patch
@@ -1,14 +1,18 @@
 --- a/drivers/net/wireless/marvell/mwifiex/main.c
 +++ b/drivers/net/wireless/marvell/mwifiex/main.c
-@@ -1280,10 +1280,24 @@ static struct net_device_stats *mwifiex_
+@@ -1280,9 +1280,28 @@ static struct net_device_stats *mwifiex_
  	return &priv->stats;
  }
  
-+#if LINUX_VERSION_IS_GEQ(4,19,0)
++#if LINUX_VERSION_IS_GEQ(5,2,0)
  static u16
  mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb,
- 				struct net_device *sb_dev,
- 				select_queue_fallback_t fallback)
+ 				struct net_device *sb_dev)
++#elif LINUX_VERSION_IS_GEQ(4,19,0)
++static u16
++mwifiex_netdev_select_wmm_queue(struct net_device *dev, struct sk_buff *skb,
++				struct net_device *sb_dev,
++				select_queue_fallback_t fallback)
 +#elif LINUX_VERSION_IS_GEQ(3,14,0) || \
 +    (LINUX_VERSION_CODE == KERNEL_VERSION(3,13,11) && UTS_UBUNTU_RELEASE_ABI > 30)
 +static u16
diff --git a/patches/0028-select_queue/rtl8188eu.patch b/patches/0028-select_queue/rtl8188eu.patch
index 90ddb853..c0cec864 100644
--- a/patches/0028-select_queue/rtl8188eu.patch
+++ b/patches/0028-select_queue/rtl8188eu.patch
@@ -1,13 +1,16 @@
 --- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
 +++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
-@@ -244,9 +244,15 @@ static unsigned int rtw_classify8021d(st
+@@ -244,8 +244,18 @@ static unsigned int rtw_classify8021d(st
  	return dscp >> 5;
  }
  
-+#if LINUX_VERSION_IS_GEQ(4,19,0)
++#if LINUX_VERSION_IS_GEQ(5,2,0)
  static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
- 			    struct net_device *sb_dev,
- 			    select_queue_fallback_t fallback)
+ 			    struct net_device *sb_dev)
++#elif LINUX_VERSION_IS_GEQ(4,19,0)
++static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
++			    struct net_device *sb_dev,
++			    select_queue_fallback_t fallback)
 +#else
 +static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
 +			    void *accel_priv,
diff --git a/patches/0028-select_queue/rtl8723bs.patch b/patches/0028-select_queue/rtl8723bs.patch
index 7dbf7f60..345f560c 100644
--- a/patches/0028-select_queue/rtl8723bs.patch
+++ b/patches/0028-select_queue/rtl8723bs.patch
@@ -1,13 +1,16 @@
 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c
 +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c
-@@ -403,9 +403,15 @@ static unsigned int rtw_classify8021d(st
+@@ -400,8 +400,18 @@ static unsigned int rtw_classify8021d(st
  }
  
  
-+#if LINUX_VERSION_IS_GEQ(4,19,0)
++#if LINUX_VERSION_IS_GEQ(5,2,0)
  static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
- 			    struct net_device *sb_dev,
- 			    select_queue_fallback_t fallback)
+ 			    struct net_device *sb_dev)
++#elif LINUX_VERSION_IS_GEQ(4,19,0)
++static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
++			    struct net_device *sb_dev,
++			    select_queue_fallback_t fallback)
 +#else
 +static u16 rtw_select_queue(struct net_device *dev, struct sk_buff *skb,
 +			    void *accel_priv,
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 02/18] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 01/18] patches: update select queue patches Hauke Mehrtens
@ 2019-07-01 21:48 ` Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 03/18] backport: check for failure when allocating ops in genetlink Hauke Mehrtens
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:48 UTC (permalink / raw)
  To: backports; +Cc: Arend van Spriel, Hauke Mehrtens

From: Arend van Spriel <arend.vanspriel@broadcom.com>

Include static inline functions that were added by commit
74de6960c99d ("rcu: Provide functions for determining if call_rcu()
has been invoked").

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
[Activate on < 4.20 only]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/rcupdate.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/backport/backport-include/linux/rcupdate.h b/backport/backport-include/linux/rcupdate.h
index b96ef496..cec4b3e8 100644
--- a/backport/backport-include/linux/rcupdate.h
+++ b/backport/backport-include/linux/rcupdate.h
@@ -41,4 +41,22 @@
 #define rcu_dereference_raw(p)	rcu_dereference(p)
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,20,0)
+typedef void (*rcu_callback_t)(struct rcu_head *head);
+
+static inline void rcu_head_init(struct rcu_head *rhp)
+{
+        rhp->func = (rcu_callback_t)~0L;
+}
+
+static inline bool
+rcu_head_after_call_rcu(struct rcu_head *rhp, rcu_callback_t f)
+{
+        if (READ_ONCE(rhp->func) == f)
+                return true;
+        WARN_ON_ONCE(READ_ONCE(rhp->func) != (rcu_callback_t)~0L);
+        return false;
+}
+#endif /* < 4.20 */
+
 #endif /* __BACKPORT_LINUX_RCUPDATE_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 03/18] backport: check for failure when allocating ops in genetlink
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 01/18] patches: update select queue patches Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 02/18] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu Hauke Mehrtens
@ 2019-07-01 21:48 ` Hauke Mehrtens
  2019-07-01 21:48 ` [PATCH 04/18] backport-include: add empty lockdep_map structure in lockdep.h Hauke Mehrtens
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:48 UTC (permalink / raw)
  To: backports; +Cc: Luca Coelho

From: Luca Coelho <luciano.coelho@intel.com>

We were not checking if the allocation failed in
backport_genl_register_family(), which could lead to NULL pointer
dereferences later.  Fix that.

Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 backport/compat/backport-genetlink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backport/compat/backport-genetlink.c b/backport/compat/backport-genetlink.c
index 885f1756..16971ec3 100644
--- a/backport/compat/backport-genetlink.c
+++ b/backport/compat/backport-genetlink.c
@@ -220,7 +220,11 @@ int backport_genl_register_family(struct genl_family *family)
 
 	/* we append one entry to the ops to find our family pointer ... */
 	ops = kzalloc(sizeof(*ops) * (family->n_ops + 1), GFP_KERNEL);
+	if (!ops)
+		return -ENOMEM;
+
 	memcpy(ops, family->ops, sizeof(*ops) * family->n_ops);
+
 	/*
 	 * Remove policy to skip validation as the struct nla_policy
 	 * memory layout isn't compatible with the old version
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 04/18] backport-include: add empty lockdep_map structure in lockdep.h
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2019-07-01 21:48 ` [PATCH 03/18] backport: check for failure when allocating ops in genetlink Hauke Mehrtens
@ 2019-07-01 21:48 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 05/18] patches: Make patches apply on top of kernel 5.2-rc6 Hauke Mehrtens
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:48 UTC (permalink / raw)
  To: backports; +Cc: Arend van Spriel

From: Arend van Spriel <arend.vanspriel@broadcom.com>

include/linux/rhashtable.h now uses struct lockdep_map unconditionally
which is fine for upstream as lockdep.h defines an empty lockdep_map
structure if CONFIG_LOCKDEP is not set. However, that is only true
since kernel 4.15 so adding such definition in our lockdep.h to cover
older kernels.

Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
---
 backport/backport-include/linux/lockdep.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/backport/backport-include/linux/lockdep.h b/backport/backport-include/linux/lockdep.h
index 5a5d0d0e..12b91b4f 100644
--- a/backport/backport-include/linux/lockdep.h
+++ b/backport/backport-include/linux/lockdep.h
@@ -14,4 +14,10 @@
 #endif /* CONFIG_LOCKDEP */
 #endif /* LINUX_VERSION_IS_LESS(3,9,0) */
 
+#if LINUX_VERSION_IS_LESS(4,15,0)
+#ifndef CONFIG_LOCKDEP
+struct lockdep_map { };
+#endif /* CONFIG_LOCKDEP */
+#endif /* LINUX_VERSION_IS_LESS(4,15,0) */
+
 #endif /* __BACKPORT_LINUX_LOCKDEP_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 05/18] patches: Make patches apply on top of kernel 5.2-rc6
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (3 preceding siblings ...)
  2019-07-01 21:48 ` [PATCH 04/18] backport-include: add empty lockdep_map structure in lockdep.h Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 06/18] backport: Extend netlink parsing with strict validation Hauke Mehrtens
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

The cordic.c file was moved and the driver from drivers/staging/rtlwifi/
was removed in mainline kernel.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/compat/Kconfig                       |  2 +-
 copy-list                                     |  1 -
 ...2-disable-dump-adjust-on-old-kernels.patch |  4 +--
 .../include_net_cfg80211.patch                |  2 +-
 .../net_wireless_core.patch                   |  2 +-
 patches/0004-disable-wext-kconfig.patch       |  5 ++--
 .../net_wireless_core.patch                   |  4 +--
 .../drivers_net_wireless_cw1200_sdio.patch    |  2 +-
 .../net_wireless_nl80211.patch                |  2 +-
 ...drivers_net_wireless_ipw2x00_ipw2100.patch |  2 +-
 ...drivers_net_wireless_libertas_if_usb.patch |  4 +--
 patches/0022-define-tracing/mt7601u.patch     |  2 +-
 patches/0024-led-blink-api/mac80211.patch     |  4 +--
 patches/0025-usb-sg/usbnet.patch              | 12 ++++----
 patches/0026-ipv6_stub/cdc_mbim.patch         |  6 ++--
 patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch   |  6 ++--
 patches/0053-possible_net_t.patch             |  2 +-
 patches/0060-trace_field_struct/mt7601u.patch |  4 +--
 patches/0069-iwlwifi-pd-string-fix.patch      | 28 ++++++-------------
 patches/0070-mac80211-fils.patch              |  8 +++---
 patches/0071-skb-head_frag/wireless.patch     |  2 +-
 patches/0075-ndo-stats-64/usbnet.patch        |  2 +-
 patches/0077-genl-ro-after-init/hwsim.patch   |  2 +-
 patches/0077-genl-ro-after-init/nl80211.patch |  2 +-
 patches/0083-timer_list.patch                 |  2 +-
 patches/0085-iwlwifi-pci-device-removal.patch |  4 +--
 patches/devcoredump.patch                     |  4 +--
 patches/verify.patch                          | 10 +++----
 28 files changed, 59 insertions(+), 71 deletions(-)

diff --git a/backport/compat/Kconfig b/backport/compat/Kconfig
index bb5d864c..20f34f1a 100644
--- a/backport/compat/Kconfig
+++ b/backport/compat/Kconfig
@@ -69,7 +69,7 @@ config BPAUTO_BUILD_CORDIC
 	default m if BPAUTO_CORDIC
 	default m if BPAUTO_USERSEL_BUILD_ALL
 	#module-name cordic
-	#c-file lib/cordic.c
+	#c-file lib/math/cordic.c
 
 config BPAUTO_CORDIC
 	bool
diff --git a/copy-list b/copy-list
index 1ad03985..328e92d0 100644
--- a/copy-list
+++ b/copy-list
@@ -121,7 +121,6 @@ drivers/net/usb/usbnet.c
 
 drivers/staging/Makefile
 drivers/staging/Kconfig
-drivers/staging/rtlwifi/
 drivers/staging/rtl8188eu/
 drivers/staging/rtl8723bs/
 
diff --git a/patches/0002-disable-dump-adjust-on-old-kernels.patch b/patches/0002-disable-dump-adjust-on-old-kernels.patch
index bf48eade..c4515077 100644
--- a/patches/0002-disable-dump-adjust-on-old-kernels.patch
+++ b/patches/0002-disable-dump-adjust-on-old-kernels.patch
@@ -28,7 +28,7 @@ Date:   Fri Mar 1 14:03:49 2013 +0100
 
 --- a/net/wireless/nl80211.c
 +++ b/net/wireless/nl80211.c
-@@ -2357,6 +2357,7 @@ static int nl80211_dump_wiphy(struct sk_
+@@ -2434,6 +2434,7 @@ static int nl80211_dump_wiphy(struct sk_
  						 cb->nlh->nlmsg_seq,
  						 NLM_F_MULTI, state);
  			if (ret < 0) {
@@ -36,7 +36,7 @@ Date:   Fri Mar 1 14:03:49 2013 +0100
  				/*
  				 * If sending the wiphy data didn't fit (ENOBUFS
  				 * or EMSGSIZE returned), this SKB is still
-@@ -2378,6 +2379,7 @@ static int nl80211_dump_wiphy(struct sk_
+@@ -2455,6 +2456,7 @@ static int nl80211_dump_wiphy(struct sk_
  					rtnl_unlock();
  					return 1;
  				}
diff --git a/patches/0003-cfg80211-wext-padding/include_net_cfg80211.patch b/patches/0003-cfg80211-wext-padding/include_net_cfg80211.patch
index 338bedb1..74366dad 100644
--- a/patches/0003-cfg80211-wext-padding/include_net_cfg80211.patch
+++ b/patches/0003-cfg80211-wext-padding/include_net_cfg80211.patch
@@ -1,6 +1,6 @@
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
-@@ -4334,6 +4334,9 @@ struct cfg80211_pmsr_capabilities {
+@@ -4404,6 +4404,9 @@ struct cfg80211_pmsr_capabilities {
  struct wiphy {
  	/* assign these fields before you register the wiphy */
  
diff --git a/patches/0003-cfg80211-wext-padding/net_wireless_core.patch b/patches/0003-cfg80211-wext-padding/net_wireless_core.patch
index e1eca55d..d6cb1d2a 100644
--- a/patches/0003-cfg80211-wext-padding/net_wireless_core.patch
+++ b/patches/0003-cfg80211-wext-padding/net_wireless_core.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/core.c
 +++ b/net/wireless/core.c
-@@ -403,6 +403,17 @@ struct wiphy *wiphy_new_nm(const struct
+@@ -404,6 +404,17 @@ struct wiphy *wiphy_new_nm(const struct
  	struct cfg80211_registered_device *rdev;
  	int alloc_size;
  
diff --git a/patches/0004-disable-wext-kconfig.patch b/patches/0004-disable-wext-kconfig.patch
index bcb60788..5d06600d 100644
--- a/patches/0004-disable-wext-kconfig.patch
+++ b/patches/0004-disable-wext-kconfig.patch
@@ -3,7 +3,8 @@ so remove the Kconfig options for them.
 
 --- a/net/wireless/Kconfig
 +++ b/net/wireless/Kconfig
-@@ -1,21 +1,3 @@
+@@ -1,22 +1,4 @@
+ # SPDX-License-Identifier: GPL-2.0-only
 -config WIRELESS_EXT
 -	bool
 -
@@ -25,7 +26,7 @@ so remove the Kconfig options for them.
  config CFG80211
  	tristate "cfg80211 - wireless configuration API"
  	depends on RFKILL || !RFKILL
-@@ -187,7 +169,7 @@ config CFG80211_CRDA_SUPPORT
+@@ -188,7 +170,7 @@ config CFG80211_CRDA_SUPPORT
  
  config CFG80211_WEXT
  	bool "cfg80211 wireless extensions compatibility" if !CFG80211_WEXT_EXPORT
diff --git a/patches/0010-add-wext-handlers-to-netdev/net_wireless_core.patch b/patches/0010-add-wext-handlers-to-netdev/net_wireless_core.patch
index 92b299c3..976b50e0 100644
--- a/patches/0010-add-wext-handlers-to-netdev/net_wireless_core.patch
+++ b/patches/0010-add-wext-handlers-to-netdev/net_wireless_core.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/core.c
 +++ b/net/wireless/core.c
-@@ -496,10 +496,6 @@ use_default_name:
+@@ -497,10 +497,6 @@ use_default_name:
  	INIT_WORK(&rdev->mlme_unreg_wk, cfg80211_mlme_unreg_wk);
  	INIT_DELAYED_WORK(&rdev->dfs_update_channels_wk,
  			  cfg80211_dfs_channels_update_work);
@@ -11,7 +11,7 @@
  	device_initialize(&rdev->wiphy.dev);
  	rdev->wiphy.dev.class = &ieee80211_class;
  	rdev->wiphy.dev.platform_data = rdev;
-@@ -1285,6 +1281,15 @@ static int cfg80211_netdev_notifier_call
+@@ -1286,6 +1282,15 @@ static int cfg80211_netdev_notifier_call
  		}
  		wdev->netdev = dev;
  #ifdef CONFIG_CFG80211_WEXT
diff --git a/patches/0012-driver-quirks/drivers_net_wireless_cw1200_sdio.patch b/patches/0012-driver-quirks/drivers_net_wireless_cw1200_sdio.patch
index dd5c53a5..175561f9 100644
--- a/patches/0012-driver-quirks/drivers_net_wireless_cw1200_sdio.patch
+++ b/patches/0012-driver-quirks/drivers_net_wireless_cw1200_sdio.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/st/cw1200/cw1200_sdio.c
 +++ b/drivers/net/wireless/st/cw1200/cw1200_sdio.c
-@@ -254,6 +254,12 @@ static size_t cw1200_sdio_align_size(str
+@@ -251,6 +251,12 @@ static size_t cw1200_sdio_align_size(str
  	else
  		size = sdio_align_size(self->func, size);
  
diff --git a/patches/0014-netlink_seq/net_wireless_nl80211.patch b/patches/0014-netlink_seq/net_wireless_nl80211.patch
index ea0fcdde..100a9263 100644
--- a/patches/0014-netlink_seq/net_wireless_nl80211.patch
+++ b/patches/0014-netlink_seq/net_wireless_nl80211.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/nl80211.c
 +++ b/net/wireless/nl80211.c
-@@ -8406,7 +8406,9 @@ static int nl80211_dump_scan(struct sk_b
+@@ -8600,7 +8600,9 @@ static int nl80211_dump_scan(struct sk_b
  	if (start == 0)
  		cfg80211_bss_expire(rdev);
  
diff --git a/patches/0015-rename_pm_qos_request/drivers_net_wireless_ipw2x00_ipw2100.patch b/patches/0015-rename_pm_qos_request/drivers_net_wireless_ipw2x00_ipw2100.patch
index d3dc0a0d..3b3499e2 100644
--- a/patches/0015-rename_pm_qos_request/drivers_net_wireless_ipw2x00_ipw2100.patch
+++ b/patches/0015-rename_pm_qos_request/drivers_net_wireless_ipw2x00_ipw2100.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/intel/ipw2x00/ipw2100.c
 +++ b/drivers/net/wireless/intel/ipw2x00/ipw2100.c
-@@ -175,7 +175,11 @@ that only one external action is invoked
+@@ -161,7 +161,11 @@ that only one external action is invoked
  #define DRV_DESCRIPTION	"Intel(R) PRO/Wireless 2100 Network Driver"
  #define DRV_COPYRIGHT	"Copyright(c) 2003-2006 Intel Corporation"
  
diff --git a/patches/0016-libertas-olpc-ec-wakeup/drivers_net_wireless_libertas_if_usb.patch b/patches/0016-libertas-olpc-ec-wakeup/drivers_net_wireless_libertas_if_usb.patch
index 22108262..c9cb687a 100644
--- a/patches/0016-libertas-olpc-ec-wakeup/drivers_net_wireless_libertas_if_usb.patch
+++ b/patches/0016-libertas-olpc-ec-wakeup/drivers_net_wireless_libertas_if_usb.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/marvell/libertas/if_usb.c
 +++ b/drivers/net/wireless/marvell/libertas/if_usb.c
-@@ -939,6 +939,7 @@ static int if_usb_suspend(struct usb_int
+@@ -940,6 +940,7 @@ static int if_usb_suspend(struct usb_int
  		goto out;
  	}
  
@@ -8,7 +8,7 @@
  #ifdef CONFIG_OLPC
  	if (machine_is_olpc()) {
  		if (priv->wol_criteria == EHS_REMOVE_WAKEUP)
-@@ -947,6 +948,7 @@ static int if_usb_suspend(struct usb_int
+@@ -948,6 +949,7 @@ static int if_usb_suspend(struct usb_int
  			olpc_ec_wakeup_set(EC_SCI_SRC_WLAN);
  	}
  #endif
diff --git a/patches/0022-define-tracing/mt7601u.patch b/patches/0022-define-tracing/mt7601u.patch
index 1682a763..7649944b 100644
--- a/patches/0022-define-tracing/mt7601u.patch
+++ b/patches/0022-define-tracing/mt7601u.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/mediatek/mt7601u/trace.c
 +++ b/drivers/net/wireless/mediatek/mt7601u/trace.c
-@@ -13,6 +13,9 @@
+@@ -5,6 +5,9 @@
   */
  
  #include <linux/module.h>
diff --git a/patches/0024-led-blink-api/mac80211.patch b/patches/0024-led-blink-api/mac80211.patch
index fd4e4102..39fb6f0c 100644
--- a/patches/0024-led-blink-api/mac80211.patch
+++ b/patches/0024-led-blink-api/mac80211.patch
@@ -1,6 +1,6 @@
 --- a/net/mac80211/ieee80211_i.h
 +++ b/net/mac80211/ieee80211_i.h
-@@ -1309,6 +1309,7 @@ struct ieee80211_local {
+@@ -1306,6 +1306,7 @@ struct ieee80211_local {
  	struct mutex chanctx_mtx;
  
  #ifdef CONFIG_MAC80211_LEDS
@@ -10,7 +10,7 @@
  	atomic_t tx_led_active, rx_led_active, assoc_led_active;
 --- a/net/mac80211/led.h
 +++ b/net/mac80211/led.h
-@@ -16,22 +16,36 @@
+@@ -13,22 +13,36 @@
  static inline void ieee80211_led_rx(struct ieee80211_local *local)
  {
  #ifdef CONFIG_MAC80211_LEDS
diff --git a/patches/0025-usb-sg/usbnet.patch b/patches/0025-usb-sg/usbnet.patch
index cab07250..af20480f 100644
--- a/patches/0025-usb-sg/usbnet.patch
+++ b/patches/0025-usb-sg/usbnet.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/usb/usbnet.c
 +++ b/drivers/net/usb/usbnet.c
-@@ -1313,6 +1313,7 @@ EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
+@@ -1302,6 +1302,7 @@ EXPORT_SYMBOL_GPL(usbnet_tx_timeout);
  
  /*-------------------------------------------------------------------------*/
  
@@ -8,7 +8,7 @@
  static int build_dma_sg(const struct sk_buff *skb, struct urb *urb)
  {
  	unsigned num_sgs, total_len = 0;
-@@ -1345,6 +1346,12 @@ static int build_dma_sg(const struct sk_
+@@ -1334,6 +1335,12 @@ static int build_dma_sg(const struct sk_
  
  	return 1;
  }
@@ -21,7 +21,7 @@
  
  netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
  				     struct net_device *net)
-@@ -1401,12 +1408,19 @@ netdev_tx_t usbnet_start_xmit (struct sk
+@@ -1390,12 +1397,19 @@ netdev_tx_t usbnet_start_xmit (struct sk
  		if (!(info->flags & FLAG_SEND_ZLP)) {
  			if (!(info->flags & FLAG_MULTI_PACKET)) {
  				length++;
@@ -41,7 +41,7 @@
  			}
  		} else
  			urb->transfer_flags |= URB_ZERO_PACKET;
-@@ -1473,7 +1487,9 @@ not_drop:
+@@ -1467,7 +1481,9 @@ not_drop:
  		if (skb)
  			dev_kfree_skb_any (skb);
  		if (urb) {
@@ -51,7 +51,7 @@
  			usb_free_urb(urb);
  		}
  	} else
-@@ -1526,7 +1542,9 @@ static void usbnet_bh (struct timer_list
+@@ -1520,7 +1536,9 @@ static void usbnet_bh (struct timer_list
  			rx_process (dev, skb);
  			continue;
  		case tx_done:
@@ -61,7 +61,7 @@
  			/* fall through */
  		case rx_cleanup:
  			usb_free_urb (entry->urb);
-@@ -1894,7 +1912,9 @@ int usbnet_resume (struct usb_interface
+@@ -1888,7 +1906,9 @@ int usbnet_resume (struct usb_interface
  			retval = usb_submit_urb(res, GFP_ATOMIC);
  			if (retval < 0) {
  				dev_kfree_skb_any(skb);
diff --git a/patches/0026-ipv6_stub/cdc_mbim.patch b/patches/0026-ipv6_stub/cdc_mbim.patch
index c6abb101..868928bb 100644
--- a/patches/0026-ipv6_stub/cdc_mbim.patch
+++ b/patches/0026-ipv6_stub/cdc_mbim.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/usb/cdc_mbim.c
 +++ b/drivers/net/usb/cdc_mbim.c
-@@ -302,6 +302,7 @@ error:
+@@ -300,6 +300,7 @@ error:
  	return NULL;
  }
  
@@ -8,7 +8,7 @@
  /* Some devices are known to send Neigbor Solicitation messages and
   * require Neigbor Advertisement replies.  The IPv6 core will not
   * respond since IFF_NOARP is set, so we must handle them ourselves.
-@@ -362,6 +363,7 @@ static bool is_neigh_solicit(u8 *buf, si
+@@ -360,6 +361,7 @@ static bool is_neigh_solicit(u8 *buf, si
  		msg->icmph.icmp6_code == 0 &&
  		msg->icmph.icmp6_type == NDISC_NEIGHBOUR_SOLICITATION);
  }
@@ -16,7 +16,7 @@
  
  
  static struct sk_buff *cdc_mbim_process_dgram(struct usbnet *dev, u8 *buf, size_t len, u16 tci)
-@@ -378,8 +380,10 @@ static struct sk_buff *cdc_mbim_process_
+@@ -376,8 +378,10 @@ static struct sk_buff *cdc_mbim_process_
  			proto = htons(ETH_P_IP);
  			break;
  		case 0x60:
diff --git a/patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch b/patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch
index 2441af6e..5938950a 100644
--- a/patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch
+++ b/patches/0033-ndo_vlan_rx_vid/cdc_mbim.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/usb/cdc_mbim.c
 +++ b/drivers/net/usb/cdc_mbim.c
-@@ -70,7 +70,13 @@ static int cdc_mbim_wdm_manage_power(str
+@@ -68,7 +68,13 @@ static int cdc_mbim_wdm_manage_power(str
  	return cdc_mbim_manage_power(dev, status);
  }
  
@@ -14,7 +14,7 @@
  {
  	struct usbnet *dev = netdev_priv(netdev);
  	struct cdc_mbim_state *info = (void *)&dev->data;
-@@ -78,13 +84,21 @@ static int cdc_mbim_rx_add_vid(struct ne
+@@ -76,13 +82,21 @@ static int cdc_mbim_rx_add_vid(struct ne
  	/* creation of this VLAN is a request to tag IP session 0 */
  	if (vid == MBIM_IPS0_VID)
  		info->flags |= FLAG_IPS0_VLAN;
@@ -36,7 +36,7 @@
  {
  	struct usbnet *dev = netdev_priv(netdev);
  	struct cdc_mbim_state *info = (void *)&dev->data;
-@@ -92,7 +106,9 @@ static int cdc_mbim_rx_kill_vid(struct n
+@@ -90,7 +104,9 @@ static int cdc_mbim_rx_kill_vid(struct n
  	/* this is a request for an untagged IP session 0 */
  	if (vid == MBIM_IPS0_VID)
  		info->flags &= ~FLAG_IPS0_VLAN;
diff --git a/patches/0053-possible_net_t.patch b/patches/0053-possible_net_t.patch
index 4ebbb3a1..c401e5d1 100644
--- a/patches/0053-possible_net_t.patch
+++ b/patches/0053-possible_net_t.patch
@@ -2,7 +2,7 @@ diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
 index 04e5785..a251da1 100644
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
-@@ -4482,12 +4482,12 @@ struct wiphy {
+@@ -4552,12 +4552,12 @@ struct wiphy {
  
  static inline struct net *wiphy_net(struct wiphy *wiphy)
  {
diff --git a/patches/0060-trace_field_struct/mt7601u.patch b/patches/0060-trace_field_struct/mt7601u.patch
index 8b4af1f3..ca9dea53 100644
--- a/patches/0060-trace_field_struct/mt7601u.patch
+++ b/patches/0060-trace_field_struct/mt7601u.patch
@@ -2,7 +2,7 @@ diff --git a/drivers/net/wireless/mediatek/mt7601u/trace.h b/drivers/net/wireles
 index 2898973..7fa1b96 100644
 --- a/drivers/net/wireless/mediatek/mt7601u/trace.h
 +++ b/drivers/net/wireless/mediatek/mt7601u/trace.h
-@@ -252,6 +252,7 @@ TRACE_EVENT(freq_cal_offset,
+@@ -244,6 +244,7 @@ TRACE_EVENT(freq_cal_offset,
  		  DEV_PR_ARG, __entry->phy_mode, __entry->freq_off)
  );
  
@@ -10,7 +10,7 @@ index 2898973..7fa1b96 100644
  TRACE_EVENT(mt_rx,
  	TP_PROTO(struct mt7601u_dev *dev, struct mt7601u_rxwi *rxwi, u32 f),
  	TP_ARGS(dev, rxwi, f),
-@@ -306,6 +307,20 @@ TRACE_EVENT(mt_tx,
+@@ -298,6 +299,20 @@ TRACE_EVENT(mt_tx,
  		  __entry->h.ack_ctl, __entry->h.wcid,
  		  le16_to_cpu(__entry->h.len_ctl))
  );
diff --git a/patches/0069-iwlwifi-pd-string-fix.patch b/patches/0069-iwlwifi-pd-string-fix.patch
index 8a2ae81a..dfb5c1af 100644
--- a/patches/0069-iwlwifi-pd-string-fix.patch
+++ b/patches/0069-iwlwifi-pd-string-fix.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
 +++ b/drivers/net/wireless/intel/iwlwifi/dvm/debugfs.c
-@@ -2386,12 +2386,23 @@ void iwl_dbgfs_register(struct iwl_priv
+@@ -2373,12 +2373,23 @@ void iwl_dbgfs_register(struct iwl_priv
  	 */
  	if (priv->mac80211_registered) {
  		char buf[100];
@@ -26,10 +26,10 @@
  	}
 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c
-@@ -776,8 +776,13 @@ void iwl_mvm_vif_dbgfs_register(struct i
- 	mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir);
+@@ -774,8 +774,13 @@ void iwl_mvm_vif_dbgfs_register(struct i
  
- 	if (!mvmvif->dbgfs_dir) {
+ 	mvmvif->dbgfs_dir = debugfs_create_dir("iwlmvm", dbgfs_dir);
+ 	if (IS_ERR_OR_NULL(mvmvif->dbgfs_dir)) {
 +#if LINUX_VERSION_IS_GEQ(3,12,0)
  		IWL_ERR(mvm, "Failed to create debugfs directory under %pd\n",
  			dbgfs_dir);
@@ -40,7 +40,7 @@
  		return;
  	}
  
-@@ -806,15 +811,28 @@ void iwl_mvm_vif_dbgfs_register(struct i
+@@ -804,9 +809,17 @@ void iwl_mvm_vif_dbgfs_register(struct i
  	 * find
  	 * netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/
  	 */
@@ -58,20 +58,9 @@
  
  	mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name,
  						     mvm->debugfs_dir, buf);
- 	if (!mvmvif->dbgfs_slink)
-+#if LINUX_VERSION_IS_GEQ(3,12,0)
- 		IWL_ERR(mvm, "Can't create debugfs symbolic link under %pd\n",
- 			dbgfs_dir);
-+#else
-+		IWL_ERR(mvm, "Can't create debugfs symbolic link under %s\n",
-+			dbgfs_dir->d_name.name);
-+#endif
- 	return;
- err:
- 	IWL_ERR(mvm, "Can't create debugfs entity\n");
 --- a/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
 +++ b/drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
-@@ -2211,7 +2211,13 @@ int iwl_mvm_dbgfs_register(struct iwl_mv
+@@ -2131,6 +2131,12 @@ void iwl_mvm_dbgfs_register(struct iwl_m
  	 * Create a symlink with mac80211. It will be removed when mac80211
  	 * exists (before the opmode exists which removes the target.)
  	 */
@@ -82,6 +71,5 @@
 +		 dbgfs_dir->d_parent->d_parent->d_name.name,
 +		 dbgfs_dir->d_parent->d_name.name);
 +#endif
- 	if (!debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir, buf))
- 		goto err;
- 
+ 	debugfs_create_symlink("iwlwifi", mvm->hw->wiphy->debugfsdir, buf);
+ }
diff --git a/patches/0070-mac80211-fils.patch b/patches/0070-mac80211-fils.patch
index d3f249c5..aa2d6051 100644
--- a/patches/0070-mac80211-fils.patch
+++ b/patches/0070-mac80211-fils.patch
@@ -2,17 +2,17 @@
 +++ b/net/mac80211/fils_aead.c
 @@ -1,3 +1,4 @@
 +#if LINUX_VERSION_IS_GEQ(4,3,0)
+ // SPDX-License-Identifier: GPL-2.0-only
  /*
   * FILS AEAD for (Re)Association Request/Response frames
-  * Copyright 2016, Qualcomm Atheros, Inc.
-@@ -332,3 +333,4 @@ int fils_decrypt_assoc_resp(struct ieee8
+@@ -329,3 +330,4 @@ int fils_decrypt_assoc_resp(struct ieee8
  	*frame_len -= AES_BLOCK_SIZE;
  	return 0;
  }
 +#endif
 --- a/net/mac80211/fils_aead.h
 +++ b/net/mac80211/fils_aead.h
-@@ -10,10 +10,27 @@
+@@ -7,10 +7,27 @@
  #ifndef FILS_AEAD_H
  #define FILS_AEAD_H
  
@@ -42,7 +42,7 @@
  #endif /* FILS_AEAD_H */
 --- a/net/mac80211/main.c
 +++ b/net/mac80211/main.c
-@@ -573,7 +573,9 @@ struct ieee80211_hw *ieee80211_alloc_hw_
+@@ -570,7 +570,9 @@ struct ieee80211_hw *ieee80211_alloc_hw_
  			   NL80211_FEATURE_MAC_ON_CREATE |
  			   NL80211_FEATURE_USERSPACE_MPM |
  			   NL80211_FEATURE_FULL_AP_CLIENT_STATE;
diff --git a/patches/0071-skb-head_frag/wireless.patch b/patches/0071-skb-head_frag/wireless.patch
index 6acea216..6c01890c 100644
--- a/patches/0071-skb-head_frag/wireless.patch
+++ b/patches/0071-skb-head_frag/wireless.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/util.c
 +++ b/net/wireless/util.c
-@@ -638,7 +638,11 @@ void ieee80211_amsdu_to_8023s(struct sk_
+@@ -647,7 +647,11 @@ void ieee80211_amsdu_to_8023s(struct sk_
  	u8 *payload;
  	int offset = 0, remaining;
  	struct ethhdr eth;
diff --git a/patches/0075-ndo-stats-64/usbnet.patch b/patches/0075-ndo-stats-64/usbnet.patch
index ac66d212..bd7eb2aa 100644
--- a/patches/0075-ndo-stats-64/usbnet.patch
+++ b/patches/0075-ndo-stats-64/usbnet.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/usb/usbnet.c
 +++ b/drivers/net/usb/usbnet.c
-@@ -1016,6 +1016,9 @@ void usbnet_get_stats64(struct net_devic
+@@ -1005,6 +1005,9 @@ void usbnet_get_stats64(struct net_devic
  	}
  }
  EXPORT_SYMBOL_GPL(usbnet_get_stats64);
diff --git a/patches/0077-genl-ro-after-init/hwsim.patch b/patches/0077-genl-ro-after-init/hwsim.patch
index f97af731..ada56d34 100644
--- a/patches/0077-genl-ro-after-init/hwsim.patch
+++ b/patches/0077-genl-ro-after-init/hwsim.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/mac80211_hwsim.c
 +++ b/drivers/net/wireless/mac80211_hwsim.c
-@@ -3654,7 +3654,7 @@ static const struct genl_ops hwsim_ops[]
+@@ -3664,7 +3664,7 @@ static const struct genl_ops hwsim_ops[]
  	},
  };
  
diff --git a/patches/0077-genl-ro-after-init/nl80211.patch b/patches/0077-genl-ro-after-init/nl80211.patch
index ceba57bd..227cd5fe 100644
--- a/patches/0077-genl-ro-after-init/nl80211.patch
+++ b/patches/0077-genl-ro-after-init/nl80211.patch
@@ -1,6 +1,6 @@
 --- a/net/wireless/nl80211.c
 +++ b/net/wireless/nl80211.c
-@@ -14199,7 +14199,7 @@ static const struct genl_ops nl80211_ops
+@@ -14497,7 +14497,7 @@ static const struct genl_ops nl80211_ops
  	},
  };
  
diff --git a/patches/0083-timer_list.patch b/patches/0083-timer_list.patch
index dca3b948..413b26dc 100644
--- a/patches/0083-timer_list.patch
+++ b/patches/0083-timer_list.patch
@@ -1,6 +1,6 @@
 --- a/drivers/net/wireless/atmel/at76c50x-usb.c
 +++ b/drivers/net/wireless/atmel/at76c50x-usb.c
-@@ -518,11 +518,19 @@ exit:
+@@ -513,11 +513,19 @@ exit:
  
  /* LED trigger */
  static int tx_activity;
diff --git a/patches/0085-iwlwifi-pci-device-removal.patch b/patches/0085-iwlwifi-pci-device-removal.patch
index b7536d93..fb3f37cf 100644
--- a/patches/0085-iwlwifi-pci-device-removal.patch
+++ b/patches/0085-iwlwifi-pci-device-removal.patch
@@ -2,7 +2,7 @@ diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c b/drivers/net/wirel
 index f74281508197..3b11bd68f261 100644
 --- a/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
 +++ b/drivers/net/wireless/intel/iwlwifi/pcie/trans.c
-@@ -1926,6 +1926,9 @@ static void iwl_trans_pcie_removal_wk(st
+@@ -1948,6 +1948,9 @@ static void iwl_trans_pcie_removal_wk(st
  	struct iwl_trans_pcie_removal *removal =
  		container_of(wk, struct iwl_trans_pcie_removal, work);
  	struct pci_dev *pdev = removal->pdev;
@@ -12,7 +12,7 @@ index f74281508197..3b11bd68f261 100644
  	static char *prop[] = {"EVENT=INACCESSIBLE", NULL};
  
  	dev_err(&pdev->dev, "Device gone - attempting removal\n");
-@@ -1934,6 +1937,7 @@ static void iwl_trans_pcie_removal_wk(st
+@@ -1956,6 +1959,7 @@ static void iwl_trans_pcie_removal_wk(st
  	pci_dev_put(pdev);
  	pci_stop_and_remove_bus_device(pdev);
  	pci_unlock_rescan_remove();
diff --git a/patches/devcoredump.patch b/patches/devcoredump.patch
index 1dbec579..31ac0b7e 100644
--- a/patches/devcoredump.patch
+++ b/patches/devcoredump.patch
@@ -97,7 +97,7 @@
 -__exitcall(devcoredump_exit);
 --- a/include/linux/backport-devcoredump.h
 +++ b/include/linux/backport-devcoredump.h
-@@ -66,7 +66,7 @@ static inline void _devcd_free_sgtable(s
+@@ -51,7 +51,7 @@ static inline void _devcd_free_sgtable(s
  }
  
  
@@ -106,7 +106,7 @@
  void dev_coredumpv(struct device *dev, void *data, size_t datalen,
  		   gfp_t gfp);
  
-@@ -100,6 +100,6 @@ static inline void dev_coredumpsg(struct
+@@ -85,6 +85,6 @@ static inline void dev_coredumpsg(struct
  {
  	_devcd_free_sgtable(table);
  }
diff --git a/patches/verify.patch b/patches/verify.patch
index d52b7ce4..5adba0e6 100644
--- a/patches/verify.patch
+++ b/patches/verify.patch
@@ -1,6 +1,6 @@
 --- a/compat/verification/pkcs7_trust.c
 +++ b/compat/verification/pkcs7_trust.c
-@@ -116,7 +116,7 @@ static int pkcs7_validate_trust_one(stru
+@@ -112,7 +112,7 @@ static int pkcs7_validate_trust_one(stru
  	return -ENOKEY;
  
  matched:
@@ -11,7 +11,7 @@
  		if (ret == -ENOMEM)
 --- a/compat/verification/x509_public_key.c
 +++ b/compat/verification/x509_public_key.c
-@@ -13,11 +13,8 @@
+@@ -9,11 +9,8 @@
  #include <linux/module.h>
  #include <linux/kernel.h>
  #include <linux/slab.h>
@@ -23,7 +23,7 @@
  #include "x509_parser.h"
  
  /*
-@@ -155,6 +152,7 @@ not_self_signed:
+@@ -150,6 +147,7 @@ not_self_signed:
  	return 0;
  }
  
@@ -31,7 +31,7 @@
  /*
   * Attempt to parse a data blob for a key as an X509 certificate.
   */
-@@ -273,3 +271,4 @@ module_exit(x509_key_exit);
+@@ -268,3 +266,4 @@ module_exit(x509_key_exit);
  MODULE_DESCRIPTION("X.509 certificate parser");
  MODULE_AUTHOR("Red Hat, Inc.");
  MODULE_LICENSE("GPL");
@@ -51,7 +51,7 @@
  #endif /* CPTCFG_BPAUTO_PKCS7 */
 --- a/compat/verification/x509_parser.h
 +++ b/compat/verification/x509_parser.h
-@@ -13,6 +13,10 @@
+@@ -9,6 +9,10 @@
  #include <crypto/public_key.h>
  #include <keys/asymmetric-type.h>
  
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 06/18] backport: Extend netlink parsing with strict validation
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (4 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 05/18] patches: Make patches apply on top of kernel 5.2-rc6 Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 07/18] header: Add backport-include/net/ipv6_stubs.h Hauke Mehrtens
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Johannes Berg, Hauke Mehrtens

From: Johannes Berg <johannes.berg@intel.com>

This extends the backported netlink handling with strict parsing. the
struct gen_ops now supports the validate member and does the validation
inside the backport layer.

This is needed to use backports with kernel 5.2.

[Hauke: Remove nla_validate_nested()]
[Hauke: Support struct genl_ops on older kernel versions]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/net/genetlink.h     |  62 +++-
 backport/backport-include/net/netlink.h       | 341 +++++++++++++-----
 backport/compat/Kconfig                       |   5 +
 backport/compat/Makefile                      |   4 +-
 .../{backport-4.20.c => backport-5.2.c}       | 216 ++++++++---
 backport/compat/backport-genetlink.c          |  26 +-
 6 files changed, 491 insertions(+), 163 deletions(-)
 rename backport/compat/{backport-4.20.c => backport-5.2.c} (58%)

diff --git a/backport/backport-include/net/genetlink.h b/backport/backport-include/net/genetlink.h
index 84011e72..772f10f0 100644
--- a/backport/backport-include/net/genetlink.h
+++ b/backport/backport-include/net/genetlink.h
@@ -91,12 +91,71 @@ void backport_genl_dump_check_consistent(struct netlink_callback *cb,
 #endif
 #endif /* LINUX_VERSION_IS_LESS(4,15,0) */
 
-#if LINUX_VERSION_IS_LESS(4,20,0)
+#if LINUX_VERSION_IS_LESS(5,2,0)
+enum genl_validate_flags {
+	GENL_DONT_VALIDATE_STRICT		= BIT(0),
+	GENL_DONT_VALIDATE_DUMP			= BIT(1),
+	GENL_DONT_VALIDATE_DUMP_STRICT		= BIT(2),
+};
+
+#if LINUX_VERSION_IS_GEQ(3,13,0)
+struct backport_genl_ops {
+	void			*__dummy_was_policy_must_be_null;
+	int		       (*doit)(struct sk_buff *skb,
+				       struct genl_info *info);
+#if LINUX_VERSION_IS_GEQ(4,5,0) || \
+    LINUX_VERSION_IN_RANGE(4,4,104, 4,5,0) || \
+    LINUX_VERSION_IN_RANGE(4,1,48, 4,2,0) || \
+    LINUX_VERSION_IN_RANGE(3,18,86, 3,19,0)
+	int		       (*start)(struct netlink_callback *cb);
+#endif
+	int		       (*dumpit)(struct sk_buff *skb,
+					 struct netlink_callback *cb);
+	int		       (*done)(struct netlink_callback *cb);
+	u8			cmd;
+	u8			internal_flags;
+	u8			flags;
+	u8			validate;
+};
+#else
+struct backport_genl_ops {
+	u8			cmd;
+	u8			internal_flags;
+	unsigned int		flags;
+	void			*__dummy_was_policy_must_be_null;
+	int		       (*doit)(struct sk_buff *skb,
+				       struct genl_info *info);
+	int		       (*dumpit)(struct sk_buff *skb,
+					 struct netlink_callback *cb);
+	int		       (*done)(struct netlink_callback *cb);
+	struct list_head	ops_list;
+	u8			validate;
+};
+#endif
+
 static inline int
 __real_backport_genl_register_family(struct genl_family *family)
 {
+#define OPS_VALIDATE(f) \
+	BUILD_BUG_ON(offsetof(struct genl_ops, f) != \
+		     offsetof(struct backport_genl_ops, f))
+	OPS_VALIDATE(doit);
+#if LINUX_VERSION_IS_GEQ(4,5,0) || \
+    LINUX_VERSION_IN_RANGE(4,4,104, 4,5,0) || \
+    LINUX_VERSION_IN_RANGE(4,1,48, 4,2,0) || \
+    LINUX_VERSION_IN_RANGE(3,18,86, 3,19,0)
+	OPS_VALIDATE(start);
+#endif
+	OPS_VALIDATE(dumpit);
+	OPS_VALIDATE(done);
+	OPS_VALIDATE(cmd);
+	OPS_VALIDATE(internal_flags);
+	OPS_VALIDATE(flags);
+
 	return genl_register_family(family);
 }
+#define genl_ops backport_genl_ops
+
 static inline int
 __real_backport_genl_unregister_family(struct genl_family *family)
 {
@@ -115,6 +174,7 @@ struct backport_genl_family {
 	unsigned int		maxattr;
 	bool			netnsok;
 	bool			parallel_ops;
+	const struct nla_policy *policy;
 	int			(*pre_doit)(__genl_const struct genl_ops *ops,
 					    struct sk_buff *skb,
 					    struct genl_info *info);
diff --git a/backport/backport-include/net/netlink.h b/backport/backport-include/net/netlink.h
index d8237f10..4d73c57f 100644
--- a/backport/backport-include/net/netlink.h
+++ b/backport/backport-include/net/netlink.h
@@ -4,20 +4,7 @@
 #include <linux/version.h>
 #include <linux/in6.h>
 
-#if LINUX_VERSION_IS_LESS(5,1,0)
-#undef NLA_POLICY_NESTED
-#undef NLA_POLICY_NESTED_ARRAY
-#define _NLA_POLICY_NESTED(maxattr, policy) \
-	{ .type = NLA_NESTED, .validation_data = policy, .len = maxattr }
-#define _NLA_POLICY_NESTED_ARRAY(maxattr, policy) \
-	{ .type = NLA_NESTED_ARRAY, .validation_data = policy, .len = maxattr }
-#define NLA_POLICY_NESTED(policy) \
-	_NLA_POLICY_NESTED(ARRAY_SIZE(policy) - 1, policy)
-#define NLA_POLICY_NESTED_ARRAY(policy) \
-	_NLA_POLICY_NESTED_ARRAY(ARRAY_SIZE(policy) - 1, policy)
-#endif /* < 5.1 */
-
-#if LINUX_VERSION_IS_LESS(4,20,0)
+#if LINUX_VERSION_IS_LESS(5,2,0)
 /* can't backport using the enum - need to override */
 #define NLA_UNSPEC		0
 #define NLA_U8			1
@@ -39,17 +26,10 @@
 #define NLA_REJECT		17
 #define NLA_EXACT_LEN		18
 #define NLA_EXACT_LEN_WARN	19
-#define __NLA_TYPE_MAX		20
+#define NLA_MIN_LEN		20
+#define __NLA_TYPE_MAX		21
 #define NLA_TYPE_MAX		(__NLA_TYPE_MAX - 1)
 
-enum nla_policy_validation {
-	NLA_VALIDATE_NONE,
-	NLA_VALIDATE_RANGE,
-	NLA_VALIDATE_MIN,
-	NLA_VALIDATE_MAX,
-	NLA_VALIDATE_FUNCTION,
-};
-
 struct backport_nla_policy {
 	u8		type;
 	u8		validation_type;
@@ -61,77 +41,169 @@ struct backport_nla_policy {
 		};
 		int (*validate)(const struct nlattr *attr,
 				struct netlink_ext_ack *extack);
+		u16 strict_start_type;
 	};
 };
 #define nla_policy backport_nla_policy
 
-#define NLA_POLICY_EXACT_LEN(_len)	{ .type = NLA_EXACT_LEN, .len = _len }
-#define NLA_POLICY_EXACT_LEN_WARN(_len)	{ .type = NLA_EXACT_LEN_WARN, \
-					  .len = _len }
+#define nla_nest_start_noflag LINUX_BACKPORT(nla_nest_start_noflag)
+static inline struct nlattr *nla_nest_start_noflag(struct sk_buff *skb,
+						   int attrtype)
+{
+	struct nlattr *start = (struct nlattr *)skb_tail_pointer(skb);
 
-#define NLA_POLICY_ETH_ADDR		NLA_POLICY_EXACT_LEN(ETH_ALEN)
-#define NLA_POLICY_ETH_ADDR_COMPAT	NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN)
+	if (nla_put(skb, attrtype, 0, NULL) < 0)
+		return NULL;
 
-#define __NLA_ENSURE(condition) (sizeof(char[1 - 2*!(condition)]) - 1)
-#define NLA_ENSURE_INT_TYPE(tp)				\
-	(__NLA_ENSURE(tp == NLA_S8 || tp == NLA_U8 ||	\
-		      tp == NLA_S16 || tp == NLA_U16 ||	\
-		      tp == NLA_S32 || tp == NLA_U32 ||	\
-		      tp == NLA_S64 || tp == NLA_U64) + tp)
-#define NLA_ENSURE_NO_VALIDATION_PTR(tp)		\
-	(__NLA_ENSURE(tp != NLA_BITFIELD32 &&		\
-		      tp != NLA_REJECT &&		\
-		      tp != NLA_NESTED &&		\
-		      tp != NLA_NESTED_ARRAY) + tp)
+	return start;
+}
 
-#define NLA_POLICY_RANGE(tp, _min, _max) {		\
-	.type = NLA_ENSURE_INT_TYPE(tp),		\
-	.validation_type = NLA_VALIDATE_RANGE,		\
-	.min = _min,					\
-	.max = _max					\
+#define nla_nest_start LINUX_BACKPORT(nla_nest_start)
+static inline struct nlattr *nla_nest_start(struct sk_buff *skb, int attrtype)
+{
+	return nla_nest_start_noflag(skb, attrtype | NLA_F_NESTED);
 }
 
-#define NLA_POLICY_MIN(tp, _min) {			\
-	.type = NLA_ENSURE_INT_TYPE(tp),		\
-	.validation_type = NLA_VALIDATE_MIN,		\
-	.min = _min,					\
+enum netlink_validation {
+	NL_VALIDATE_LIBERAL = 0,
+	NL_VALIDATE_TRAILING = BIT(0),
+	NL_VALIDATE_MAXTYPE = BIT(1),
+	NL_VALIDATE_UNSPEC = BIT(2),
+	NL_VALIDATE_STRICT_ATTRS = BIT(3),
+	NL_VALIDATE_NESTED = BIT(4),
+};
+
+#define NL_VALIDATE_DEPRECATED_STRICT (NL_VALIDATE_TRAILING |\
+				       NL_VALIDATE_MAXTYPE)
+#define NL_VALIDATE_STRICT (NL_VALIDATE_TRAILING |\
+			    NL_VALIDATE_MAXTYPE |\
+			    NL_VALIDATE_UNSPEC |\
+			    NL_VALIDATE_STRICT_ATTRS |\
+			    NL_VALIDATE_NESTED)
+
+#define __nla_validate LINUX_BACKPORT(__nla_validate)
+int __nla_validate(const struct nlattr *head, int len, int maxtype,
+		   const struct nla_policy *policy, unsigned int validate,
+		   struct netlink_ext_ack *extack);
+#define __nla_parse LINUX_BACKPORT(__nla_parse)
+int __nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
+		int len, const struct nla_policy *policy, unsigned int validate,
+		struct netlink_ext_ack *extack);
+
+#define nla_policy_len LINUX_BACKPORT(nla_policy_len)
+int nla_policy_len(const struct nla_policy *, int);
+
+#define nla_parse LINUX_BACKPORT(nla_parse)
+static inline int nla_parse(struct nlattr **tb, int maxtype,
+			    const struct nlattr *head, int len,
+			    const struct nla_policy *policy,
+			    struct netlink_ext_ack *extack)
+{
+	return __nla_parse(tb, maxtype, head, len, policy,
+			   NL_VALIDATE_STRICT, extack);
 }
 
-#define NLA_POLICY_MAX(tp, _max) {			\
-	.type = NLA_ENSURE_INT_TYPE(tp),		\
-	.validation_type = NLA_VALIDATE_MAX,		\
-	.max = _max,					\
+#define nla_parse_deprecated LINUX_BACKPORT(nla_parse_deprecated)
+static inline int nla_parse_deprecated(struct nlattr **tb, int maxtype,
+				       const struct nlattr *head, int len,
+				       const struct nla_policy *policy,
+				       struct netlink_ext_ack *extack)
+{
+	return __nla_parse(tb, maxtype, head, len, policy,
+			   NL_VALIDATE_LIBERAL, extack);
 }
 
-#define NLA_POLICY_VALIDATE_FN(tp, fn, ...) {		\
-	.type = NLA_ENSURE_NO_VALIDATION_PTR(tp),	\
-	.validation_type = NLA_VALIDATE_FUNCTION,	\
-	.validate = fn,					\
-	.len = __VA_ARGS__ + 0,				\
+#define nla_parse_deprecated_strict LINUX_BACKPORT(nla_parse_deprecated_strict)
+static inline int nla_parse_deprecated_strict(struct nlattr **tb, int maxtype,
+					      const struct nlattr *head,
+					      int len,
+					      const struct nla_policy *policy,
+					      struct netlink_ext_ack *extack)
+{
+	return __nla_parse(tb, maxtype, head, len, policy,
+			   NL_VALIDATE_DEPRECATED_STRICT, extack);
 }
 
-#define nla_validate LINUX_BACKPORT(nla_validate)
-int nla_validate(const struct nlattr *head, int len, int maxtype,
-		 const struct nla_policy *policy,
-		 struct netlink_ext_ack *extack);
-#define nla_parse LINUX_BACKPORT(nla_parse)
-int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
-	      int len, const struct nla_policy *policy,
-	      struct netlink_ext_ack *extack);
-#define nla_policy_len LINUX_BACKPORT(nla_policy_len)
-int nla_policy_len(const struct nla_policy *, int);
+#define __nlmsg_parse LINUX_BACKPORT(__nlmsg_parse)
+static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
+				struct nlattr *tb[], int maxtype,
+				const struct nla_policy *policy,
+				unsigned int validate,
+				struct netlink_ext_ack *extack)
+{
+	if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen)) {
+		NL_SET_ERR_MSG(extack, "Invalid header length");
+		return -EINVAL;
+	}
+
+	return __nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen),
+			   nlmsg_attrlen(nlh, hdrlen), policy, validate,
+			   extack);
+}
 
 #define nlmsg_parse LINUX_BACKPORT(nlmsg_parse)
 static inline int nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
 			      struct nlattr *tb[], int maxtype,
 			      const struct nla_policy *policy,
 			      struct netlink_ext_ack *extack)
+{
+	return __nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen),
+			   nlmsg_attrlen(nlh, hdrlen), policy,
+			   NL_VALIDATE_STRICT, extack);
+}
+
+#define nlmsg_parse_deprecated LINUX_BACKPORT(nlmsg_parse_deprecated)
+static inline int nlmsg_parse_deprecated(const struct nlmsghdr *nlh, int hdrlen,
+					 struct nlattr *tb[], int maxtype,
+					 const struct nla_policy *policy,
+					 struct netlink_ext_ack *extack)
+{
+	return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy,
+			     NL_VALIDATE_LIBERAL, extack);
+}
+
+#define nlmsg_parse_deprecated_strict LINUX_BACKPORT(nlmsg_parse_deprecated_strict)
+static inline int
+nlmsg_parse_deprecated_strict(const struct nlmsghdr *nlh, int hdrlen,
+			      struct nlattr *tb[], int maxtype,
+			      const struct nla_policy *policy,
+			      struct netlink_ext_ack *extack)
+{
+	return __nlmsg_parse(nlh, hdrlen, tb, maxtype, policy,
+			     NL_VALIDATE_DEPRECATED_STRICT, extack);
+}
+
+#define nla_validate_deprecated LINUX_BACKPORT(nla_validate_deprecated)
+static inline int nla_validate_deprecated(const struct nlattr *head, int len,
+					  int maxtype,
+					  const struct nla_policy *policy,
+					  struct netlink_ext_ack *extack)
+{
+	return __nla_validate(head, len, maxtype, policy, NL_VALIDATE_LIBERAL,
+			      extack);
+}
+
+#define nla_validate LINUX_BACKPORT(nla_validate)
+static inline int nla_validate(const struct nlattr *head, int len, int maxtype,
+			       const struct nla_policy *policy,
+			       struct netlink_ext_ack *extack)
+{
+	return __nla_validate(head, len, maxtype, policy, NL_VALIDATE_STRICT,
+			      extack);
+}
+
+#define nlmsg_validate_deprecated LINUX_BACKPORT(nlmsg_validate_deprecated)
+static inline int nlmsg_validate_deprecated(const struct nlmsghdr *nlh,
+					    int hdrlen, int maxtype,
+					    const struct nla_policy *policy,
+					    struct netlink_ext_ack *extack)
 {
 	if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
 		return -EINVAL;
 
-	return nla_parse(tb, maxtype, nlmsg_attrdata(nlh, hdrlen),
-			 nlmsg_attrlen(nlh, hdrlen), policy, extack);
+	return __nla_validate(nlmsg_attrdata(nlh, hdrlen),
+			      nlmsg_attrlen(nlh, hdrlen), maxtype,
+			      policy, NL_VALIDATE_LIBERAL, extack);
 }
 
 #define nlmsg_validate LINUX_BACKPORT(nlmsg_validate)
@@ -143,9 +215,9 @@ static inline int nlmsg_validate(const struct nlmsghdr *nlh,
 	if (nlh->nlmsg_len < nlmsg_msg_size(hdrlen))
 		return -EINVAL;
 
-	return nla_validate(nlmsg_attrdata(nlh, hdrlen),
-			    nlmsg_attrlen(nlh, hdrlen), maxtype, policy,
-			    extack);
+	return __nla_validate(nlmsg_attrdata(nlh, hdrlen),
+			      nlmsg_attrlen(nlh, hdrlen), maxtype,
+			      policy, NL_VALIDATE_STRICT, extack);
 }
 
 #define nla_parse_nested LINUX_BACKPORT(nla_parse_nested)
@@ -154,17 +226,111 @@ static inline int nla_parse_nested(struct nlattr *tb[], int maxtype,
 				   const struct nla_policy *policy,
 				   struct netlink_ext_ack *extack)
 {
-	return nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
-			 extack);
+	if (!(nla->nla_type & NLA_F_NESTED)) {
+		NL_SET_ERR_MSG_ATTR(extack, nla, "NLA_F_NESTED is missing");
+		return -EINVAL;
+	}
+
+	return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
+			   NL_VALIDATE_STRICT, extack);
 }
 
-#define nla_validate_nested LINUX_BACKPORT(nla_validate_nested)
-static inline int nla_validate_nested(const struct nlattr *start, int maxtype,
-				      const struct nla_policy *policy,
-				      struct netlink_ext_ack *extack)
+#define nla_parse_nested_deprecated LINUX_BACKPORT(nla_parse_nested_deprecated)
+static inline int nla_parse_nested_deprecated(struct nlattr *tb[], int maxtype,
+					      const struct nlattr *nla,
+					      const struct nla_policy *policy,
+					      struct netlink_ext_ack *extack)
 {
-	return nla_validate(nla_data(start), nla_len(start), maxtype, policy,
-			    extack);
+	return __nla_parse(tb, maxtype, nla_data(nla), nla_len(nla), policy,
+			   NL_VALIDATE_LIBERAL, extack);
+}
+
+#define __nla_validate_nested LINUX_BACKPORT(__nla_validate_nested)
+static inline int __nla_validate_nested(const struct nlattr *start, int maxtype,
+					const struct nla_policy *policy,
+					unsigned int validate,
+					struct netlink_ext_ack *extack)
+{
+	return __nla_validate(nla_data(start), nla_len(start), maxtype, policy,
+			      validate, extack);
+}
+
+#define nla_validate_nested_deprecated LINUX_BACKPORT(nla_validate_nested_deprecated)
+static inline int
+nla_validate_nested_deprecated(const struct nlattr *start, int maxtype,
+			       const struct nla_policy *policy,
+			       struct netlink_ext_ack *extack)
+{
+	return __nla_validate_nested(start, maxtype, policy,
+				     NL_VALIDATE_LIBERAL, extack);
+}
+#endif /* < 5.2 */
+
+#if LINUX_VERSION_IS_LESS(5,1,0)
+#undef NLA_POLICY_NESTED
+#undef NLA_POLICY_NESTED_ARRAY
+#define _NLA_POLICY_NESTED(maxattr, policy) \
+	{ .type = NLA_NESTED, .validation_data = policy, .len = maxattr }
+#define _NLA_POLICY_NESTED_ARRAY(maxattr, policy) \
+	{ .type = NLA_NESTED_ARRAY, .validation_data = policy, .len = maxattr }
+#define NLA_POLICY_NESTED(policy) \
+	_NLA_POLICY_NESTED(ARRAY_SIZE(policy) - 1, policy)
+#define NLA_POLICY_NESTED_ARRAY(policy) \
+	_NLA_POLICY_NESTED_ARRAY(ARRAY_SIZE(policy) - 1, policy)
+#endif /* < 5.1 */
+
+#if LINUX_VERSION_IS_LESS(4,20,0)
+enum nla_policy_validation {
+	NLA_VALIDATE_NONE,
+	NLA_VALIDATE_RANGE,
+	NLA_VALIDATE_MIN,
+	NLA_VALIDATE_MAX,
+	NLA_VALIDATE_FUNCTION,
+};
+
+#define NLA_POLICY_EXACT_LEN(_len)	{ .type = NLA_EXACT_LEN, .len = _len }
+#define NLA_POLICY_EXACT_LEN_WARN(_len)	{ .type = NLA_EXACT_LEN_WARN, \
+					  .len = _len }
+
+#define NLA_POLICY_ETH_ADDR		NLA_POLICY_EXACT_LEN(ETH_ALEN)
+#define NLA_POLICY_ETH_ADDR_COMPAT	NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN)
+
+#define __NLA_ENSURE(condition) (sizeof(char[1 - 2*!(condition)]) - 1)
+#define NLA_ENSURE_INT_TYPE(tp)				\
+	(__NLA_ENSURE(tp == NLA_S8 || tp == NLA_U8 ||	\
+		      tp == NLA_S16 || tp == NLA_U16 ||	\
+		      tp == NLA_S32 || tp == NLA_U32 ||	\
+		      tp == NLA_S64 || tp == NLA_U64) + tp)
+#define NLA_ENSURE_NO_VALIDATION_PTR(tp)		\
+	(__NLA_ENSURE(tp != NLA_BITFIELD32 &&		\
+		      tp != NLA_REJECT &&		\
+		      tp != NLA_NESTED &&		\
+		      tp != NLA_NESTED_ARRAY) + tp)
+
+#define NLA_POLICY_RANGE(tp, _min, _max) {		\
+	.type = NLA_ENSURE_INT_TYPE(tp),		\
+	.validation_type = NLA_VALIDATE_RANGE,		\
+	.min = _min,					\
+	.max = _max					\
+}
+
+#define NLA_POLICY_MIN(tp, _min) {			\
+	.type = NLA_ENSURE_INT_TYPE(tp),		\
+	.validation_type = NLA_VALIDATE_MIN,		\
+	.min = _min,					\
+}
+
+#define NLA_POLICY_MAX(tp, _max) {			\
+	.type = NLA_ENSURE_INT_TYPE(tp),		\
+	.validation_type = NLA_VALIDATE_MAX,		\
+	.max = _max,					\
+}
+
+#define NLA_POLICY_VALIDATE_FN(tp, fn, ...) {		\
+	.type = NLA_ENSURE_NO_VALIDATION_PTR(tp),	\
+	.validation_type = NLA_VALIDATE_FUNCTION,	\
+	.validate = fn,					\
+	.len = __VA_ARGS__ + 0,				\
 }
 #endif /* < 4.20 */
 
@@ -255,21 +421,6 @@ static inline int _nla_parse_nested4(struct nlattr *tb[], int maxtype,
 #undef nla_parse_nested
 #define nla_parse_nested(...) \
 	macro_dispatcher(_nla_parse_nested, __VA_ARGS__)(__VA_ARGS__)
-
-static inline int _nla_validate_nested4(const struct nlattr *start, int maxtype,
-					const struct nla_policy *policy,
-					struct netlink_ext_ack *extack)
-{
-	return nla_validate_nested(start, maxtype, policy, extack);
-}
-static inline int _nla_validate_nested3(const struct nlattr *start, int maxtype,
-					const struct nla_policy *policy)
-{
-	return nla_validate_nested(start, maxtype, policy, NULL);
-}
-#undef nla_validate_nested
-#define nla_validate_nested(...) \
-	macro_dispatcher(_nla_validate_nested, __VA_ARGS__)(__VA_ARGS__)
 #endif /* LINUX_VERSION_IS_LESS(4,12,0) */
 
 #if LINUX_VERSION_IS_LESS(3,7,0)
diff --git a/backport/compat/Kconfig b/backport/compat/Kconfig
index 20f34f1a..1d85a5da 100644
--- a/backport/compat/Kconfig
+++ b/backport/compat/Kconfig
@@ -62,6 +62,11 @@ config BP_MODULES
 	This symbol is necessary for the newer kconf tool, it looks
 	for the "option modules" to control the 'm' state.
 
+config BPAUTO_BUILD_NLATTR
+	def_bool y
+	depends on KERNEL_5_2
+	#c-file lib/nlattr.c
+
 config BPAUTO_BUILD_CORDIC
 	tristate
 	depends on !CORDIC
diff --git a/backport/compat/Makefile b/backport/compat/Makefile
index 99b52faa..e92e3120 100644
--- a/backport/compat/Makefile
+++ b/backport/compat/Makefile
@@ -37,9 +37,7 @@ compat-$(CPTCFG_KERNEL_4_7) += backport-4.7.o
 compat-$(CPTCFG_KERNEL_4_8) += backport-4.8.o
 compat-$(CPTCFG_KERNEL_4_10) += backport-4.10.o
 compat-$(CPTCFG_KERNEL_4_18) += backport-4.18.o
-compat-$(CPTCFG_KERNEL_4_20) += backport-4.20.o
-
-compat-$(CPTCFG_KERNEL_4_20) += backport-genetlink.o
+compat-$(CPTCFG_KERNEL_5_2) += backport-5.2.o backport-genetlink.o
 
 compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/verify.o
 compat-$(CPTCFG_BPAUTO_BUILD_SYSTEM_DATA_VERIFICATION) += verification/pkcs7.asn1.o
diff --git a/backport/compat/backport-4.20.c b/backport/compat/backport-5.2.c
similarity index 58%
rename from backport/compat/backport-4.20.c
rename to backport/compat/backport-5.2.c
index e26f3b52..5624d5fa 100644
--- a/backport/compat/backport-4.20.c
+++ b/backport/compat/backport-5.2.c
@@ -1,19 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) 2018 Intel Corporation
+ * NETLINK      Netlink attributes
  *
- * Backport functionality introduced in Linux 4.20.
- * This is basically upstream lib/nlattr.c.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
+ * 		Authors:	Thomas Graf <tgraf@suug.ch>
+ * 				Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
  */
-#include <linux/kernel.h>
+
 #include <linux/export.h>
+#include <linux/kernel.h>
 #include <linux/errno.h>
+#include <linux/jiffies.h>
+#include <linux/skbuff.h>
+#include <linux/string.h>
 #include <linux/types.h>
 #include <net/netlink.h>
 
+/* For these data types, attribute length should be exactly the given
+ * size. However, to maintain compatibility with broken commands, if the
+ * attribute length does not match the expected size a warning is emitted
+ * to the user that the command is sending invalid data and needs to be fixed.
+ */
 static const u8 nla_attr_len[NLA_TYPE_MAX+1] = {
 	[NLA_U8]	= sizeof(u8),
 	[NLA_U16]	= sizeof(u16),
@@ -63,7 +69,8 @@ static int validate_nla_bitfield32(const struct nlattr *nla,
 
 static int nla_validate_array(const struct nlattr *head, int len, int maxtype,
 			      const struct nla_policy *policy,
-			      struct netlink_ext_ack *extack)
+			      struct netlink_ext_ack *extack,
+			      unsigned int validate)
 {
 	const struct nlattr *entry;
 	int rem;
@@ -80,8 +87,8 @@ static int nla_validate_array(const struct nlattr *head, int len, int maxtype,
 			return -ERANGE;
 		}
 
-		ret = nla_validate(nla_data(entry), nla_len(entry),
-				   maxtype, policy, extack);
+		ret = __nla_validate(nla_data(entry), nla_len(entry),
+				     maxtype, policy, validate, extack);
 		if (ret < 0)
 			return ret;
 	}
@@ -148,13 +155,17 @@ static int nla_validate_int_range(const struct nla_policy *pt,
 }
 
 static int validate_nla(const struct nlattr *nla, int maxtype,
-			const struct nla_policy *policy,
+			const struct nla_policy *policy, unsigned int validate,
 			struct netlink_ext_ack *extack)
 {
+	u16 strict_start_type = policy[0].strict_start_type;
 	const struct nla_policy *pt;
 	int minlen = 0, attrlen = nla_len(nla), type = nla_type(nla);
 	int err = -ERANGE;
 
+	if (strict_start_type && type >= strict_start_type)
+		validate |= NL_VALIDATE_STRICT;
+
 	if (type <= 0 || type > maxtype)
 		return 0;
 
@@ -166,6 +177,26 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
 	    (pt->type == NLA_EXACT_LEN_WARN && attrlen != pt->len)) {
 		pr_warn_ratelimited("netlink: '%s': attribute type %d has an invalid length.\n",
 				    current->comm, type);
+		if (validate & NL_VALIDATE_STRICT_ATTRS) {
+			NL_SET_ERR_MSG_ATTR(extack, nla,
+					    "invalid attribute length");
+			return -EINVAL;
+		}
+	}
+
+	if (validate & NL_VALIDATE_NESTED) {
+		if ((pt->type == NLA_NESTED || pt->type == NLA_NESTED_ARRAY) &&
+		    !(nla->nla_type & NLA_F_NESTED)) {
+			NL_SET_ERR_MSG_ATTR(extack, nla,
+					    "NLA_F_NESTED is missing");
+			return -EINVAL;
+		}
+		if (pt->type != NLA_NESTED && pt->type != NLA_NESTED_ARRAY &&
+		    pt->type != NLA_UNSPEC && (nla->nla_type & NLA_F_NESTED)) {
+			NL_SET_ERR_MSG_ATTR(extack, nla,
+					    "NLA_F_NESTED not expected");
+			return -EINVAL;
+		}
 	}
 
 	switch (pt->type) {
@@ -238,8 +269,9 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
 		if (attrlen < NLA_HDRLEN)
 			goto out_err;
 		if (pt->validation_data) {
-			err = nla_validate(nla_data(nla), nla_len(nla), pt->len,
-					   pt->validation_data, extack);
+			err = __nla_validate(nla_data(nla), nla_len(nla), pt->len,
+					     pt->validation_data, validate,
+					     extack);
 			if (err < 0) {
 				/*
 				 * return directly to preserve the inner
@@ -262,7 +294,7 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
 
 			err = nla_validate_array(nla_data(nla), nla_len(nla),
 						 pt->len, pt->validation_data,
-						 extack);
+						 extack, validate);
 			if (err < 0) {
 				/*
 				 * return directly to preserve the inner
@@ -272,10 +304,23 @@ static int validate_nla(const struct nlattr *nla, int maxtype,
 			}
 		}
 		break;
+
+	case NLA_UNSPEC:
+		if (validate & NL_VALIDATE_UNSPEC) {
+			NL_SET_ERR_MSG_ATTR(extack, nla,
+					    "Unsupported attribute");
+			return -EINVAL;
+		}
+		/* fall through */
+	case NLA_MIN_LEN:
+		if (attrlen < pt->len)
+			goto out_err;
+		break;
+
 	default:
 		if (pt->len)
 			minlen = pt->len;
-		else if (pt->type != NLA_UNSPEC)
+		else
 			minlen = nla_attr_minlen[pt->type];
 
 		if (attrlen < minlen)
@@ -309,25 +354,90 @@ out_err:
 	return err;
 }
 
-int backport_nla_validate(const struct nlattr *head, int len, int maxtype,
-			  const struct nla_policy *policy,
-			  struct netlink_ext_ack *extack)
+static int __nla_validate_parse(const struct nlattr *head, int len, int maxtype,
+				const struct nla_policy *policy,
+				unsigned int validate,
+				struct netlink_ext_ack *extack,
+				struct nlattr **tb)
 {
 	const struct nlattr *nla;
 	int rem;
 
+	if (tb)
+		memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
+
 	nla_for_each_attr(nla, head, len, rem) {
-		int err = validate_nla(nla, maxtype, policy, extack);
+		u16 type = nla_type(nla);
 
-		if (err < 0)
-			return err;
+		if (type == 0 || type > maxtype) {
+			if (validate & NL_VALIDATE_MAXTYPE) {
+				NL_SET_ERR_MSG_ATTR(extack, nla,
+						    "Unknown attribute type");
+				return -EINVAL;
+			}
+			continue;
+		}
+		if (policy) {
+			int err = validate_nla(nla, maxtype, policy,
+					       validate, extack);
+
+			if (err < 0)
+				return err;
+		}
+
+		if (tb)
+			tb[type] = (struct nlattr *)nla;
+	}
+
+	if (unlikely(rem > 0)) {
+		pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
+				    rem, current->comm);
+		NL_SET_ERR_MSG(extack, "bytes leftover after parsing attributes");
+		if (validate & NL_VALIDATE_TRAILING)
+			return -EINVAL;
 	}
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(backport_nla_validate);
 
-int backport_nla_policy_len(const struct nla_policy *p, int n)
+/**
+ * __nla_validate - Validate a stream of attributes
+ * @head: head of attribute stream
+ * @len: length of attribute stream
+ * @maxtype: maximum attribute type to be expected
+ * @policy: validation policy
+ * @validate: validation strictness
+ * @extack: extended ACK report struct
+ *
+ * Validates all attributes in the specified attribute stream against the
+ * specified policy. Validation depends on the validate flags passed, see
+ * &enum netlink_validation for more details on that.
+ * See documenation of struct nla_policy for more details.
+ *
+ * Returns 0 on success or a negative error code.
+ */
+int __nla_validate(const struct nlattr *head, int len, int maxtype,
+		   const struct nla_policy *policy, unsigned int validate,
+		   struct netlink_ext_ack *extack)
+{
+	return __nla_validate_parse(head, len, maxtype, policy, validate,
+				    extack, NULL);
+}
+EXPORT_SYMBOL(__nla_validate);
+
+/**
+ * nla_policy_len - Determin the max. length of a policy
+ * @policy: policy to use
+ * @n: number of policies
+ *
+ * Determines the max. length of the policy.  It is currently used
+ * to allocated Netlink buffers roughly the size of the actual
+ * message.
+ *
+ * Returns 0 on success or a negative error code.
+ */
+int
+nla_policy_len(const struct nla_policy *p, int n)
 {
 	int i, len = 0;
 
@@ -342,38 +452,30 @@ int backport_nla_policy_len(const struct nla_policy *p, int n)
 
 	return len;
 }
-EXPORT_SYMBOL_GPL(backport_nla_policy_len);
-
-int backport_nla_parse(struct nlattr **tb, int maxtype,
-		       const struct nlattr *head,
-		       int len, const struct nla_policy *policy,
-		       struct netlink_ext_ack *extack)
+EXPORT_SYMBOL(nla_policy_len);
+
+/**
+ * __nla_parse - Parse a stream of attributes into a tb buffer
+ * @tb: destination array with maxtype+1 elements
+ * @maxtype: maximum attribute type to be expected
+ * @head: head of attribute stream
+ * @len: length of attribute stream
+ * @policy: validation policy
+ * @validate: validation strictness
+ * @extack: extended ACK pointer
+ *
+ * Parses a stream of attributes and stores a pointer to each attribute in
+ * the tb array accessible via the attribute type.
+ * Validation is controlled by the @validate parameter.
+ *
+ * Returns 0 on success or a negative error code.
+ */
+int __nla_parse(struct nlattr **tb, int maxtype,
+		const struct nlattr *head, int len,
+		const struct nla_policy *policy, unsigned int validate,
+		struct netlink_ext_ack *extack)
 {
-	const struct nlattr *nla;
-	int rem;
-
-	memset(tb, 0, sizeof(struct nlattr *) * (maxtype + 1));
-
-	nla_for_each_attr(nla, head, len, rem) {
-		u16 type = nla_type(nla);
-
-		if (type > 0 && type <= maxtype) {
-			if (policy) {
-				int err = validate_nla(nla, maxtype, policy,
-						       extack);
-
-				if (err < 0)
-					return err;
-			}
-
-			tb[type] = (struct nlattr *)nla;
-		}
-	}
-
-	if (unlikely(rem > 0))
-		pr_warn_ratelimited("netlink: %d bytes leftover after parsing attributes in process `%s'.\n",
-				    rem, current->comm);
-
-	return 0;
+	return __nla_validate_parse(head, len, maxtype, policy, validate,
+				    extack, tb);
 }
-EXPORT_SYMBOL(backport_nla_parse);
+EXPORT_SYMBOL(__nla_parse);
diff --git a/backport/compat/backport-genetlink.c b/backport/compat/backport-genetlink.c
index 16971ec3..47078589 100644
--- a/backport/compat/backport-genetlink.c
+++ b/backport/compat/backport-genetlink.c
@@ -167,8 +167,15 @@ static int backport_pre_doit(__genl_const struct genl_ops *ops,
 	struct netlink_ext_ack *extack = info->extack;
 #endif
 
-	err = nlmsg_validate(info->nlhdr, GENL_HDRLEN + family->hdrsize,
-			     family->maxattr, ops->policy, extack);
+	if (ops->validate & GENL_DONT_VALIDATE_STRICT)
+		err = nlmsg_validate_deprecated(info->nlhdr,
+						GENL_HDRLEN + family->hdrsize,
+						family->maxattr, family->policy,
+						extack);
+	else
+		err = nlmsg_validate(info->nlhdr, GENL_HDRLEN + family->hdrsize,
+				     family->maxattr, family->policy, extack);
+
 	if (!err && family->pre_doit)
 		err = family->pre_doit(ops, skb, info);
 
@@ -230,11 +237,15 @@ int backport_genl_register_family(struct genl_family *family)
 	 * memory layout isn't compatible with the old version
 	 */
 	for (i = 0; i < family->n_ops; i++) {
-		ops[i].policy = NULL;
 #if LINUX_VERSION_IS_LESS(4,12,0)
 		if (ops[i].doit)
 			ops[i].doit = extack_doit;
 #endif
+/*
+ * TODO: add dumpit redirect (like extack_doit) that will
+ *       make this code honor !GENL_DONT_VALIDATE_DUMP and
+ *       actually validate in this case ...
+ */
 	}
 	/* keep doit/dumpit NULL - that's invalid */
 	ops[family->n_ops].done = (void *)family;
@@ -248,12 +259,13 @@ int backport_genl_register_family(struct genl_family *family)
 #if LINUX_VERSION_IS_GEQ(3,10,0)
 	COPY(parallel_ops);
 #endif
-	family->family.pre_doit = backport_pre_doit;
-	family->family.post_doit = backport_post_doit;
+	/* The casts are OK - we checked everything is the same offset in genl_ops */
+	family->family.pre_doit = (void *)backport_pre_doit;
+	family->family.post_doit = (void *)backport_post_doit;
 	/* attrbuf is output only */
-	family->copy_ops = ops;
+	family->copy_ops = (void *)ops;
 #if LINUX_VERSION_IS_GEQ(3,13,0)
-	family->family.ops = ops;
+	family->family.ops = (void *)ops;
 	COPY(mcgrps);
 	COPY(n_ops);
 	COPY(n_mcgrps);
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 07/18] header: Add backport-include/net/ipv6_stubs.h
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (5 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 06/18] backport: Extend netlink parsing with strict validation Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 08/18] header: Add sdio_retune*() functions Hauke Mehrtens
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

ipv6_stubs.h was added in kernel commit 3616d08bcbb5 ("ipv6: Move ipv6
stubs to a separate header file").
Most of its content is from include/net/addrconf.h, so include that file
indirectly on older kernel versions.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/net/ipv6_stubs.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 backport/backport-include/net/ipv6_stubs.h

diff --git a/backport/backport-include/net/ipv6_stubs.h b/backport/backport-include/net/ipv6_stubs.h
new file mode 100644
index 00000000..7d9a5226
--- /dev/null
+++ b/backport/backport-include/net/ipv6_stubs.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _BACKPORT_IPV6_STUBS_H
+#define _BACKPORT_IPV6_STUBS_H
+
+#if LINUX_VERSION_IS_LESS(5,2,0)
+
+#include <net/addrconf.h>
+
+#else
+#include_next <net/ipv6_stubs.h>
+#endif
+
+#endif	/* _BACKPORT_IPV6_STUBS_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 08/18] header: Add sdio_retune*() functions
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (6 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 07/18] header: Add backport-include/net/ipv6_stubs.h Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 09/18] header: Add HRTIMER_MODE_{ABS,REL}_SOFT Hauke Mehrtens
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

The brcmfmac driver now uses new sdio_retune*() functions. They are
added with kernel 5.2-rc6 and are backported to kernel 4.19.56 and
5.1.15

sdio_retune_hold_now() and sdio_retune_release() should work like in the
upstream kernel, the implementation of mmc_retune_release() and
mmc_retune_hold() was copied to backports into these functions. On
kernel < 4.3 backporting this is not so easy, so just use an empty
implementation there.

It is not possible to backport sdio_retune_crc_disable() and
sdio_retune_crc_enable() because they need an additional member in a
structure, just add an empty implementation.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../backport-include/linux/mmc/sdio_func.h    | 76 +++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/backport/backport-include/linux/mmc/sdio_func.h b/backport/backport-include/linux/mmc/sdio_func.h
index 2d3e92b6..0a67f992 100644
--- a/backport/backport-include/linux/mmc/sdio_func.h
+++ b/backport/backport-include/linux/mmc/sdio_func.h
@@ -7,4 +7,80 @@
 #define dev_to_sdio_func(d)	container_of(d, struct sdio_func, dev)
 #endif
 
+#if LINUX_VERSION_IS_LESS(5,2,0) && \
+    !LINUX_VERSION_IN_RANGE(5,1,15, 5,2,0) && \
+    !LINUX_VERSION_IN_RANGE(4,19,56, 4,20,0)
+    
+#include <linux/mmc/card.h>
+#include <linux/mmc/host.h>
+
+/**
+ *	sdio_retune_hold_now - start deferring retuning requests till release
+ *	@func: SDIO function attached to host
+ *
+ *	This function can be called if it's currently a bad time to do
+ *	a retune of the SDIO card.  Retune requests made during this time
+ *	will be held and we'll actually do the retune sometime after the
+ *	release.
+ *
+ *	This function could be useful if an SDIO card is in a power state
+ *	where it can respond to a small subset of commands that doesn't
+ *	include the retuning command.  Care should be taken when using
+ *	this function since (presumably) the retuning request we might be
+ *	deferring was made for a good reason.
+ *
+ *	This function should be called while the host is claimed.
+ */
+#define sdio_retune_hold_now LINUX_BACKPORT(sdio_retune_hold_now)
+#if LINUX_VERSION_IS_LESS(4,3,0)
+static inline void sdio_retune_hold_now(struct sdio_func *func)
+{
+}
+#else
+static inline void sdio_retune_hold_now(struct sdio_func *func)
+{
+	struct mmc_host *host = func->card->host;
+
+	host->retune_now = 0;
+	host->hold_retune += 1;
+}
+#endif /* < 4.3 */
+
+/**
+ *	sdio_retune_release - signal that it's OK to retune now
+ *	@func: SDIO function attached to host
+ *
+ *	This is the complement to sdio_retune_hold_now().  Calling this
+ *	function won't make a retune happen right away but will allow
+ *	them to be scheduled normally.
+ *
+ *	This function should be called while the host is claimed.
+ */
+#define sdio_retune_release LINUX_BACKPORT(sdio_retune_release)
+#if LINUX_VERSION_IS_LESS(4,3,0)
+static inline void sdio_retune_release(struct sdio_func *func)
+{
+}
+#else
+static inline void sdio_retune_release(struct sdio_func *func)
+{
+	struct mmc_host *host = func->card->host;
+
+	if (host->hold_retune)
+		host->hold_retune -= 1;
+	else
+		WARN_ON(1);
+}
+#endif
+
+#define sdio_retune_crc_disable LINUX_BACKPORT(sdio_retune_crc_disable)
+static inline void sdio_retune_crc_disable(struct sdio_func *func)
+{
+}
+#define sdio_retune_crc_enable LINUX_BACKPORT(sdio_retune_crc_enable)
+static inline void sdio_retune_crc_enable(struct sdio_func *func)
+{
+}
+#endif /* < 5.2 */
+
 #endif /* __BACKPORT_MMC_SDIO_FUNC_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 09/18] header: Add HRTIMER_MODE_{ABS,REL}_SOFT
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (7 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 08/18] header: Add sdio_retune*() functions Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 10/18] patch: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

mac80211_hwsim uses HRTIMER_MODE_ABS_SOFT and HRTIMER_MODE_REL_SOFT now.
These enum entries were added in commit 98ecadd4305d ("hrtimer: Add
clock bases and hrtimer mode for softirq context") in kernel 4.16.
This will execute the timers in hard interrupt context and not in soft
interrupt context like intended.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/hrtimer.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)
 create mode 100644 backport/backport-include/linux/hrtimer.h

diff --git a/backport/backport-include/linux/hrtimer.h b/backport/backport-include/linux/hrtimer.h
new file mode 100644
index 00000000..1152a58e
--- /dev/null
+++ b/backport/backport-include/linux/hrtimer.h
@@ -0,0 +1,13 @@
+#ifndef __BACKPORT_LINUX_HRTIMER_H
+#define __BACKPORT_LINUX_HRTIMER_H
+#include <linux/version.h>
+#include_next <linux/hrtimer.h>
+
+#if LINUX_VERSION_IS_LESS(4,16,0)
+
+#define HRTIMER_MODE_ABS_SOFT HRTIMER_MODE_ABS
+#define HRTIMER_MODE_REL_SOFT HRTIMER_MODE_REL
+
+#endif /* < 4.16 */
+
+#endif /* __BACKPORT_LINUX_HRTIMER_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 10/18] patch: Remove usage of DMI_PRODUCT_SKU
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (8 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 09/18] header: Add HRTIMER_MODE_{ABS,REL}_SOFT Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 11/18] header: Make napi_complete_done() return bool Hauke Mehrtens
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

DMI_PRODUCT_SKU was added in kernel 4.18, do not use it on older kernel
versions.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 patches/0089-unknown-dmi/brcmfmac.patch | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 patches/0089-unknown-dmi/brcmfmac.patch

diff --git a/patches/0089-unknown-dmi/brcmfmac.patch b/patches/0089-unknown-dmi/brcmfmac.patch
new file mode 100644
index 00000000..42f7a772
--- /dev/null
+++ b/patches/0089-unknown-dmi/brcmfmac.patch
@@ -0,0 +1,22 @@
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+@@ -57,7 +57,9 @@ static const struct dmi_system_id dmi_pl
+ 		.matches = {
+ 			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
+ 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
++#if LINUX_VERSION_IS_GEQ(4,18,0)
+ 			DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),
++#endif
+ 			/* also match on somewhat unique bios-version */
+ 			DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
+ 		},
+@@ -68,7 +70,9 @@ static const struct dmi_system_id dmi_pl
+ 		.matches = {
+ 			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
+ 			DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
++#if LINUX_VERSION_IS_GEQ(4,18,0)
+ 			DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),
++#endif
+ 			/* also match on somewhat unique bios-version */
+ 			DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
+ 		},
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 11/18] header: Make napi_complete_done() return bool
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (9 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 10/18] patch: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 12/18] header: add hrtimer_forward() and ns_to_ktime() Hauke Mehrtens
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

In the current kernel napi_complete_done() returns a bool and this is
now used by the mt76 driver. Try to backport this functionality by
doing the check which makes the function return false already in
backports.

This was added in upstream kernel commit 364b6055738b ("net: busy-poll:
return busypolling status to drivers")

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/netdevice.h | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/backport/backport-include/linux/netdevice.h b/backport/backport-include/linux/netdevice.h
index c3e91a0c..76b57e4d 100644
--- a/backport/backport-include/linux/netdevice.h
+++ b/backport/backport-include/linux/netdevice.h
@@ -289,13 +289,21 @@ static inline void u64_stats_init(struct u64_stats_sync *syncp)
 })
 #endif /* netdev_alloc_pcpu_stats */
 
-#if LINUX_VERSION_IS_LESS(3,19,0)
-#define napi_complete_done LINUX_BACKPORT(napi_complete_done)
-static inline void napi_complete_done(struct napi_struct *n, int work_done)
+#if LINUX_VERSION_IS_LESS(4,10,0)
+static inline bool backport_napi_complete_done(struct napi_struct *n, int work_done)
 {
+	if (unlikely(test_bit(NAPI_STATE_NPSVC, &n->state)))
+		return false;
+
+#if LINUX_VERSION_IS_LESS(3,19,0)
 	napi_complete(n);
-}
+#else
+	napi_complete_done(n, work_done);
 #endif /* < 3.19 */
+	return true;
+}
+#define napi_complete_done LINUX_BACKPORT(napi_complete_done)
+#endif /* < 4.10 */
 
 #if LINUX_VERSION_IS_LESS(4,5,0)
 #define netif_tx_napi_add LINUX_BACKPORT(netif_tx_napi_add)
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 12/18] header: add hrtimer_forward() and ns_to_ktime()
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (10 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 11/18] header: Make napi_complete_done() return bool Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 13/18] dependencies: Add MT7615E dependency Hauke Mehrtens
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

ktime_t was converted from the union to s64 in kernel 4.10.
hrtimer_start() was already converted some time ago in backports, now
mac80211_hwsim uses hrtimer_start() together with the newly added
functions.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/interrupt.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/backport/backport-include/linux/interrupt.h b/backport/backport-include/linux/interrupt.h
index ad3cbf66..f7e7134d 100644
--- a/backport/backport-include/linux/interrupt.h
+++ b/backport/backport-include/linux/interrupt.h
@@ -5,6 +5,25 @@
 #include <linux/ktime.h>
 
 #if LINUX_VERSION_IS_LESS(4,10,0)
+
+/* Forward a hrtimer so it expires after now: */
+static inline u64
+backport_hrtimer_forward(struct hrtimer *timer, ktime_t now, s64 interval)
+{
+	ktime_t _interval = { .tv64 = interval };
+
+	return hrtimer_forward(timer, now, _interval);
+}
+#define hrtimer_forward LINUX_BACKPORT(hrtimer_forward)
+
+static inline s64 backport_ns_to_ktime(u64 ns)
+{
+	ktime_t _time = ns_to_ktime(ns);
+
+	return _time.tv64;
+}
+#define ns_to_ktime LINUX_BACKPORT(ns_to_ktime)
+
 static inline void backport_hrtimer_start(struct hrtimer *timer, s64 time,
 					  const enum hrtimer_mode mode)
 {
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 13/18] dependencies: Add MT7615E dependency
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (11 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 12/18] header: add hrtimer_forward() and ns_to_ktime() Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 14/18] patches: rtw88: Add missing include on kernel 3.18 Hauke Mehrtens
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

The MT76 driver does not compile on kernel < 4.2, also add such a
dependency to the new driver MT7615E.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 dependencies | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dependencies b/dependencies
index b2edad81..6d903cd1 100644
--- a/dependencies
+++ b/dependencies
@@ -76,6 +76,7 @@ MT76x0E 4.2
 MT76x2E 4.2
 MT76x2U 4.2
 MT7603E 4.2
+MT7615E 4.2
 
 # select_queue_fallback_t is missing
 RTL8723BS 3.14
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 14/18] patches: rtw88: Add missing include on kernel 3.18
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (12 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 13/18] dependencies: Add MT7615E dependency Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 14/18] " Hauke Mehrtens
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

On kernel 3.18 linux/module.h is not indirectly included in this
driver. On some other kernel version linux/interrupt.h is not
indirectly included, but needed.

This fixes some compile problems in the rtw88 driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../0013-fix-makefile-includes/rtw88.patch    | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 patches/0013-fix-makefile-includes/rtw88.patch

diff --git a/patches/0013-fix-makefile-includes/rtw88.patch b/patches/0013-fix-makefile-includes/rtw88.patch
new file mode 100644
index 00000000..454c9f89
--- /dev/null
+++ b/patches/0013-fix-makefile-includes/rtw88.patch
@@ -0,0 +1,40 @@
+--- a/drivers/net/wireless/realtek/rtw88/main.c
++++ b/drivers/net/wireless/realtek/rtw88/main.c
+@@ -12,6 +12,7 @@
+ #include "reg.h"
+ #include "efuse.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static bool rtw_fw_support_lps;
+ unsigned int rtw_debug_mask;
+--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+@@ -12,6 +12,7 @@
+ #include "mac.h"
+ #include "reg.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static void rtw8822b_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
+ 				     u8 rx_path, bool is_tx2_path);
+--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+@@ -12,6 +12,7 @@
+ #include "mac.h"
+ #include "reg.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static void rtw8822c_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
+ 				     u8 rx_path, bool is_tx2_path);
+--- a/drivers/net/wireless/realtek/rtw88/pci.c
++++ b/drivers/net/wireless/realtek/rtw88/pci.c
+@@ -9,6 +9,7 @@
+ #include "tx.h"
+ #include "rx.h"
+ #include "debug.h"
++#include <linux/interrupt.h>
+ 
+ static u32 rtw_pci_tx_queue_idx_addr[] = {
+ 	[RTW_TX_QUEUE_BK]	= RTK_PCI_TXBD_IDX_BKQ,
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 14/18] rtw88: Add missing include on kernel 3.18
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (13 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 14/18] patches: rtw88: Add missing include on kernel 3.18 Hauke Mehrtens
@ 2019-07-01 21:49 ` " Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 15/18] header: Remove include/net/inet_frag.h Hauke Mehrtens
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

On kernel 3.18 linux/module.h is not indirectly included in this
driover. On some other kernel version linux/interrupt.h is not
indirectly included, but needed.

This fixes some compile problems in the rtw88 driver.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../0013-fix-makefile-includes/rtw88.patch    | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)
 create mode 100644 patches/0013-fix-makefile-includes/rtw88.patch

diff --git a/patches/0013-fix-makefile-includes/rtw88.patch b/patches/0013-fix-makefile-includes/rtw88.patch
new file mode 100644
index 00000000..454c9f89
--- /dev/null
+++ b/patches/0013-fix-makefile-includes/rtw88.patch
@@ -0,0 +1,40 @@
+--- a/drivers/net/wireless/realtek/rtw88/main.c
++++ b/drivers/net/wireless/realtek/rtw88/main.c
+@@ -12,6 +12,7 @@
+ #include "reg.h"
+ #include "efuse.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static bool rtw_fw_support_lps;
+ unsigned int rtw_debug_mask;
+--- a/drivers/net/wireless/realtek/rtw88/rtw8822b.c
++++ b/drivers/net/wireless/realtek/rtw88/rtw8822b.c
+@@ -12,6 +12,7 @@
+ #include "mac.h"
+ #include "reg.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static void rtw8822b_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
+ 				     u8 rx_path, bool is_tx2_path);
+--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
++++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+@@ -12,6 +12,7 @@
+ #include "mac.h"
+ #include "reg.h"
+ #include "debug.h"
++#include <linux/module.h>
+ 
+ static void rtw8822c_config_trx_mode(struct rtw_dev *rtwdev, u8 tx_path,
+ 				     u8 rx_path, bool is_tx2_path);
+--- a/drivers/net/wireless/realtek/rtw88/pci.c
++++ b/drivers/net/wireless/realtek/rtw88/pci.c
+@@ -9,6 +9,7 @@
+ #include "tx.h"
+ #include "rx.h"
+ #include "debug.h"
++#include <linux/interrupt.h>
+ 
+ static u32 rtw_pci_tx_queue_idx_addr[] = {
+ 	[RTW_TX_QUEUE_BK]	= RTK_PCI_TXBD_IDX_BKQ,
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 15/18] header: Remove include/net/inet_frag.h
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (14 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 14/18] " Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 16/18] defconfig: update wifi defconfig Hauke Mehrtens
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

The functions provided by include/net/inet_frag.h are not used by any
code in backports any more and this file causes compile warnings
with kernel 3.16.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/net/inet_frag.h | 76 -----------------------
 backport/compat/compat-3.9.c              | 12 ----
 2 files changed, 88 deletions(-)
 delete mode 100644 backport/backport-include/net/inet_frag.h

diff --git a/backport/backport-include/net/inet_frag.h b/backport/backport-include/net/inet_frag.h
deleted file mode 100644
index f37b8a5b..00000000
--- a/backport/backport-include/net/inet_frag.h
+++ /dev/null
@@ -1,76 +0,0 @@
-#ifndef __BACKPORT__NET_FRAG_H__
-#define __BACKPORT__NET_FRAG_H__
-#include_next <net/inet_frag.h>
-#include <linux/version.h>
-
-#if LINUX_VERSION_IS_LESS(3,9,0)
-/* Memory Tracking Functions. */
-#define frag_mem_limit LINUX_BACKPORT(frag_mem_limit)
-static inline int frag_mem_limit(struct netns_frags *nf)
-{
-	return atomic_read(&nf->mem);
-}
-
-#define init_frag_mem_limit LINUX_BACKPORT(init_frag_mem_limit)
-static inline void init_frag_mem_limit(struct netns_frags *nf)
-{
-	atomic_set(&nf->mem, 0);
-}
-
-#define sum_frag_mem_limit LINUX_BACKPORT(sum_frag_mem_limit)
-static inline int sum_frag_mem_limit(struct netns_frags *nf)
-{
-	return atomic_read(&nf->mem);
-}
-
-#define inet_frag_maybe_warn_overflow LINUX_BACKPORT(inet_frag_maybe_warn_overflow)
-void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
-				   const char *prefix);
-#endif /* LINUX_VERSION_IS_LESS(3,9,0) */
-
-/* the type of the paramater changed with kernel 4.3 */
-#if LINUX_VERSION_IS_LESS(3,9,0) || LINUX_VERSION_IN_RANGE(3,16,51, 3,17,0)
-#define sub_frag_mem_limit LINUX_BACKPORT(sub_frag_mem_limit)
-static inline void sub_frag_mem_limit(struct netns_frags *nf, int i)
-{
-	atomic_sub(i, &nf->mem);
-}
-
-#define add_frag_mem_limit LINUX_BACKPORT(add_frag_mem_limit)
-static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
-{
-	atomic_add(i, &nf->mem);
-}
-#elif LINUX_VERSION_IS_LESS(4,3,0)
-#define sub_frag_mem_limit LINUX_BACKPORT(sub_frag_mem_limit)
-static inline void sub_frag_mem_limit(struct netns_frags *nf, int i)
-{
-	__percpu_counter_add(&nf->mem, -i, frag_percpu_counter_batch);
-}
-
-#define add_frag_mem_limit LINUX_BACKPORT(add_frag_mem_limit)
-static inline void add_frag_mem_limit(struct netns_frags *nf, int i)
-{
-	__percpu_counter_add(&nf->mem, i, frag_percpu_counter_batch);
-}
-#endif /* LINUX_VERSION_IS_LESS(4,3,0) */
-
-#if LINUX_VERSION_IS_LESS(4,4,0) && \
-    LINUX_VERSION_IS_GEQ(3,9,0)
-#define inet_frags_uninit_net LINUX_BACKPORT(inet_frags_uninit_net)
-static inline void inet_frags_uninit_net(struct netns_frags *nf)
-{
-	percpu_counter_destroy(&nf->mem);
-}
-#endif /* < 4.4 && >= 3.9 */
-
-#if LINUX_VERSION_IS_LESS(4,4,0)
-static inline int backport_inet_frags_init_net(struct netns_frags *nf)
-{
-	inet_frags_init_net(nf);
-	return 0;
-}
-#define inet_frags_init_net LINUX_BACKPORT(inet_frags_init_net)
-#endif /* < 4.4 */
-
-#endif /* __BACKPORT__NET_FRAG_H__ */
diff --git a/backport/compat/compat-3.9.c b/backport/compat/compat-3.9.c
index 93889b55..6975a788 100644
--- a/backport/compat/compat-3.9.c
+++ b/backport/compat/compat-3.9.c
@@ -61,18 +61,6 @@ void eth_commit_mac_addr_change(struct net_device *dev, void *p)
 }
 EXPORT_SYMBOL_GPL(eth_commit_mac_addr_change);
 
-void inet_frag_maybe_warn_overflow(struct inet_frag_queue *q,
-				   const char *prefix)
-{
-	static const char msg[] = "inet_frag_find: Fragment hash bucket"
-		" list length grew over limit " __stringify(INETFRAGS_MAXDEPTH)
-		". Dropping fragment.\n";
-
-	if (PTR_ERR(q) == -ENOBUFS)
-		LIMIT_NETDEBUG(KERN_WARNING "%s%s", prefix, msg);
-}
-EXPORT_SYMBOL_GPL(inet_frag_maybe_warn_overflow);
-
 void __sg_page_iter_start(struct sg_page_iter *piter,
 			  struct scatterlist *sglist, unsigned int nents,
 			  unsigned long pgoffset)
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 16/18] defconfig: update wifi defconfig
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (15 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 15/18] header: Remove include/net/inet_frag.h Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 17/18] header: fix of_get_mac_address() Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 18/18] header: add support for GCC7 and GCC8 Hauke Mehrtens
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

This removes the removed driver CPTCFG_R8822BE and adds the newly added
drivers CPTCFG_MT7603E, CPTCFG_MT7615E and CPTCFG_RTW88

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/defconfigs/wifi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/backport/defconfigs/wifi b/backport/defconfigs/wifi
index 4f6929dd..8f7b9f58 100644
--- a/backport/defconfigs/wifi
+++ b/backport/defconfigs/wifi
@@ -59,8 +59,10 @@ CPTCFG_MAC80211_LEDS=y
 CPTCFG_MAC80211=m
 CPTCFG_MAC80211_MESH=y
 CPTCFG_MT7601U=m
-CPTCFG_MT76x0U=m
+CPTCFG_MT7603E=m
+CPTCFG_MT7615E=m
 CPTCFG_MT76x0E=m
+CPTCFG_MT76x0U=m
 CPTCFG_MT76x2E=m
 CPTCFG_MT76x2U=m
 CPTCFG_MWIFIEX=m
@@ -84,7 +86,6 @@ CPTCFG_PLX_HERMES=m
 CPTCFG_RSI_91X=m
 CPTCFG_QTNFMAC_PCIE=m
 CPTCFG_R8188EU=m
-CPTCFG_R8822BE=m
 CPTCFG_RT2400PCI=m
 CPTCFG_RT2500PCI=m
 CPTCFG_RT2500USB=m
@@ -112,6 +113,7 @@ CPTCFG_RTL8723BS=m
 CPTCFG_RTL8821AE=m
 CPTCFG_RTL8XXXU=m
 CPTCFG_RTLWIFI=m
+CPTCFG_RTW88=m
 CPTCFG_SSB=m
 CPTCFG_SSB_PCMCIAHOST=y
 CPTCFG_SSB_SDIOHOST=y
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 17/18] header: fix of_get_mac_address()
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (16 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 16/18] defconfig: update wifi defconfig Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-01 21:49 ` [PATCH 18/18] header: add support for GCC7 and GCC8 Hauke Mehrtens
  18 siblings, 0 replies; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

The behavior of of_get_mac_address() changed in kernel 5.2, it now
returns an error code and not NULL in case of an error.

This was changed in upstream kernel commit d01f449c008a
("of_net: add NVMEM support to of_get_mac_address")

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/of_net.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/backport/backport-include/linux/of_net.h b/backport/backport-include/linux/of_net.h
index 7f4b688f..18becf5c 100644
--- a/backport/backport-include/linux/of_net.h
+++ b/backport/backport-include/linux/of_net.h
@@ -12,4 +12,20 @@ static inline const void *of_get_mac_address(struct device_node *np)
 #endif
 #endif
 
+/* The behavior of of_get_mac_address() changed in kernel 5.2, it now
+ * returns an error code and not NULL in case of an error.
+ */
+#if LINUX_VERSION_IS_LESS(5,2,0)
+static inline const void *backport_of_get_mac_address(struct device_node *np)
+{
+	const void *mac = of_get_mac_address(np);
+
+	if (!mac)
+		return ERR_PTR(-ENODEV);
+
+	return mac;
+}
+#define of_get_mac_address LINUX_BACKPORT(of_get_mac_address)
+#endif /* < 5.2 */
+
 #endif /* _BP_OF_NET_H */
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 18/18] header: add support for GCC7 and GCC8
  2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
                   ` (17 preceding siblings ...)
  2019-07-01 21:49 ` [PATCH 17/18] header: fix of_get_mac_address() Hauke Mehrtens
@ 2019-07-01 21:49 ` Hauke Mehrtens
  2019-07-02  7:44   ` Johannes Berg
  18 siblings, 1 reply; 21+ messages in thread
From: Hauke Mehrtens @ 2019-07-01 21:49 UTC (permalink / raw)
  To: backports; +Cc: Hauke Mehrtens

Older kernel versions are missing these files and still try to include
them, add them to make compile testing on recent system easier.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/compiler-gcc8.h | 1 +
 backport/backport-include/linux/compiler-gcc9.h | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 backport/backport-include/linux/compiler-gcc8.h
 create mode 100644 backport/backport-include/linux/compiler-gcc9.h

diff --git a/backport/backport-include/linux/compiler-gcc8.h b/backport/backport-include/linux/compiler-gcc8.h
new file mode 100644
index 00000000..9ff99f0d
--- /dev/null
+++ b/backport/backport-include/linux/compiler-gcc8.h
@@ -0,0 +1 @@
+#include <linux/compiler-gccN.h>
diff --git a/backport/backport-include/linux/compiler-gcc9.h b/backport/backport-include/linux/compiler-gcc9.h
new file mode 100644
index 00000000..9ff99f0d
--- /dev/null
+++ b/backport/backport-include/linux/compiler-gcc9.h
@@ -0,0 +1 @@
+#include <linux/compiler-gccN.h>
-- 
2.20.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 18/18] header: add support for GCC7 and GCC8
  2019-07-01 21:49 ` [PATCH 18/18] header: add support for GCC7 and GCC8 Hauke Mehrtens
@ 2019-07-02  7:44   ` Johannes Berg
  0 siblings, 0 replies; 21+ messages in thread
From: Johannes Berg @ 2019-07-02  7:44 UTC (permalink / raw)
  To: Hauke Mehrtens, backports

Typo in the subject - gcc8/9, not 7/8

johannes

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, back to index

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 21:48 [PATCH 00/18] backports: Update for kernel 5.2 Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 01/18] patches: update select queue patches Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 02/18] backport: rcupdate: add rcu_head_init and rcu_head_after_call_rcu Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 03/18] backport: check for failure when allocating ops in genetlink Hauke Mehrtens
2019-07-01 21:48 ` [PATCH 04/18] backport-include: add empty lockdep_map structure in lockdep.h Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 05/18] patches: Make patches apply on top of kernel 5.2-rc6 Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 06/18] backport: Extend netlink parsing with strict validation Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 07/18] header: Add backport-include/net/ipv6_stubs.h Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 08/18] header: Add sdio_retune*() functions Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 09/18] header: Add HRTIMER_MODE_{ABS,REL}_SOFT Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 10/18] patch: Remove usage of DMI_PRODUCT_SKU Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 11/18] header: Make napi_complete_done() return bool Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 12/18] header: add hrtimer_forward() and ns_to_ktime() Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 13/18] dependencies: Add MT7615E dependency Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 14/18] patches: rtw88: Add missing include on kernel 3.18 Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 14/18] " Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 15/18] header: Remove include/net/inet_frag.h Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 16/18] defconfig: update wifi defconfig Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 17/18] header: fix of_get_mac_address() Hauke Mehrtens
2019-07-01 21:49 ` [PATCH 18/18] header: add support for GCC7 and GCC8 Hauke Mehrtens
2019-07-02  7:44   ` Johannes Berg

Backports Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/backports/0 backports/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 backports backports/ https://lore.kernel.org/backports \
		backports@vger.kernel.org
	public-inbox-index backports

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.backports


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git