Merge ~vicamo/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:bug-1884634/fix-build-against-oem-5.6/focal into ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:ubuntu/focal

Proposed by You-Sheng Yang
Status: Merged
Approved by: Timo Aaltonen
Approved revision: cc77d3c32596fdefeec3bed7d55a3d8c95babf4c
Merged at revision: 4adf4cdd4f4b24a56c4414b31b921f12e520dd0e
Proposed branch: ~vicamo/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:bug-1884634/fix-build-against-oem-5.6/focal
Merge into: ~canonical-hwe-team/ubuntu/+source/backport-iwlwifi-dkms/+git/backport-iwlwifi-dkms:ubuntu/focal
Diff against target: 1035 lines (+965/-0)
11 files modified
debian/changelog (+15/-0)
debian/patches/0007-backport-add-genlmsg_parse.patch (+50/-0)
debian/patches/0008-backport-update-include-uapi-linux-pci_regs.h.patch (+108/-0)
debian/patches/0009-NOUPSTREAM-iwlwifi-mvm-use-64-bit-version-of-timespe.patch (+49/-0)
debian/patches/0010-NOUPSTREAM-cfg80211-use-parallel_ops-for-genl.patch (+282/-0)
debian/patches/0011-backports-netlink-fix-nla_validate_nested.patch (+43/-0)
debian/patches/0012-netlink-rename-nl80211_validate_nested-to-nla_valida.patch (+34/-0)
debian/patches/0013-ftrace-Rework-event_create_dir.patch (+125/-0)
debian/patches/0014-nl80211-fix-NL80211_ATTR_FTM_RESPONDER-policy.patch (+39/-0)
debian/patches/0015-NOUPSTREAM-nl80211-pull-in-NLA_POLICY_EXACT_LEN_WARN.patch (+211/-0)
debian/patches/series (+9/-0)
Reviewer Review Type Date Requested Status
Alberto Milone (community) Approve
Timo Aaltonen Approve
Review via email: mp+387731@code.launchpad.net

Commit message

* Fix build against v5.8 kernel (LP: #1884634)
  - backport: add genlmsg_parse()
  - backport: update include/uapi/linux/pci_regs.h
  - [NOUPSTREAM] iwlwifi: mvm: use 64-bit version of timespec
  - [NOUPSTREAM] cfg80211: use parallel_ops for genl
  - backports: netlink: fix nla_validate_nested()
  - netlink: rename nl80211_validate_nested() to nla_validate_nested()
  - ftrace: Rework event_create_dir()
  - nl80211: fix NL80211_ATTR_FTM_RESPONDER policy
  - [NOUPSTREAM] nl80211: pull in NLA_POLICY_EXACT_LEN_WARN() usage

Description of the change

[SRU Justifcation]

[Impact]
When compiled against linux-oem-5.6/linux-5.8 kernels on Focal, backport-iwlwifi-dkms gives numerous errors due to in kernel interface changes and fails the installation.

[Fix]
This backports several patches from upstream backport-iwlwifi, mainline kernel, and backports project.

[Test Case]
Tested build on 5.4.0-52-generic, 5.6.0-1032-oem and 5.8.0-25-generic on Focal. Since the current version 8324 has been marked obsoleted by 5.4 or newer in bug 1863583 and bug 1869587, built modules are not installed currently so no runtime tests are required.

[Regression Potential]
Low. So far backport-iwlwifi-dkms is still marked OBSOLETED_BY=5.4.0, so it has totally no effect in the runtime system. This will only change when future enablements based on LTS series Focal that relies on out-of-tree driver support from this package.

To post a comment you must log in.
Revision history for this message
Timo Aaltonen (tjaalton) wrote :

this got uploaded earlier

review: Approve
Revision history for this message
You-Sheng Yang (vicamo) wrote :

Was rejected due to too much changes while SRU back to Focal. Redo with cherry-picking necessary patches. Still need some more polishing and tests.

Revision history for this message
You-Sheng Yang (vicamo) wrote :

Updated commits to include only necessary changes backported from upstream backport-iwlwifi, mainline kernel, and backports project.

Need review & submit.

Revision history for this message
Alberto Milone (albertomilone) wrote :

It looks good to me. Approved, thanks.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 4aae555..6e485d2 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,18 @@
6+backport-iwlwifi-dkms (8324-0ubuntu3~20.04.2) focal; urgency=medium
7+
8+ * Fix build against v5.8 kernel (LP: #1884634)
9+ - backport: add genlmsg_parse()
10+ - backport: update include/uapi/linux/pci_regs.h
11+ - [NOUPSTREAM] iwlwifi: mvm: use 64-bit version of timespec
12+ - [NOUPSTREAM] cfg80211: use parallel_ops for genl
13+ - backports: netlink: fix nla_validate_nested()
14+ - netlink: rename nl80211_validate_nested() to nla_validate_nested()
15+ - ftrace: Rework event_create_dir()
16+ - nl80211: fix NL80211_ATTR_FTM_RESPONDER policy
17+ - [NOUPSTREAM] nl80211: pull in NLA_POLICY_EXACT_LEN_WARN() usage
18+
19+ -- You-Sheng Yang <vicamo@gmail.com> Mon, 02 Nov 2020 13:55:31 +0000
20+
21 backport-iwlwifi-dkms (8324-0ubuntu3~20.04.1) focal; urgency=medium
22
23 * dkms: stop installing kernel on 5.4 or newer (LP: #1863583)
24diff --git a/debian/patches/0007-backport-add-genlmsg_parse.patch b/debian/patches/0007-backport-add-genlmsg_parse.patch
25new file mode 100644
26index 0000000..c2e385a
27--- /dev/null
28+++ b/debian/patches/0007-backport-add-genlmsg_parse.patch
29@@ -0,0 +1,50 @@
30+From dab7f14acb372b1a0c5f0c8b0b256bbc09f2f362 Mon Sep 17 00:00:00 2001
31+From: Johannes Berg <johannes.berg@intel.com>
32+Date: Fri, 28 Feb 2020 09:17:40 +0100
33+Subject: [PATCH] backport: add genlmsg_parse()
34+
35+We just need to provide our own version of this so that
36+the types match up correctly.
37+
38+While at it, fix the version ifdef comment.
39+
40+type=feature
41+ticket=none
42+
43+Change-Id: Ic7f3b6424b5474b73eb2f9819569118e38e1b479
44+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
45+Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/254152
46+Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
47+x-iwlwifi-stack-dev: da7591716aa2f04b80e987362033452f0e2419b6
48+(cherry picked from commit f207b0f5e770f7f90d8a19fedc9cb72031dd4322)
49+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
50+---
51+ backport-include/net/genetlink.h | 13 ++++++++++++-
52+ 1 file changed, 12 insertions(+), 1 deletion(-)
53+
54+diff --git a/backport-include/net/genetlink.h b/backport-include/net/genetlink.h
55+index e6b78e02a..90ec7a789 100644
56+--- a/backport-include/net/genetlink.h
57++++ b/backport-include/net/genetlink.h
58+@@ -250,6 +250,17 @@ static inline struct nlattr **genl_family_attrbuf(struct genl_family *family)
59+
60+ return family->attrbuf;
61+ }
62+-#endif /* LINUX_VERSION_IS_LESS(4,20,0) */
63++
64++#define genlmsg_parse LINUX_BACKPORT(genlmsg_parse)
65++static inline int genlmsg_parse(const struct nlmsghdr *nlh,
66++ const struct genl_family *family,
67++ struct nlattr *tb[], int maxtype,
68++ const struct nla_policy *policy,
69++ struct netlink_ext_ack *extack)
70++{
71++ return __nlmsg_parse(nlh, family->hdrsize + GENL_HDRLEN, tb, maxtype,
72++ policy, NL_VALIDATE_STRICT, extack);
73++}
74++#endif /* LINUX_VERSION_IS_LESS(5,2) */
75+
76+ #endif /* __BACKPORT_NET_GENETLINK_H */
77+--
78+2.25.1
79+
80diff --git a/debian/patches/0008-backport-update-include-uapi-linux-pci_regs.h.patch b/debian/patches/0008-backport-update-include-uapi-linux-pci_regs.h.patch
81new file mode 100644
82index 0000000..806f8a3
83--- /dev/null
84+++ b/debian/patches/0008-backport-update-include-uapi-linux-pci_regs.h.patch
85@@ -0,0 +1,108 @@
86+From b9ef5cc9944385cafa3c3f9e6bb18be27b3a97f5 Mon Sep 17 00:00:00 2001
87+From: Johannes Berg <johannes.berg@intel.com>
88+Date: Wed, 22 Jan 2020 16:11:01 +0100
89+Subject: [PATCH] backport: update include/uapi/linux/pci_regs.h
90+
91+This file is normally copied during backporting, but until
92+we update from the auto tree, pull this manually in order
93+to be able to compile against recent kernels (5.5-rc) on
94+which linux/pci.h requires PCI_STD_NUM_BARS from here.
95+
96+type=feature
97+ticket=none
98+
99+Change-Id: Ia8c75520ae2f937c75fcc97b760e54fc957a49bf
100+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
101+Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/250174
102+Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
103+Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
104+x-iwlwifi-stack-dev: 86a15998a19c849821c133ac5df17c99c8bf6d2f
105+(cherry picked from commit 6d34e47b86a11606452ca0002965af854ea530e1)
106+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
107+---
108+ include/uapi/linux/pci_regs.h | 22 +++++++++++++++++++++-
109+ 1 file changed, 21 insertions(+), 1 deletion(-)
110+
111+diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
112+index 27164769d..acb7d2bdb 100644
113+--- a/include/uapi/linux/pci_regs.h
114++++ b/include/uapi/linux/pci_regs.h
115+@@ -34,6 +34,7 @@
116+ * of which the first 64 bytes are standardized as follows:
117+ */
118+ #define PCI_STD_HEADER_SIZEOF 64
119++#define PCI_STD_NUM_BARS 6 /* Number of standard BARs */
120+ #define PCI_VENDOR_ID 0x00 /* 16 bits */
121+ #define PCI_DEVICE_ID 0x02 /* 16 bits */
122+ #define PCI_COMMAND 0x04 /* 16 bits */
123+@@ -528,6 +529,7 @@
124+ #define PCI_EXP_LNKCAP_SLS_5_0GB 0x00000002 /* LNKCAP2 SLS Vector bit 1 */
125+ #define PCI_EXP_LNKCAP_SLS_8_0GB 0x00000003 /* LNKCAP2 SLS Vector bit 2 */
126+ #define PCI_EXP_LNKCAP_SLS_16_0GB 0x00000004 /* LNKCAP2 SLS Vector bit 3 */
127++#define PCI_EXP_LNKCAP_SLS_32_0GB 0x00000005 /* LNKCAP2 SLS Vector bit 4 */
128+ #define PCI_EXP_LNKCAP_MLW 0x000003f0 /* Maximum Link Width */
129+ #define PCI_EXP_LNKCAP_ASPMS 0x00000c00 /* ASPM Support */
130+ #define PCI_EXP_LNKCAP_L0SEL 0x00007000 /* L0s Exit Latency */
131+@@ -556,6 +558,7 @@
132+ #define PCI_EXP_LNKSTA_CLS_5_0GB 0x0002 /* Current Link Speed 5.0GT/s */
133+ #define PCI_EXP_LNKSTA_CLS_8_0GB 0x0003 /* Current Link Speed 8.0GT/s */
134+ #define PCI_EXP_LNKSTA_CLS_16_0GB 0x0004 /* Current Link Speed 16.0GT/s */
135++#define PCI_EXP_LNKSTA_CLS_32_0GB 0x0005 /* Current Link Speed 32.0GT/s */
136+ #define PCI_EXP_LNKSTA_NLW 0x03f0 /* Negotiated Link Width */
137+ #define PCI_EXP_LNKSTA_NLW_X1 0x0010 /* Current Link Width x1 */
138+ #define PCI_EXP_LNKSTA_NLW_X2 0x0020 /* Current Link Width x2 */
139+@@ -589,6 +592,7 @@
140+ #define PCI_EXP_SLTCTL_CCIE 0x0010 /* Command Completed Interrupt Enable */
141+ #define PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
142+ #define PCI_EXP_SLTCTL_AIC 0x00c0 /* Attention Indicator Control */
143++#define PCI_EXP_SLTCTL_ATTN_IND_SHIFT 6 /* Attention Indicator shift */
144+ #define PCI_EXP_SLTCTL_ATTN_IND_ON 0x0040 /* Attention Indicator on */
145+ #define PCI_EXP_SLTCTL_ATTN_IND_BLINK 0x0080 /* Attention Indicator blinking */
146+ #define PCI_EXP_SLTCTL_ATTN_IND_OFF 0x00c0 /* Attention Indicator off */
147+@@ -661,6 +665,7 @@
148+ #define PCI_EXP_LNKCAP2_SLS_5_0GB 0x00000004 /* Supported Speed 5GT/s */
149+ #define PCI_EXP_LNKCAP2_SLS_8_0GB 0x00000008 /* Supported Speed 8GT/s */
150+ #define PCI_EXP_LNKCAP2_SLS_16_0GB 0x00000010 /* Supported Speed 16GT/s */
151++#define PCI_EXP_LNKCAP2_SLS_32_0GB 0x00000020 /* Supported Speed 32GT/s */
152+ #define PCI_EXP_LNKCAP2_CROSSLINK 0x00000100 /* Crosslink supported */
153+ #define PCI_EXP_LNKCTL2 48 /* Link Control 2 */
154+ #define PCI_EXP_LNKCTL2_TLS 0x000f
155+@@ -668,6 +673,9 @@
156+ #define PCI_EXP_LNKCTL2_TLS_5_0GT 0x0002 /* Supported Speed 5GT/s */
157+ #define PCI_EXP_LNKCTL2_TLS_8_0GT 0x0003 /* Supported Speed 8GT/s */
158+ #define PCI_EXP_LNKCTL2_TLS_16_0GT 0x0004 /* Supported Speed 16GT/s */
159++#define PCI_EXP_LNKCTL2_TLS_32_0GT 0x0005 /* Supported Speed 32GT/s */
160++#define PCI_EXP_LNKCTL2_ENTER_COMP 0x0010 /* Enter Compliance */
161++#define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */
162+ #define PCI_EXP_LNKSTA2 50 /* Link Status 2 */
163+ #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 52 /* v2 endpoints with link end here */
164+ #define PCI_EXP_SLTCAP2 52 /* Slot Capabilities 2 */
165+@@ -709,7 +717,9 @@
166+ #define PCI_EXT_CAP_ID_DPC 0x1D /* Downstream Port Containment */
167+ #define PCI_EXT_CAP_ID_L1SS 0x1E /* L1 PM Substates */
168+ #define PCI_EXT_CAP_ID_PTM 0x1F /* Precision Time Measurement */
169+-#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PTM
170++#define PCI_EXT_CAP_ID_DLF 0x25 /* Data Link Feature */
171++#define PCI_EXT_CAP_ID_PL_16GT 0x26 /* Physical Layer 16.0 GT/s */
172++#define PCI_EXT_CAP_ID_MAX PCI_EXT_CAP_ID_PL_16GT
173+
174+ #define PCI_EXT_CAP_DSN_SIZEOF 12
175+ #define PCI_EXT_CAP_MCAST_ENDPOINT_SIZEOF 40
176+@@ -1049,4 +1059,14 @@
177+ #define PCI_L1SS_CTL1_LTR_L12_TH_SCALE 0xe0000000 /* LTR_L1.2_THRESHOLD_Scale */
178+ #define PCI_L1SS_CTL2 0x0c /* Control 2 Register */
179+
180++/* Data Link Feature */
181++#define PCI_DLF_CAP 0x04 /* Capabilities Register */
182++#define PCI_DLF_EXCHANGE_ENABLE 0x80000000 /* Data Link Feature Exchange Enable */
183++
184++/* Physical Layer 16.0 GT/s */
185++#define PCI_PL_16GT_LE_CTRL 0x20 /* Lane Equalization Control Register */
186++#define PCI_PL_16GT_LE_CTRL_DSP_TX_PRESET_MASK 0x0000000F
187++#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_MASK 0x000000F0
188++#define PCI_PL_16GT_LE_CTRL_USP_TX_PRESET_SHIFT 4
189++
190+ #endif /* LINUX_PCI_REGS_H */
191+--
192+2.25.1
193+
194diff --git a/debian/patches/0009-NOUPSTREAM-iwlwifi-mvm-use-64-bit-version-of-timespe.patch b/debian/patches/0009-NOUPSTREAM-iwlwifi-mvm-use-64-bit-version-of-timespe.patch
195new file mode 100644
196index 0000000..10bc138
197--- /dev/null
198+++ b/debian/patches/0009-NOUPSTREAM-iwlwifi-mvm-use-64-bit-version-of-timespe.patch
199@@ -0,0 +1,49 @@
200+From 4c7a42b261a102267e50240f0f5c55d2737f0cd2 Mon Sep 17 00:00:00 2001
201+From: Luca Coelho <luciano.coelho@intel.com>
202+Date: Fri, 27 Mar 2020 10:22:08 +0200
203+Subject: [PATCH] [NOUPSTREAM] iwlwifi: mvm: use 64-bit version of timespec
204+
205+The getnstimeofday() function was removed in v5.4, being replaced by a
206+truly 64-bit version. Replace our only non-upstream usage of
207+getnstimeofday() with the new ktime_get_real_s64() function.
208+
209+type=maint
210+ticket=none
211+
212+Change-Id: I4643aeebe79f1f48b27eab1c1edeb1d7f396f4cb
213+Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
214+Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/257132
215+automatic-review: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
216+Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
217+x-iwlwifi-stack-dev: 6651bda5fd07ca61729d3075acf13f655fc40690
218+(cherry picked from commit a68daa3747f0b0643de3207cb597ffc501c510cd)
219+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
220+---
221+ drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 4 ++--
222+ 1 file changed, 2 insertions(+), 2 deletions(-)
223+
224+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
225+index 43430589d..1941c86da 100644
226+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
227++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
228+@@ -5171,7 +5171,7 @@ static void iwl_mvm_event_bar_rx_callback(struct iwl_mvm *mvm,
229+ static u32 iwl_mvm_send_latency_marker_cmd(struct iwl_mvm *mvm, u32 msrmnt,
230+ u16 seq, u16 tid)
231+ {
232+- struct timespec ts;
233++ struct timespec64 ts;
234+ int ret;
235+ struct iwl_mvm_marker_rsp *rsp;
236+ struct iwl_mvm_marker *marker;
237+@@ -5182,7 +5182,7 @@ static u32 iwl_mvm_send_latency_marker_cmd(struct iwl_mvm *mvm, u32 msrmnt,
238+ u32 cmd_size = sizeof(struct iwl_mvm_marker) +
239+ MARKER_CMD_TX_LAT_PAYLOAD_SIZE * sizeof(u32);
240+
241+- getnstimeofday(&ts);
242++ ktime_get_real_ts64(&ts);
243+
244+ marker = kzalloc(cmd_size, GFP_KERNEL);
245+ if (!marker)
246+--
247+2.25.1
248+
249diff --git a/debian/patches/0010-NOUPSTREAM-cfg80211-use-parallel_ops-for-genl.patch b/debian/patches/0010-NOUPSTREAM-cfg80211-use-parallel_ops-for-genl.patch
250new file mode 100644
251index 0000000..da0d5fe
252--- /dev/null
253+++ b/debian/patches/0010-NOUPSTREAM-cfg80211-use-parallel_ops-for-genl.patch
254@@ -0,0 +1,282 @@
255+From 145f1fcee90302f44989aaef2486e4166525b09a Mon Sep 17 00:00:00 2001
256+From: Johannes Berg <johannes.berg@intel.com>
257+Date: Mon, 29 Jul 2019 16:31:09 +0200
258+Subject: [PATCH] [NOUPSTREAM] cfg80211: use parallel_ops for genl
259+
260+(Imported from upstream commit 50508d941c18 since newer kernels
261+remove genl_family_attrbuf() entirely, so we can compile there)
262+
263+Over time, we really need to get rid of all of our global locking.
264+One of the things needed is to use parallel_ops. This isn't really
265+the most important (RTNL is much more important) but OTOH we just
266+keep adding uses of genl_family_attrbuf() now. Use .parallel_ops to
267+disallow this.
268+
269+type=feature
270+ticket=none
271+
272+Reviewed-By: Denis Kenzior <denkenz@gmail.com>
273+Link: https://lore.kernel.org/r/20190729143109.18683-1-johannes@sipsolutions.net
274+Change-Id: I351cc0de9d6b6d5f5a14aaf4106ef502ee1b3840
275+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
276+Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/250173
277+Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
278+Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
279+x-iwlwifi-stack-dev: b2d6da5d545c1525b3c73cc3bfaeafbcc770ed15
280+(cherry picked from commit 6360027e3331a93d32b259010e5f37d270f6513a)
281+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
282+---
283+ net/wireless/nl80211.c | 108 +++++++++++++++++++++++++++++------------
284+ 1 file changed, 78 insertions(+), 30 deletions(-)
285+
286+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
287+index fa70b33ee..d8480b6b1 100644
288+--- a/net/wireless/nl80211.c
289++++ b/net/wireless/nl80211.c
290+@@ -795,17 +795,25 @@ int nl80211_prepare_wdev_dump(struct netlink_callback *cb,
291+ int err;
292+
293+ if (!cb->args[0]) {
294++ struct nlattr **attrbuf;
295++
296++ attrbuf = kcalloc(NUM_NL80211_ATTR, sizeof(*attrbuf),
297++ GFP_KERNEL);
298++ if (!attrbuf)
299++ return -ENOMEM;
300++
301+ err = nlmsg_parse_deprecated(cb->nlh,
302+ GENL_HDRLEN + nl80211_fam.hdrsize,
303+- genl_family_attrbuf(&nl80211_fam),
304+- nl80211_fam.maxattr,
305++ attrbuf, nl80211_fam.maxattr,
306+ nl80211_policy, NULL);
307+- if (err)
308++ if (err) {
309++ kfree(attrbuf);
310+ return err;
311++ }
312+
313+- *wdev = __cfg80211_wdev_from_attrs(
314+- sock_net(cb->skb->sk),
315+- genl_family_attrbuf(&nl80211_fam));
316++ *wdev = __cfg80211_wdev_from_attrs(sock_net(cb->skb->sk),
317++ attrbuf);
318++ kfree(attrbuf);
319+ if (IS_ERR(*wdev))
320+ return PTR_ERR(*wdev);
321+ *rdev = wiphy_to_rdev((*wdev)->wiphy);
322+@@ -2429,14 +2437,21 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb,
323+ struct netlink_callback *cb,
324+ struct nl80211_dump_wiphy_state *state)
325+ {
326+- struct nlattr **tb = genl_family_attrbuf(&nl80211_fam);
327+- int ret = nlmsg_parse_deprecated(cb->nlh,
328+- GENL_HDRLEN + nl80211_fam.hdrsize,
329+- tb, nl80211_fam.maxattr,
330+- nl80211_policy, NULL);
331++ struct nlattr **tb = kcalloc(NUM_NL80211_ATTR, sizeof(*tb), GFP_KERNEL);
332++ int ret;
333++
334++ if (!tb)
335++ return -ENOMEM;
336++
337++ ret = nlmsg_parse_deprecated(cb->nlh,
338++ GENL_HDRLEN + nl80211_fam.hdrsize,
339++ tb, nl80211_fam.maxattr,
340++ nl80211_policy, NULL);
341+ /* ignore parse errors for backward compatibility */
342+- if (ret)
343+- return 0;
344++ if (ret) {
345++ ret = 0;
346++ goto out;
347++ }
348+
349+ state->split = tb[NL80211_ATTR_SPLIT_WIPHY_DUMP];
350+ if (tb[NL80211_ATTR_WIPHY])
351+@@ -2449,8 +2464,10 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb,
352+ int ifidx = nla_get_u32(tb[NL80211_ATTR_IFINDEX]);
353+
354+ netdev = __dev_get_by_index(sock_net(skb->sk), ifidx);
355+- if (!netdev)
356+- return -ENODEV;
357++ if (!netdev) {
358++ ret = -ENODEV;
359++ goto out;
360++ }
361+ if (netdev->ieee80211_ptr) {
362+ rdev = wiphy_to_rdev(
363+ netdev->ieee80211_ptr->wiphy);
364+@@ -2458,7 +2475,10 @@ static int nl80211_dump_wiphy_parse(struct sk_buff *skb,
365+ }
366+ }
367+
368+- return 0;
369++ ret = 0;
370++out:
371++ kfree(tb);
372++ return ret;
373+ }
374+
375+ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
376+@@ -8774,7 +8794,7 @@ static int nl80211_send_survey(struct sk_buff *msg, u32 portid, u32 seq,
377+
378+ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
379+ {
380+- struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
381++ struct nlattr **attrbuf;
382+ struct survey_info survey;
383+ struct cfg80211_registered_device *rdev;
384+ struct wireless_dev *wdev;
385+@@ -8782,6 +8802,10 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
386+ int res;
387+ bool radio_stats;
388+
389++ attrbuf = kcalloc(NUM_NL80211_ATTR, sizeof(*attrbuf), GFP_KERNEL);
390++ if (!attrbuf)
391++ return -ENOMEM;
392++
393+ rtnl_lock();
394+ res = nl80211_prepare_wdev_dump(cb, &rdev, &wdev);
395+ if (res)
396+@@ -8826,6 +8850,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
397+ cb->args[2] = survey_idx;
398+ res = skb->len;
399+ out_err:
400++ kfree(attrbuf);
401+ rtnl_unlock();
402+ return res;
403+ }
404+@@ -9690,6 +9715,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
405+ struct netlink_callback *cb)
406+ {
407+ struct cfg80211_registered_device *rdev;
408++ struct nlattr **attrbuf = NULL;
409+ int err;
410+ long phy_idx;
411+ void *data = NULL;
412+@@ -9710,7 +9736,12 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
413+ goto out_err;
414+ }
415+ } else {
416+- struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
417++ attrbuf = kcalloc(NUM_NL80211_ATTR, sizeof(*attrbuf),
418++ GFP_KERNEL);
419++ if (!attrbuf) {
420++ err = -ENOMEM;
421++ goto out_err;
422++ }
423+
424+ err = nlmsg_parse_deprecated(cb->nlh,
425+ GENL_HDRLEN + nl80211_fam.hdrsize,
426+@@ -9777,6 +9808,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
427+ /* see above */
428+ cb->args[0] = phy_idx + 1;
429+ out_err:
430++ kfree(attrbuf);
431+ rtnl_unlock();
432+ return err;
433+ }
434+@@ -13140,7 +13172,7 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
435+ struct cfg80211_registered_device **rdev,
436+ struct wireless_dev **wdev)
437+ {
438+- struct nlattr **attrbuf = genl_family_attrbuf(&nl80211_fam);
439++ struct nlattr **attrbuf;
440+ u32 vid, subcmd;
441+ unsigned int i;
442+ int vcmd_idx = -1;
443+@@ -13171,24 +13203,32 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
444+ return 0;
445+ }
446+
447++ attrbuf = kcalloc(NUM_NL80211_ATTR, sizeof(*attrbuf), GFP_KERNEL);
448++ if (!attrbuf)
449++ return -ENOMEM;
450++
451+ err = nlmsg_parse_deprecated(cb->nlh,
452+ GENL_HDRLEN + nl80211_fam.hdrsize,
453+ attrbuf, nl80211_fam.maxattr,
454+ nl80211_policy, NULL);
455+ if (err)
456+- return err;
457++ goto out;
458+
459+ if (!attrbuf[NL80211_ATTR_VENDOR_ID] ||
460+- !attrbuf[NL80211_ATTR_VENDOR_SUBCMD])
461+- return -EINVAL;
462++ !attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
463++ err = -EINVAL;
464++ goto out;
465++ }
466+
467+ *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk), attrbuf);
468+ if (IS_ERR(*wdev))
469+ *wdev = NULL;
470+
471+ *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk), attrbuf);
472+- if (IS_ERR(*rdev))
473+- return PTR_ERR(*rdev);
474++ if (IS_ERR(*rdev)) {
475++ err = PTR_ERR(*rdev);
476++ goto out;
477++ }
478+
479+ vid = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_ID]);
480+ subcmd = nla_get_u32(attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
481+@@ -13201,15 +13241,19 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
482+ if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd)
483+ continue;
484+
485+- if (!vcmd->dumpit)
486+- return -EOPNOTSUPP;
487++ if (!vcmd->dumpit) {
488++ err = -EOPNOTSUPP;
489++ goto out;
490++ }
491+
492+ vcmd_idx = i;
493+ break;
494+ }
495+
496+- if (vcmd_idx < 0)
497+- return -EOPNOTSUPP;
498++ if (vcmd_idx < 0) {
499++ err = -EOPNOTSUPP;
500++ goto out;
501++ }
502+
503+ if (attrbuf[NL80211_ATTR_VENDOR_DATA]) {
504+ data = nla_data(attrbuf[NL80211_ATTR_VENDOR_DATA]);
505+@@ -13220,7 +13264,7 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
506+ attrbuf[NL80211_ATTR_VENDOR_DATA],
507+ genl_callback_extack(cb));
508+ if (err)
509+- return err;
510++ goto out;
511+ }
512+
513+ /* 0 is the first index - add 1 to parse only once */
514+@@ -13232,7 +13276,10 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
515+ cb->args[4] = data_len;
516+
517+ /* keep rtnl locked in successful case */
518+- return 0;
519++ err = 0;
520++out:
521++ kfree(attrbuf);
522++ return err;
523+ }
524+
525+ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
526+@@ -14927,6 +14974,7 @@ static struct genl_family nl80211_fam __genl_ro_after_init = {
527+ .n_ops = ARRAY_SIZE(nl80211_ops),
528+ .mcgrps = nl80211_mcgrps,
529+ .n_mcgrps = ARRAY_SIZE(nl80211_mcgrps),
530++ .parallel_ops = true,
531+ };
532+
533+ /* notification functions */
534+--
535+2.25.1
536+
537diff --git a/debian/patches/0011-backports-netlink-fix-nla_validate_nested.patch b/debian/patches/0011-backports-netlink-fix-nla_validate_nested.patch
538new file mode 100644
539index 0000000..011f8da
540--- /dev/null
541+++ b/debian/patches/0011-backports-netlink-fix-nla_validate_nested.patch
542@@ -0,0 +1,43 @@
543+From: Johannes Berg <johannes.berg@intel.com>
544+Date: Thu, 12 Mar 2020 16:59:13 +0100
545+Subject: backports: netlink: fix nla_validate_nested()
546+
547+I had accidentally named this nl80211_validate_nested(),
548+and it got renamed in 5.6.
549+
550+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
551+(cherry picked from commit f1708ac5643a1decf36ca92ba0644397df5da1f9
552+https://git.kernel.org/pub/scm/linux/kernel/git/backports/backports.git)
553+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
554+---
555+ backport-include/net/netlink.h | 12 ++++++------
556+ 1 file changed, 6 insertions(+), 6 deletions(-)
557+
558+diff --git a/backport-include/net/netlink.h b/backport-include/net/netlink.h
559+index 9a5c270..942217e 100644
560+--- a/backport-include/net/netlink.h
561++++ b/backport-include/net/netlink.h
562+@@ -266,17 +266,17 @@ nla_validate_nested_deprecated(const struct nlattr *start, int maxtype,
563+ }
564+ #endif /* < 5.2 */
565+
566+-#if LINUX_VERSION_IS_LESS(5,3,0)
567+-#define nl80211_validate_nested LINUX_BACKPORT(nl80211_validate_nested)
568++#if LINUX_VERSION_IS_LESS(5,6,0)
569++#define nla_validate_nested LINUX_BACKPORT(nla_validate_nested)
570+ static inline int
571+-nl80211_validate_nested(const struct nlattr *start, int maxtype,
572+- const struct nla_policy *policy,
573+- struct netlink_ext_ack *extack)
574++nla_validate_nested(const struct nlattr *start, int maxtype,
575++ const struct nla_policy *policy,
576++ struct netlink_ext_ack *extack)
577+ {
578+ return __nla_validate_nested(start, maxtype, policy,
579+ NL_VALIDATE_STRICT, extack);
580+ }
581+-#endif /* < 5.3 */
582++#endif /* < 5.6 */
583+
584+ #if LINUX_VERSION_IS_LESS(5,1,0)
585+ #undef NLA_POLICY_NESTED
586diff --git a/debian/patches/0012-netlink-rename-nl80211_validate_nested-to-nla_valida.patch b/debian/patches/0012-netlink-rename-nl80211_validate_nested-to-nla_valida.patch
587new file mode 100644
588index 0000000..6de3bcf
589--- /dev/null
590+++ b/debian/patches/0012-netlink-rename-nl80211_validate_nested-to-nla_valida.patch
591@@ -0,0 +1,34 @@
592+From: Michal Kubecek <mkubecek@suse.cz>
593+Date: Wed, 11 Dec 2019 10:58:19 +0100
594+Subject: netlink: rename nl80211_validate_nested() to nla_validate_nested()
595+
596+Function nl80211_validate_nested() is not specific to nl80211, it's
597+a counterpart to nla_validate_nested_deprecated() with strict validation.
598+For consistency with other validation and parse functions, rename it to
599+nla_validate_nested().
600+
601+Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
602+Acked-by: Jiri Pirko <jiri@mellanox.com>
603+Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
604+Signed-off-by: David S. Miller <davem@davemloft.net>
605+(backported from commit 32d5109a9d864aea3981f0b5ea736eee4e11b42a
606+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
607+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
608+---
609+ net/wireless/nl80211.c | 3 +--
610+ 1 file changed, 1 insertion(+), 2 deletions(-)
611+
612+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
613+index d8480b6..702a269 100644
614+--- a/net/wireless/nl80211.c
615++++ b/net/wireless/nl80211.c
616+@@ -13088,8 +13088,7 @@ static int nl80211_vendor_check_policy(const struct wiphy_vendor_command *vcmd,
617+ return -EINVAL;
618+ }
619+
620+- return nl80211_validate_nested(attr, vcmd->maxattr, vcmd->policy,
621+- extack);
622++ return nla_validate_nested(attr, vcmd->maxattr, vcmd->policy, extack);
623+ }
624+
625+ static int nl80211_vendor_cmd(struct sk_buff *skb, struct genl_info *info)
626diff --git a/debian/patches/0013-ftrace-Rework-event_create_dir.patch b/debian/patches/0013-ftrace-Rework-event_create_dir.patch
627new file mode 100644
628index 0000000..4d42878
629--- /dev/null
630+++ b/debian/patches/0013-ftrace-Rework-event_create_dir.patch
631@@ -0,0 +1,125 @@
632+From f992b8d650c313c7788f287583c323531244abc7 Mon Sep 17 00:00:00 2001
633+From: Peter Zijlstra <peterz@infradead.org>
634+Date: Thu, 24 Oct 2019 22:26:59 +0200
635+Subject: [PATCH] ftrace: Rework event_create_dir()
636+
637+Rework event_create_dir() to use an array of static data instead of
638+function pointers where possible.
639+
640+The problem is that it would call the function pointer on module load
641+before parse_args(), possibly even before jump_labels were initialized.
642+Luckily the generated functions don't use jump_labels but it still seems
643+fragile. It also gets in the way of changing when we make the module map
644+executable.
645+
646+The generated function are basically calling trace_define_field() with a
647+bunch of static arguments. So instead of a function, capture these
648+arguments in a static array, avoiding the function call.
649+
650+Now there are a number of cases where the fields are dynamic (syscall
651+arguments, kprobes and uprobes), in which case a static array does not
652+work, for these we preserve the function call. Luckily all these cases
653+are not related to modules and so we can retain the function call for
654+them.
655+
656+Also fix up all broken tracepoint definitions that now generate a
657+compile error.
658+
659+Tested-by: Alexei Starovoitov <ast@kernel.org>
660+Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
661+Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
662+Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
663+Acked-by: Alexei Starovoitov <ast@kernel.org>
664+Cc: Andy Lutomirski <luto@kernel.org>
665+Cc: Borislav Petkov <bp@alien8.de>
666+Cc: Brian Gerst <brgerst@gmail.com>
667+Cc: Denys Vlasenko <dvlasenk@redhat.com>
668+Cc: H. Peter Anvin <hpa@zytor.com>
669+Cc: Linus Torvalds <torvalds@linux-foundation.org>
670+Cc: Peter Zijlstra <peterz@infradead.org>
671+Cc: Steven Rostedt <rostedt@goodmis.org>
672+Cc: Thomas Gleixner <tglx@linutronix.de>
673+Link: https://lkml.kernel.org/r/20191111132458.342979914@infradead.org
674+Signed-off-by: Ingo Molnar <mingo@kernel.org>
675+(backported from commit 04ae87a52074e2d448fc66143f1bd2c7d694d2b9
676+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)
677+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
678+---
679+ net/mac80211/trace.h | 28 ++++++++++++++--------------
680+ net/wireless/trace.h | 4 ++--
681+ 2 files changed, 16 insertions(+), 16 deletions(-)
682+
683+diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
684+index 009578490..9f034a3c2 100644
685+--- a/net/mac80211/trace.h
686++++ b/net/mac80211/trace.h
687+@@ -408,20 +408,20 @@ TRACE_EVENT(drv_bss_info_changed,
688+ __field(u32, basic_rates)
689+ __array(int, mcast_rate, NUM_NL80211_BANDS)
690+ __field(u16, ht_operation_mode)
691+- __field(s32, cqm_rssi_thold);
692+- __field(s32, cqm_rssi_hyst);
693+- __field(u32, channel_width);
694+- __field(u32, channel_cfreq1);
695++ __field(s32, cqm_rssi_thold)
696++ __field(s32, cqm_rssi_hyst)
697++ __field(u32, channel_width)
698++ __field(u32, channel_cfreq1)
699+ __dynamic_array(u32, arp_addr_list,
700+ info->arp_addr_cnt > IEEE80211_BSS_ARP_ADDR_LIST_LEN ?
701+ IEEE80211_BSS_ARP_ADDR_LIST_LEN :
702+- info->arp_addr_cnt);
703+- __field(int, arp_addr_cnt);
704+- __field(bool, qos);
705+- __field(bool, idle);
706+- __field(bool, ps);
707+- __dynamic_array(u8, ssid, info->ssid_len);
708+- __field(bool, hidden_ssid);
709++ info->arp_addr_cnt)
710++ __field(int, arp_addr_cnt)
711++ __field(bool, qos)
712++ __field(bool, idle)
713++ __field(bool, ps)
714++ __dynamic_array(u8, ssid, info->ssid_len)
715++ __field(bool, hidden_ssid)
716+ __field(int, txpower)
717+ __field(u8, p2p_oppps_ctwindow)
718+ ),
719+@@ -1672,8 +1672,8 @@ TRACE_EVENT(drv_start_ap,
720+ VIF_ENTRY
721+ __field(u8, dtimper)
722+ __field(u16, bcnint)
723+- __dynamic_array(u8, ssid, info->ssid_len);
724+- __field(bool, hidden_ssid);
725++ __dynamic_array(u8, ssid, info->ssid_len)
726++ __field(bool, hidden_ssid)
727+ ),
728+
729+ TP_fast_assign(
730+@@ -1739,7 +1739,7 @@ TRACE_EVENT(drv_join_ibss,
731+ VIF_ENTRY
732+ __field(u8, dtimper)
733+ __field(u16, bcnint)
734+- __dynamic_array(u8, ssid, info->ssid_len);
735++ __dynamic_array(u8, ssid, info->ssid_len)
736+ ),
737+
738+ TP_fast_assign(
739+diff --git a/net/wireless/trace.h b/net/wireless/trace.h
740+index 896b73dc8..3aa5f116e 100644
741+--- a/net/wireless/trace.h
742++++ b/net/wireless/trace.h
743+@@ -2051,8 +2051,8 @@ TRACE_EVENT(rdev_nan_change_conf,
744+ WIPHY_ENTRY
745+ WDEV_ENTRY
746+ __field(u8, master_pref)
747+- __field(u8, bands);
748+- __field(u32, changes);
749++ __field(u8, bands)
750++ __field(u32, changes)
751+ ),
752+ TP_fast_assign(
753+ WIPHY_ASSIGN;
754+--
755+2.27.0
756+
757diff --git a/debian/patches/0014-nl80211-fix-NL80211_ATTR_FTM_RESPONDER-policy.patch b/debian/patches/0014-nl80211-fix-NL80211_ATTR_FTM_RESPONDER-policy.patch
758new file mode 100644
759index 0000000..1b022ef
760--- /dev/null
761+++ b/debian/patches/0014-nl80211-fix-NL80211_ATTR_FTM_RESPONDER-policy.patch
762@@ -0,0 +1,39 @@
763+From c3ed40441774defdec1a38256ef6dae75b5a7a11 Mon Sep 17 00:00:00 2001
764+From: Johannes Berg <johannes.berg@intel.com>
765+Date: Sun, 12 Apr 2020 00:40:30 +0200
766+Subject: [PATCH] nl80211: fix NL80211_ATTR_FTM_RESPONDER policy
767+
768+The nested policy here should be established using the
769+NLA_POLICY_NESTED() macro so the length is properly
770+filled in.
771+
772+Cc: stable@vger.kernel.org
773+Fixes: 81e54d08d9d8 ("cfg80211: support FTM responder configuration/statistics")
774+Link: https://lore.kernel.org/r/20200412004029.9d0722bb56c8.Ie690bfcc4a1a61ff8d8ca7e475d59fcaa52fb2da@changeid
775+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
776+(cherry-picked from commit 0e012b4e4b5ec8e064be3502382579dd0bb43269)
777+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
778+---
779+ net/wireless/nl80211.c | 6 ++----
780+ 1 file changed, 2 insertions(+), 4 deletions(-)
781+
782+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
783+index fa70b33ee..1c988c10f 100644
784+--- a/net/wireless/nl80211.c
785++++ b/net/wireless/nl80211.c
786+@@ -598,10 +598,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
787+ [NL80211_ATTR_HE_CAPABILITY] = { .type = NLA_BINARY,
788+ .len = NL80211_HE_MAX_CAPABILITY_LEN },
789+
790+- [NL80211_ATTR_FTM_RESPONDER] = {
791+- .type = NLA_NESTED,
792+- .validation_data = nl80211_ftm_responder_policy,
793+- },
794++ [NL80211_ATTR_FTM_RESPONDER] =
795++ NLA_POLICY_NESTED(nl80211_ftm_responder_policy),
796+ [NL80211_ATTR_TIMEOUT] = NLA_POLICY_MIN(NLA_U32, 1),
797+ [NL80211_ATTR_PEER_MEASUREMENTS] =
798+ NLA_POLICY_NESTED(nl80211_pmsr_attr_policy),
799+--
800+2.25.1
801+
802diff --git a/debian/patches/0015-NOUPSTREAM-nl80211-pull-in-NLA_POLICY_EXACT_LEN_WARN.patch b/debian/patches/0015-NOUPSTREAM-nl80211-pull-in-NLA_POLICY_EXACT_LEN_WARN.patch
803new file mode 100644
804index 0000000..13c6281
805--- /dev/null
806+++ b/debian/patches/0015-NOUPSTREAM-nl80211-pull-in-NLA_POLICY_EXACT_LEN_WARN.patch
807@@ -0,0 +1,211 @@
808+From 580b5af2262d5f55ffaeb9b8f265e08b193aa411 Mon Sep 17 00:00:00 2001
809+From: Johannes Berg <johannes.berg@intel.com>
810+Date: Tue, 4 Aug 2020 10:25:29 +0200
811+Subject: [PATCH] [NOUPSTREAM] nl80211: pull in NLA_POLICY_EXACT_LEN_WARN()
812+ usage
813+
814+Pull in the usage of NLA_POLICY_EXACT_LEN_WARN() to get things
815+to work on kernel 5.8 for now, until we finish the merge from
816+there.
817+
818+type=feature
819+ticket=none
820+
821+Change-Id: I86daa00338d40d7770451b327c7e8b9599912cda
822+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
823+Reviewed-on: https://git-amr-3.devtools.intel.com/gerrit/272290
824+Reviewed-by: Ben Ami, Golan <golan.ben.ami@intel.com>
825+Reviewed-by: Luciano Coelho <luciano.coelho@intel.com>
826+Tested-by: ec ger unix iil jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
827+x-iwlwifi-stack-dev: dd1553ab7e2f1e05780a2f6ecfd7a1d0a0d62fa1
828+(backported from commit 132470a283b85d0662206171151967b37fae330b)
829+Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
830+---
831+ net/wireless/nl80211.c | 81 ++++++++++--------------------------------
832+ 1 file changed, 18 insertions(+), 63 deletions(-)
833+
834+diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
835+index fa70b33ee..589036d2d 100644
836+--- a/net/wireless/nl80211.c
837++++ b/net/wireless/nl80211.c
838+@@ -339,11 +339,8 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
839+ [NL80211_ATTR_IFINDEX] = { .type = NLA_U32 },
840+ [NL80211_ATTR_IFNAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ-1 },
841+
842+- [NL80211_ATTR_MAC] = { .type = NLA_EXACT_LEN_WARN, .len = ETH_ALEN },
843+- [NL80211_ATTR_PREV_BSSID] = {
844+- .type = NLA_EXACT_LEN_WARN,
845+- .len = ETH_ALEN
846+- },
847++ [NL80211_ATTR_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
848++ [NL80211_ATTR_PREV_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
849+
850+ [NL80211_ATTR_KEY] = { .type = NLA_NESTED, },
851+ [NL80211_ATTR_KEY_DATA] = { .type = NLA_BINARY,
852+@@ -395,10 +392,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
853+ [NL80211_ATTR_MESH_CONFIG] = { .type = NLA_NESTED },
854+ [NL80211_ATTR_SUPPORT_MESH_AUTH] = { .type = NLA_FLAG },
855+
856+- [NL80211_ATTR_HT_CAPABILITY] = {
857+- .type = NLA_EXACT_LEN_WARN,
858+- .len = NL80211_HT_CAPABILITY_LEN
859+- },
860++ [NL80211_ATTR_HT_CAPABILITY] = NLA_POLICY_EXACT_LEN_WARN(NL80211_HT_CAPABILITY_LEN),
861+
862+ [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 },
863+ [NL80211_ATTR_IE] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
864+@@ -427,10 +421,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
865+ [NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
866+ [NL80211_ATTR_PID] = { .type = NLA_U32 },
867+ [NL80211_ATTR_4ADDR] = { .type = NLA_U8 },
868+- [NL80211_ATTR_PMKID] = {
869+- .type = NLA_EXACT_LEN_WARN,
870+- .len = WLAN_PMKID_LEN
871+- },
872++ [NL80211_ATTR_PMKID] = NLA_POLICY_EXACT_LEN_WARN(WLAN_PMKID_LEN),
873+ [NL80211_ATTR_DURATION] = { .type = NLA_U32 },
874+ [NL80211_ATTR_COOKIE] = { .type = NLA_U64 },
875+ [NL80211_ATTR_TX_RATES] = { .type = NLA_NESTED },
876+@@ -492,10 +483,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
877+ [NL80211_ATTR_WDEV] = { .type = NLA_U64 },
878+ [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
879+ [NL80211_ATTR_AUTH_DATA] = { .type = NLA_BINARY, },
880+- [NL80211_ATTR_VHT_CAPABILITY] = {
881+- .type = NLA_EXACT_LEN_WARN,
882+- .len = NL80211_VHT_CAPABILITY_LEN
883+- },
884++ [NL80211_ATTR_VHT_CAPABILITY] = NLA_POLICY_EXACT_LEN_WARN(NL80211_VHT_CAPABILITY_LEN),
885+ [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
886+ [NL80211_ATTR_P2P_CTWINDOW] = NLA_POLICY_MAX(NLA_U8, 127),
887+ [NL80211_ATTR_P2P_OPPPS] = NLA_POLICY_MAX(NLA_U8, 1),
888+@@ -531,10 +519,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
889+ [NL80211_ATTR_VENDOR_DATA] = { .type = NLA_BINARY },
890+ [NL80211_ATTR_QOS_MAP] = { .type = NLA_BINARY,
891+ .len = IEEE80211_QOS_MAP_LEN_MAX },
892+- [NL80211_ATTR_MAC_HINT] = {
893+- .type = NLA_EXACT_LEN_WARN,
894+- .len = ETH_ALEN
895+- },
896++ [NL80211_ATTR_MAC_HINT] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
897+ [NL80211_ATTR_WIPHY_FREQ_HINT] = { .type = NLA_U32 },
898+ [NL80211_ATTR_TDLS_PEER_CAPABILITY] = { .type = NLA_U32 },
899+ [NL80211_ATTR_SOCKET_OWNER] = { .type = NLA_FLAG },
900+@@ -545,10 +530,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
901+ NLA_POLICY_MAX(NLA_U8, IEEE80211_NUM_UPS - 1),
902+ [NL80211_ATTR_ADMITTED_TIME] = { .type = NLA_U16 },
903+ [NL80211_ATTR_SMPS_MODE] = { .type = NLA_U8 },
904+- [NL80211_ATTR_MAC_MASK] = {
905+- .type = NLA_EXACT_LEN_WARN,
906+- .len = ETH_ALEN
907+- },
908++ [NL80211_ATTR_MAC_MASK] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
909+ [NL80211_ATTR_WIPHY_SELF_MANAGED_REG] = { .type = NLA_FLAG },
910+ [NL80211_ATTR_NETNS_FD] = { .type = NLA_U32 },
911+ [NL80211_ATTR_SCHED_SCAN_DELAY] = { .type = NLA_U32 },
912+@@ -560,21 +542,15 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
913+ [NL80211_ATTR_MU_MIMO_GROUP_DATA] = {
914+ .len = VHT_MUMIMO_GROUPS_DATA_LEN
915+ },
916+- [NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR] = {
917+- .type = NLA_EXACT_LEN_WARN,
918+- .len = ETH_ALEN
919+- },
920++ [NL80211_ATTR_MU_MIMO_FOLLOW_MAC_ADDR] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
921+ [NL80211_ATTR_NAN_MASTER_PREF] = NLA_POLICY_MIN(NLA_U8, 1),
922+ [NL80211_ATTR_BANDS] = { .type = NLA_U32 },
923+ [NL80211_ATTR_NAN_FUNC] = { .type = NLA_NESTED },
924+ [NL80211_ATTR_FILS_KEK] = { .type = NLA_BINARY,
925+ .len = FILS_MAX_KEK_LEN },
926+- [NL80211_ATTR_FILS_NONCES] = {
927+- .type = NLA_EXACT_LEN_WARN,
928+- .len = 2 * FILS_NONCE_LEN
929+- },
930++ [NL80211_ATTR_FILS_NONCES] = NLA_POLICY_EXACT_LEN_WARN(2 * FILS_NONCE_LEN),
931+ [NL80211_ATTR_MULTICAST_TO_UNICAST_ENABLED] = { .type = NLA_FLAG, },
932+- [NL80211_ATTR_BSSID] = { .type = NLA_EXACT_LEN_WARN, .len = ETH_ALEN },
933++ [NL80211_ATTR_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
934+ [NL80211_ATTR_SCHED_SCAN_RELATIVE_RSSI] = { .type = NLA_S8 },
935+ [NL80211_ATTR_SCHED_SCAN_RSSI_ADJUST] = {
936+ .len = sizeof(struct nl80211_bss_select_rssi_adjust)
937+@@ -587,7 +563,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
938+ [NL80211_ATTR_FILS_ERP_NEXT_SEQ_NUM] = { .type = NLA_U16 },
939+ [NL80211_ATTR_FILS_ERP_RRK] = { .type = NLA_BINARY,
940+ .len = FILS_ERP_MAX_RRK_LEN },
941+- [NL80211_ATTR_FILS_CACHE_ID] = { .type = NLA_EXACT_LEN_WARN, .len = 2 },
942++ [NL80211_ATTR_FILS_CACHE_ID] = NLA_POLICY_EXACT_LEN_WARN(2),
943+ [NL80211_ATTR_PMK] = { .type = NLA_BINARY, .len = PMK_MAX_LEN },
944+ [NL80211_ATTR_SCHED_SCAN_MULTI] = { .type = NLA_FLAG },
945+ [NL80211_ATTR_EXTERNAL_AUTH_SUPPORT] = { .type = NLA_FLAG },
946+@@ -652,10 +628,7 @@ static const struct nla_policy
947+ nl80211_wowlan_tcp_policy[NUM_NL80211_WOWLAN_TCP] = {
948+ [NL80211_WOWLAN_TCP_SRC_IPV4] = { .type = NLA_U32 },
949+ [NL80211_WOWLAN_TCP_DST_IPV4] = { .type = NLA_U32 },
950+- [NL80211_WOWLAN_TCP_DST_MAC] = {
951+- .type = NLA_EXACT_LEN_WARN,
952+- .len = ETH_ALEN
953+- },
954++ [NL80211_WOWLAN_TCP_DST_MAC] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
955+ [NL80211_WOWLAN_TCP_SRC_PORT] = { .type = NLA_U16 },
956+ [NL80211_WOWLAN_TCP_DST_PORT] = { .type = NLA_U16 },
957+ [NL80211_WOWLAN_TCP_DATA_PAYLOAD] = { .type = NLA_MIN_LEN, .len = 1 },
958+@@ -685,18 +658,9 @@ nl80211_coalesce_policy[NUM_NL80211_ATTR_COALESCE_RULE] = {
959+ /* policy for GTK rekey offload attributes */
960+ static const struct nla_policy
961+ nl80211_rekey_policy[NUM_NL80211_REKEY_DATA] = {
962+- [NL80211_REKEY_DATA_KEK] = {
963+- .type = NLA_EXACT_LEN_WARN,
964+- .len = NL80211_KEK_LEN,
965+- },
966+- [NL80211_REKEY_DATA_KCK] = {
967+- .type = NLA_EXACT_LEN_WARN,
968+- .len = NL80211_KCK_LEN,
969+- },
970+- [NL80211_REKEY_DATA_REPLAY_CTR] = {
971+- .type = NLA_EXACT_LEN_WARN,
972+- .len = NL80211_REPLAY_CTR_LEN
973+- },
974++ [NL80211_REKEY_DATA_KEK] = NLA_POLICY_EXACT_LEN_WARN(NL80211_KEK_LEN),
975++ [NL80211_REKEY_DATA_KCK] = NLA_POLICY_EXACT_LEN_WARN(NL80211_KCK_LEN),
976++ [NL80211_REKEY_DATA_REPLAY_CTR] = NLA_POLICY_EXACT_LEN_WARN(NL80211_REPLAY_CTR_LEN),
977+ };
978+
979+ static const struct nla_policy
980+@@ -711,10 +675,7 @@ static const struct nla_policy
981+ nl80211_match_policy[NL80211_SCHED_SCAN_MATCH_ATTR_MAX + 1] = {
982+ [NL80211_SCHED_SCAN_MATCH_ATTR_SSID] = { .type = NLA_BINARY,
983+ .len = IEEE80211_MAX_SSID_LEN },
984+- [NL80211_SCHED_SCAN_MATCH_ATTR_BSSID] = {
985+- .type = NLA_EXACT_LEN_WARN,
986+- .len = ETH_ALEN
987+- },
988++ [NL80211_SCHED_SCAN_MATCH_ATTR_BSSID] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
989+ [NL80211_SCHED_SCAN_MATCH_ATTR_RSSI] = { .type = NLA_U32 },
990+ [NL80211_SCHED_SCAN_MATCH_PER_BAND_RSSI] =
991+ NLA_POLICY_NESTED(nl80211_match_band_rssi_policy),
992+@@ -746,10 +707,7 @@ nl80211_nan_func_policy[NL80211_NAN_FUNC_ATTR_MAX + 1] = {
993+ [NL80211_NAN_FUNC_SUBSCRIBE_ACTIVE] = { .type = NLA_FLAG },
994+ [NL80211_NAN_FUNC_FOLLOW_UP_ID] = { .type = NLA_U8 },
995+ [NL80211_NAN_FUNC_FOLLOW_UP_REQ_ID] = { .type = NLA_U8 },
996+- [NL80211_NAN_FUNC_FOLLOW_UP_DEST] = {
997+- .type = NLA_EXACT_LEN_WARN,
998+- .len = ETH_ALEN
999+- },
1000++ [NL80211_NAN_FUNC_FOLLOW_UP_DEST] = NLA_POLICY_EXACT_LEN_WARN(ETH_ALEN),
1001+ [NL80211_NAN_FUNC_CLOSE_RANGE] = { .type = NLA_FLAG },
1002+ [NL80211_NAN_FUNC_TTL] = { .type = NLA_U32 },
1003+ [NL80211_NAN_FUNC_SERVICE_INFO] = { .type = NLA_BINARY,
1004+@@ -4172,10 +4130,7 @@ static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
1005+ .len = NL80211_MAX_SUPP_RATES },
1006+ [NL80211_TXRATE_HT] = { .type = NLA_BINARY,
1007+ .len = NL80211_MAX_SUPP_HT_RATES },
1008+- [NL80211_TXRATE_VHT] = {
1009+- .type = NLA_EXACT_LEN_WARN,
1010+- .len = sizeof(struct nl80211_txrate_vht),
1011+- },
1012++ [NL80211_TXRATE_VHT] = NLA_POLICY_EXACT_LEN_WARN(sizeof(struct nl80211_txrate_vht)),
1013+ [NL80211_TXRATE_GI] = { .type = NLA_U8 },
1014+ };
1015+
1016+--
1017+2.25.1
1018+
1019diff --git a/debian/patches/series b/debian/patches/series
1020index f4462c8..f19b067 100644
1021--- a/debian/patches/series
1022+++ b/debian/patches/series
1023@@ -2,3 +2,12 @@
1024 0002-fix-format-overflow-compile-error-in-kconf-confdata..patch
1025 0005-Makefile.kernel-pass-fno-stack-clash-protection-and-.patch
1026 0006-backport-address-interface-change-in-linux-skbuff.h-.patch
1027+0007-backport-add-genlmsg_parse.patch
1028+0008-backport-update-include-uapi-linux-pci_regs.h.patch
1029+0009-NOUPSTREAM-iwlwifi-mvm-use-64-bit-version-of-timespe.patch
1030+0010-NOUPSTREAM-cfg80211-use-parallel_ops-for-genl.patch
1031+0011-backports-netlink-fix-nla_validate_nested.patch
1032+0012-netlink-rename-nl80211_validate_nested-to-nla_valida.patch
1033+0013-ftrace-Rework-event_create_dir.patch
1034+0014-nl80211-fix-NL80211_ATTR_FTM_RESPONDER-policy.patch
1035+0015-NOUPSTREAM-nl80211-pull-in-NLA_POLICY_EXACT_LEN_WARN.patch

Subscribers

People subscribed via source and target branches