Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/linux-patches:4.19 commit in: /
Date: Sat, 01 Feb 2020 10:30:50
Message-Id: 1580553022.2fcaa12fcd6f3449eaa828d2a68d3c0d7f9202d4.mpagano@gentoo
1 commit: 2fcaa12fcd6f3449eaa828d2a68d3c0d7f9202d4
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 1 10:30:22 2020 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 1 10:30:22 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=2fcaa12f
7
8 Linux patch 4.19.101
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 0000_README | 4 +
13 1100_linux-4.19.101.patch | 2206 +++++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 2210 insertions(+)
15
16 diff --git a/0000_README b/0000_README
17 index 7c99cc6..fcf3d5e 100644
18 --- a/0000_README
19 +++ b/0000_README
20 @@ -439,6 +439,10 @@ Patch: 1099_linux-4.19.100.patch
21 From: https://www.kernel.org
22 Desc: Linux 4.19.100
23
24 +Patch: 1100_linux-4.19.101.patch
25 +From: https://www.kernel.org
26 +Desc: Linux 4.19.101
27 +
28 Patch: 1500_XATTR_USER_PREFIX.patch
29 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
30 Desc: Support for namespace user.pax.* on tmpfs.
31
32 diff --git a/1100_linux-4.19.101.patch b/1100_linux-4.19.101.patch
33 new file mode 100644
34 index 0000000..8304fb2
35 --- /dev/null
36 +++ b/1100_linux-4.19.101.patch
37 @@ -0,0 +1,2206 @@
38 +diff --git a/Makefile b/Makefile
39 +index f1e428271abf..ca186bcc02ba 100644
40 +--- a/Makefile
41 ++++ b/Makefile
42 +@@ -1,7 +1,7 @@
43 + # SPDX-License-Identifier: GPL-2.0
44 + VERSION = 4
45 + PATCHLEVEL = 19
46 +-SUBLEVEL = 100
47 ++SUBLEVEL = 101
48 + EXTRAVERSION =
49 + NAME = "People's Front"
50 +
51 +diff --git a/arch/arc/plat-eznps/Kconfig b/arch/arc/plat-eznps/Kconfig
52 +index 8eff057efcae..ce908e2c5282 100644
53 +--- a/arch/arc/plat-eznps/Kconfig
54 ++++ b/arch/arc/plat-eznps/Kconfig
55 +@@ -7,7 +7,7 @@
56 + menuconfig ARC_PLAT_EZNPS
57 + bool "\"EZchip\" ARC dev platform"
58 + select CPU_BIG_ENDIAN
59 +- select CLKSRC_NPS
60 ++ select CLKSRC_NPS if !PHYS_ADDR_T_64BIT
61 + select EZNPS_GIC
62 + select EZCHIP_NPS_MANAGEMENT_ENET if ETHERNET
63 + help
64 +diff --git a/arch/arm64/kvm/debug.c b/arch/arm64/kvm/debug.c
65 +index 00d422336a45..4e722d73a3c3 100644
66 +--- a/arch/arm64/kvm/debug.c
67 ++++ b/arch/arm64/kvm/debug.c
68 +@@ -112,7 +112,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
69 + void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
70 + {
71 + bool trap_debug = !(vcpu->arch.flags & KVM_ARM64_DEBUG_DIRTY);
72 +- unsigned long mdscr;
73 ++ unsigned long mdscr, orig_mdcr_el2 = vcpu->arch.mdcr_el2;
74 +
75 + trace_kvm_arm_setup_debug(vcpu, vcpu->guest_debug);
76 +
77 +@@ -208,6 +208,10 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
78 + if (vcpu_read_sys_reg(vcpu, MDSCR_EL1) & (DBG_MDSCR_KDE | DBG_MDSCR_MDE))
79 + vcpu->arch.flags |= KVM_ARM64_DEBUG_DIRTY;
80 +
81 ++ /* Write mdcr_el2 changes since vcpu_load on VHE systems */
82 ++ if (has_vhe() && orig_mdcr_el2 != vcpu->arch.mdcr_el2)
83 ++ write_sysreg(vcpu->arch.mdcr_el2, mdcr_el2);
84 ++
85 + trace_kvm_arm_set_dreg32("MDCR_EL2", vcpu->arch.mdcr_el2);
86 + trace_kvm_arm_set_dreg32("MDSCR_EL1", vcpu_read_sys_reg(vcpu, MDSCR_EL1));
87 + }
88 +diff --git a/block/blk-lib.c b/block/blk-lib.c
89 +index 1f196cf0aa5d..0dbc9e2ab9a3 100644
90 +--- a/block/blk-lib.c
91 ++++ b/block/blk-lib.c
92 +@@ -52,15 +52,14 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
93 + if ((sector | nr_sects) & bs_mask)
94 + return -EINVAL;
95 +
96 +- while (nr_sects) {
97 +- unsigned int req_sects = nr_sects;
98 +- sector_t end_sect;
99 ++ if (!nr_sects)
100 ++ return -EINVAL;
101 +
102 +- if (!req_sects)
103 +- goto fail;
104 +- req_sects = min(req_sects, bio_allowed_max_sectors(q));
105 ++ while (nr_sects) {
106 ++ sector_t req_sects = min_t(sector_t, nr_sects,
107 ++ bio_allowed_max_sectors(q));
108 +
109 +- end_sect = sector + req_sects;
110 ++ WARN_ON_ONCE((req_sects << 9) > UINT_MAX);
111 +
112 + bio = next_bio(bio, 0, gfp_mask);
113 + bio->bi_iter.bi_sector = sector;
114 +@@ -68,8 +67,8 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
115 + bio_set_op_attrs(bio, op, 0);
116 +
117 + bio->bi_iter.bi_size = req_sects << 9;
118 ++ sector += req_sects;
119 + nr_sects -= req_sects;
120 +- sector = end_sect;
121 +
122 + /*
123 + * We can loop for a long time in here, if someone does
124 +@@ -82,14 +81,6 @@ int __blkdev_issue_discard(struct block_device *bdev, sector_t sector,
125 +
126 + *biop = bio;
127 + return 0;
128 +-
129 +-fail:
130 +- if (bio) {
131 +- submit_bio_wait(bio);
132 +- bio_put(bio);
133 +- }
134 +- *biop = NULL;
135 +- return -EOPNOTSUPP;
136 + }
137 + EXPORT_SYMBOL(__blkdev_issue_discard);
138 +
139 +diff --git a/crypto/af_alg.c b/crypto/af_alg.c
140 +index ed643ce12278..4fc8e6a7abb2 100644
141 +--- a/crypto/af_alg.c
142 ++++ b/crypto/af_alg.c
143 +@@ -139,11 +139,13 @@ void af_alg_release_parent(struct sock *sk)
144 + sk = ask->parent;
145 + ask = alg_sk(sk);
146 +
147 +- lock_sock(sk);
148 ++ local_bh_disable();
149 ++ bh_lock_sock(sk);
150 + ask->nokey_refcnt -= nokey;
151 + if (!last)
152 + last = !--ask->refcnt;
153 +- release_sock(sk);
154 ++ bh_unlock_sock(sk);
155 ++ local_bh_enable();
156 +
157 + if (last)
158 + sock_put(sk);
159 +diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
160 +index 6470e3c4c990..7323e9210f4b 100644
161 +--- a/drivers/atm/eni.c
162 ++++ b/drivers/atm/eni.c
163 +@@ -372,7 +372,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
164 + here = (eni_vcc->descr+skip) & (eni_vcc->words-1);
165 + dma[j++] = (here << MID_DMA_COUNT_SHIFT) | (vcc->vci
166 + << MID_DMA_VCI_SHIFT) | MID_DT_JK;
167 +- j++;
168 ++ dma[j++] = 0;
169 + }
170 + here = (eni_vcc->descr+size+skip) & (eni_vcc->words-1);
171 + if (!eff) size += skip;
172 +@@ -445,7 +445,7 @@ static int do_rx_dma(struct atm_vcc *vcc,struct sk_buff *skb,
173 + if (size != eff) {
174 + dma[j++] = (here << MID_DMA_COUNT_SHIFT) |
175 + (vcc->vci << MID_DMA_VCI_SHIFT) | MID_DT_JK;
176 +- j++;
177 ++ dma[j++] = 0;
178 + }
179 + if (!j || j > 2*RX_DMA_BUF) {
180 + printk(KERN_CRIT DEV_LABEL "!j or j too big!!!\n");
181 +diff --git a/drivers/base/component.c b/drivers/base/component.c
182 +index e8d676fad0c9..7f7c4233cd31 100644
183 +--- a/drivers/base/component.c
184 ++++ b/drivers/base/component.c
185 +@@ -74,11 +74,11 @@ static int component_devices_show(struct seq_file *s, void *data)
186 + seq_printf(s, "%-40s %20s\n", "device name", "status");
187 + seq_puts(s, "-------------------------------------------------------------\n");
188 + for (i = 0; i < match->num; i++) {
189 +- struct device *d = (struct device *)match->compare[i].data;
190 ++ struct component *component = match->compare[i].component;
191 +
192 +- seq_printf(s, "%-40s %20s\n", dev_name(d),
193 +- match->compare[i].component ?
194 +- "registered" : "not registered");
195 ++ seq_printf(s, "%-40s %20s\n",
196 ++ component ? dev_name(component->dev) : "(unknown)",
197 ++ component ? (component->bound ? "bound" : "not bound") : "not registered");
198 + }
199 + mutex_unlock(&component_mutex);
200 +
201 +diff --git a/drivers/char/random.c b/drivers/char/random.c
202 +index 86fe1df90239..53e822793d46 100644
203 +--- a/drivers/char/random.c
204 ++++ b/drivers/char/random.c
205 +@@ -1653,6 +1653,56 @@ void get_random_bytes(void *buf, int nbytes)
206 + }
207 + EXPORT_SYMBOL(get_random_bytes);
208 +
209 ++
210 ++/*
211 ++ * Each time the timer fires, we expect that we got an unpredictable
212 ++ * jump in the cycle counter. Even if the timer is running on another
213 ++ * CPU, the timer activity will be touching the stack of the CPU that is
214 ++ * generating entropy..
215 ++ *
216 ++ * Note that we don't re-arm the timer in the timer itself - we are
217 ++ * happy to be scheduled away, since that just makes the load more
218 ++ * complex, but we do not want the timer to keep ticking unless the
219 ++ * entropy loop is running.
220 ++ *
221 ++ * So the re-arming always happens in the entropy loop itself.
222 ++ */
223 ++static void entropy_timer(struct timer_list *t)
224 ++{
225 ++ credit_entropy_bits(&input_pool, 1);
226 ++}
227 ++
228 ++/*
229 ++ * If we have an actual cycle counter, see if we can
230 ++ * generate enough entropy with timing noise
231 ++ */
232 ++static void try_to_generate_entropy(void)
233 ++{
234 ++ struct {
235 ++ unsigned long now;
236 ++ struct timer_list timer;
237 ++ } stack;
238 ++
239 ++ stack.now = random_get_entropy();
240 ++
241 ++ /* Slow counter - or none. Don't even bother */
242 ++ if (stack.now == random_get_entropy())
243 ++ return;
244 ++
245 ++ timer_setup_on_stack(&stack.timer, entropy_timer, 0);
246 ++ while (!crng_ready()) {
247 ++ if (!timer_pending(&stack.timer))
248 ++ mod_timer(&stack.timer, jiffies+1);
249 ++ mix_pool_bytes(&input_pool, &stack.now, sizeof(stack.now));
250 ++ schedule();
251 ++ stack.now = random_get_entropy();
252 ++ }
253 ++
254 ++ del_timer_sync(&stack.timer);
255 ++ destroy_timer_on_stack(&stack.timer);
256 ++ mix_pool_bytes(&input_pool, &stack.now, sizeof(stack.now));
257 ++}
258 ++
259 + /*
260 + * Wait for the urandom pool to be seeded and thus guaranteed to supply
261 + * cryptographically secure random numbers. This applies to: the /dev/urandom
262 +@@ -1667,7 +1717,17 @@ int wait_for_random_bytes(void)
263 + {
264 + if (likely(crng_ready()))
265 + return 0;
266 +- return wait_event_interruptible(crng_init_wait, crng_ready());
267 ++
268 ++ do {
269 ++ int ret;
270 ++ ret = wait_event_interruptible_timeout(crng_init_wait, crng_ready(), HZ);
271 ++ if (ret)
272 ++ return ret > 0 ? 0 : ret;
273 ++
274 ++ try_to_generate_entropy();
275 ++ } while (!crng_ready());
276 ++
277 ++ return 0;
278 + }
279 + EXPORT_SYMBOL(wait_for_random_bytes);
280 +
281 +diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c
282 +index 010bbf607797..c435f89f34e3 100644
283 +--- a/drivers/crypto/chelsio/chcr_algo.c
284 ++++ b/drivers/crypto/chelsio/chcr_algo.c
285 +@@ -3135,9 +3135,6 @@ static int chcr_gcm_setauthsize(struct crypto_aead *tfm, unsigned int authsize)
286 + aeadctx->mayverify = VERIFY_SW;
287 + break;
288 + default:
289 +-
290 +- crypto_tfm_set_flags((struct crypto_tfm *) tfm,
291 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
292 + return -EINVAL;
293 + }
294 + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize);
295 +@@ -3162,8 +3159,6 @@ static int chcr_4106_4309_setauthsize(struct crypto_aead *tfm,
296 + aeadctx->mayverify = VERIFY_HW;
297 + break;
298 + default:
299 +- crypto_tfm_set_flags((struct crypto_tfm *)tfm,
300 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
301 + return -EINVAL;
302 + }
303 + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize);
304 +@@ -3204,8 +3199,6 @@ static int chcr_ccm_setauthsize(struct crypto_aead *tfm,
305 + aeadctx->mayverify = VERIFY_HW;
306 + break;
307 + default:
308 +- crypto_tfm_set_flags((struct crypto_tfm *)tfm,
309 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
310 + return -EINVAL;
311 + }
312 + return crypto_aead_setauthsize(aeadctx->sw_cipher, authsize);
313 +@@ -3230,8 +3223,7 @@ static int chcr_ccm_common_setkey(struct crypto_aead *aead,
314 + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256;
315 + mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256;
316 + } else {
317 +- crypto_tfm_set_flags((struct crypto_tfm *)aead,
318 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
319 ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);
320 + aeadctx->enckey_len = 0;
321 + return -EINVAL;
322 + }
323 +@@ -3269,8 +3261,7 @@ static int chcr_aead_rfc4309_setkey(struct crypto_aead *aead, const u8 *key,
324 + int error;
325 +
326 + if (keylen < 3) {
327 +- crypto_tfm_set_flags((struct crypto_tfm *)aead,
328 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
329 ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);
330 + aeadctx->enckey_len = 0;
331 + return -EINVAL;
332 + }
333 +@@ -3320,8 +3311,7 @@ static int chcr_gcm_setkey(struct crypto_aead *aead, const u8 *key,
334 + } else if (keylen == AES_KEYSIZE_256) {
335 + ck_size = CHCR_KEYCTX_CIPHER_KEY_SIZE_256;
336 + } else {
337 +- crypto_tfm_set_flags((struct crypto_tfm *)aead,
338 +- CRYPTO_TFM_RES_BAD_KEY_LEN);
339 ++ crypto_aead_set_flags(aead, CRYPTO_TFM_RES_BAD_KEY_LEN);
340 + pr_err("GCM: Invalid key length %d\n", keylen);
341 + ret = -EINVAL;
342 + goto out;
343 +diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
344 +index ed51221621a5..2c34e9537f9e 100644
345 +--- a/drivers/gpio/Kconfig
346 ++++ b/drivers/gpio/Kconfig
347 +@@ -1059,6 +1059,7 @@ config GPIO_MADERA
348 + config GPIO_MAX77620
349 + tristate "GPIO support for PMIC MAX77620 and MAX20024"
350 + depends on MFD_MAX77620
351 ++ select GPIOLIB_IRQCHIP
352 + help
353 + GPIO driver for MAX77620 and MAX20024 PMIC from Maxim Semiconductor.
354 + MAX77620 PMIC has 8 pins that can be configured as GPIOs. The
355 +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
356 +index 1949d6fca53e..f491092f36ff 100644
357 +--- a/drivers/hid/hid-ids.h
358 ++++ b/drivers/hid/hid-ids.h
359 +@@ -620,6 +620,7 @@
360 + #define USB_VENDOR_ID_ITE 0x048d
361 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA 0x8386
362 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA2 0x8350
363 ++#define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a
364 + #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396
365 + #define USB_DEVICE_ID_ITE8595 0x8595
366 +
367 +@@ -717,6 +718,7 @@
368 + #define USB_DEVICE_ID_LG_MULTITOUCH 0x0064
369 + #define USB_DEVICE_ID_LG_MELFAS_MT 0x6007
370 + #define I2C_DEVICE_ID_LG_8001 0x8001
371 ++#define I2C_DEVICE_ID_LG_7010 0x7010
372 +
373 + #define USB_VENDOR_ID_LOGITECH 0x046d
374 + #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
375 +@@ -1074,6 +1076,7 @@
376 + #define USB_DEVICE_ID_SYNAPTICS_LTS2 0x1d10
377 + #define USB_DEVICE_ID_SYNAPTICS_HD 0x0ac3
378 + #define USB_DEVICE_ID_SYNAPTICS_QUAD_HD 0x1ac3
379 ++#define USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012 0x2968
380 + #define USB_DEVICE_ID_SYNAPTICS_TP_V103 0x5710
381 +
382 + #define USB_VENDOR_ID_TEXAS_INSTRUMENTS 0x2047
383 +diff --git a/drivers/hid/hid-ite.c b/drivers/hid/hid-ite.c
384 +index 98b059d79bc8..2ce1eb0c9212 100644
385 +--- a/drivers/hid/hid-ite.c
386 ++++ b/drivers/hid/hid-ite.c
387 +@@ -43,6 +43,9 @@ static int ite_event(struct hid_device *hdev, struct hid_field *field,
388 + static const struct hid_device_id ite_devices[] = {
389 + { HID_USB_DEVICE(USB_VENDOR_ID_ITE, USB_DEVICE_ID_ITE8595) },
390 + { HID_USB_DEVICE(USB_VENDOR_ID_258A, USB_DEVICE_ID_258A_6A88) },
391 ++ /* ITE8595 USB kbd ctlr, with Synaptics touchpad connected to it. */
392 ++ { HID_USB_DEVICE(USB_VENDOR_ID_SYNAPTICS,
393 ++ USB_DEVICE_ID_SYNAPTICS_ACER_SWITCH5_012) },
394 + { }
395 + };
396 + MODULE_DEVICE_TABLE(hid, ite_devices);
397 +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
398 +index f9167d0e095c..19dfd8acd0da 100644
399 +--- a/drivers/hid/hid-multitouch.c
400 ++++ b/drivers/hid/hid-multitouch.c
401 +@@ -1007,7 +1007,7 @@ static int mt_process_slot(struct mt_device *td, struct input_dev *input,
402 + tool = MT_TOOL_DIAL;
403 + else if (unlikely(!confidence_state)) {
404 + tool = MT_TOOL_PALM;
405 +- if (!active &&
406 ++ if (!active && mt &&
407 + input_mt_is_active(&mt->slots[slotnum])) {
408 + /*
409 + * The non-confidence was reported for
410 +@@ -1972,6 +1972,9 @@ static const struct hid_device_id mt_devices[] = {
411 + { .driver_data = MT_CLS_LG,
412 + HID_USB_DEVICE(USB_VENDOR_ID_LG,
413 + USB_DEVICE_ID_LG_MELFAS_MT) },
414 ++ { .driver_data = MT_CLS_LG,
415 ++ HID_DEVICE(BUS_I2C, HID_GROUP_GENERIC,
416 ++ USB_VENDOR_ID_LG, I2C_DEVICE_ID_LG_7010) },
417 +
418 + /* MosArt panels */
419 + { .driver_data = MT_CLS_CONFIDENCE_MINUS_ONE,
420 +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
421 +index 57d6fe9ed416..b9529bed4d76 100644
422 +--- a/drivers/hid/hid-quirks.c
423 ++++ b/drivers/hid/hid-quirks.c
424 +@@ -175,6 +175,7 @@ static const struct hid_device_id hid_quirks[] = {
425 + { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
426 + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
427 + { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
428 ++ { HID_USB_DEVICE(USB_VENDOR_ID_XIN_MO, USB_DEVICE_ID_XIN_MO_DUAL_ARCADE), HID_QUIRK_MULTI_INPUT },
429 +
430 + { 0 }
431 + };
432 +diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
433 +index 8dae0f9b819e..6286204d4c56 100644
434 +--- a/drivers/hid/hid-steam.c
435 ++++ b/drivers/hid/hid-steam.c
436 +@@ -768,8 +768,12 @@ static int steam_probe(struct hid_device *hdev,
437 +
438 + if (steam->quirks & STEAM_QUIRK_WIRELESS) {
439 + hid_info(hdev, "Steam wireless receiver connected");
440 ++ /* If using a wireless adaptor ask for connection status */
441 ++ steam->connected = false;
442 + steam_request_conn_status(steam);
443 + } else {
444 ++ /* A wired connection is always present */
445 ++ steam->connected = true;
446 + ret = steam_register(steam);
447 + if (ret) {
448 + hid_err(hdev,
449 +diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c b/drivers/hid/i2c-hid/i2c-hid-core.c
450 +index 0a39e444e308..f2c8c59fc582 100644
451 +--- a/drivers/hid/i2c-hid/i2c-hid-core.c
452 ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c
453 +@@ -52,6 +52,8 @@
454 + #define I2C_HID_QUIRK_DELAY_AFTER_SLEEP BIT(3)
455 + #define I2C_HID_QUIRK_BOGUS_IRQ BIT(4)
456 + #define I2C_HID_QUIRK_RESET_ON_RESUME BIT(5)
457 ++#define I2C_HID_QUIRK_BAD_INPUT_SIZE BIT(6)
458 ++
459 +
460 + /* flags */
461 + #define I2C_HID_STARTED 0
462 +@@ -185,6 +187,8 @@ static const struct i2c_hid_quirks {
463 + I2C_HID_QUIRK_BOGUS_IRQ },
464 + { USB_VENDOR_ID_ALPS_JP, HID_ANY_ID,
465 + I2C_HID_QUIRK_RESET_ON_RESUME },
466 ++ { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
467 ++ I2C_HID_QUIRK_BAD_INPUT_SIZE },
468 + { 0, 0 }
469 + };
470 +
471 +@@ -516,9 +520,15 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
472 + }
473 +
474 + if ((ret_size > size) || (ret_size < 2)) {
475 +- dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
476 +- __func__, size, ret_size);
477 +- return;
478 ++ if (ihid->quirks & I2C_HID_QUIRK_BAD_INPUT_SIZE) {
479 ++ ihid->inbuf[0] = size & 0xff;
480 ++ ihid->inbuf[1] = size >> 8;
481 ++ ret_size = size;
482 ++ } else {
483 ++ dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
484 ++ __func__, size, ret_size);
485 ++ return;
486 ++ }
487 + }
488 +
489 + i2c_hid_dbg(ihid, "input: %*ph\n", ret_size, ihid->inbuf);
490 +diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
491 +index b31064ba37b9..02f6f263e338 100644
492 +--- a/drivers/iio/gyro/st_gyro_core.c
493 ++++ b/drivers/iio/gyro/st_gyro_core.c
494 +@@ -141,7 +141,6 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
495 + [2] = LSM330DLC_GYRO_DEV_NAME,
496 + [3] = L3G4IS_GYRO_DEV_NAME,
497 + [4] = LSM330_GYRO_DEV_NAME,
498 +- [5] = LSM9DS0_GYRO_DEV_NAME,
499 + },
500 + .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
501 + .odr = {
502 +@@ -211,6 +210,80 @@ static const struct st_sensor_settings st_gyro_sensors_settings[] = {
503 + .multi_read_bit = true,
504 + .bootime = 2,
505 + },
506 ++ {
507 ++ .wai = 0xd4,
508 ++ .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
509 ++ .sensors_supported = {
510 ++ [0] = LSM9DS0_GYRO_DEV_NAME,
511 ++ },
512 ++ .ch = (struct iio_chan_spec *)st_gyro_16bit_channels,
513 ++ .odr = {
514 ++ .addr = 0x20,
515 ++ .mask = GENMASK(7, 6),
516 ++ .odr_avl = {
517 ++ { .hz = 95, .value = 0x00, },
518 ++ { .hz = 190, .value = 0x01, },
519 ++ { .hz = 380, .value = 0x02, },
520 ++ { .hz = 760, .value = 0x03, },
521 ++ },
522 ++ },
523 ++ .pw = {
524 ++ .addr = 0x20,
525 ++ .mask = BIT(3),
526 ++ .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE,
527 ++ .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE,
528 ++ },
529 ++ .enable_axis = {
530 ++ .addr = ST_SENSORS_DEFAULT_AXIS_ADDR,
531 ++ .mask = ST_SENSORS_DEFAULT_AXIS_MASK,
532 ++ },
533 ++ .fs = {
534 ++ .addr = 0x23,
535 ++ .mask = GENMASK(5, 4),
536 ++ .fs_avl = {
537 ++ [0] = {
538 ++ .num = ST_GYRO_FS_AVL_245DPS,
539 ++ .value = 0x00,
540 ++ .gain = IIO_DEGREE_TO_RAD(8750),
541 ++ },
542 ++ [1] = {
543 ++ .num = ST_GYRO_FS_AVL_500DPS,
544 ++ .value = 0x01,
545 ++ .gain = IIO_DEGREE_TO_RAD(17500),
546 ++ },
547 ++ [2] = {
548 ++ .num = ST_GYRO_FS_AVL_2000DPS,
549 ++ .value = 0x02,
550 ++ .gain = IIO_DEGREE_TO_RAD(70000),
551 ++ },
552 ++ },
553 ++ },
554 ++ .bdu = {
555 ++ .addr = 0x23,
556 ++ .mask = BIT(7),
557 ++ },
558 ++ .drdy_irq = {
559 ++ .int2 = {
560 ++ .addr = 0x22,
561 ++ .mask = BIT(3),
562 ++ },
563 ++ /*
564 ++ * The sensor has IHL (active low) and open
565 ++ * drain settings, but only for INT1 and not
566 ++ * for the DRDY line on INT2.
567 ++ */
568 ++ .stat_drdy = {
569 ++ .addr = ST_SENSORS_DEFAULT_STAT_ADDR,
570 ++ .mask = GENMASK(2, 0),
571 ++ },
572 ++ },
573 ++ .sim = {
574 ++ .addr = 0x23,
575 ++ .value = BIT(0),
576 ++ },
577 ++ .multi_read_bit = true,
578 ++ .bootime = 2,
579 ++ },
580 + {
581 + .wai = 0xd7,
582 + .wai_addr = ST_SENSORS_DEFAULT_WAI_ADDRESS,
583 +diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
584 +index bea19aa33758..0783f44e9afe 100644
585 +--- a/drivers/iommu/amd_iommu.c
586 ++++ b/drivers/iommu/amd_iommu.c
587 +@@ -3709,7 +3709,20 @@ static void set_remap_table_entry(struct amd_iommu *iommu, u16 devid,
588 + iommu_flush_dte(iommu, devid);
589 + }
590 +
591 +-static struct irq_remap_table *alloc_irq_table(u16 devid)
592 ++static int set_remap_table_entry_alias(struct pci_dev *pdev, u16 alias,
593 ++ void *data)
594 ++{
595 ++ struct irq_remap_table *table = data;
596 ++
597 ++ irq_lookup_table[alias] = table;
598 ++ set_dte_irq_entry(alias, table);
599 ++
600 ++ iommu_flush_dte(amd_iommu_rlookup_table[alias], alias);
601 ++
602 ++ return 0;
603 ++}
604 ++
605 ++static struct irq_remap_table *alloc_irq_table(u16 devid, struct pci_dev *pdev)
606 + {
607 + struct irq_remap_table *table = NULL;
608 + struct irq_remap_table *new_table = NULL;
609 +@@ -3755,7 +3768,12 @@ static struct irq_remap_table *alloc_irq_table(u16 devid)
610 + table = new_table;
611 + new_table = NULL;
612 +
613 +- set_remap_table_entry(iommu, devid, table);
614 ++ if (pdev)
615 ++ pci_for_each_dma_alias(pdev, set_remap_table_entry_alias,
616 ++ table);
617 ++ else
618 ++ set_remap_table_entry(iommu, devid, table);
619 ++
620 + if (devid != alias)
621 + set_remap_table_entry(iommu, alias, table);
622 +
623 +@@ -3772,7 +3790,8 @@ out_unlock:
624 + return table;
625 + }
626 +
627 +-static int alloc_irq_index(u16 devid, int count, bool align)
628 ++static int alloc_irq_index(u16 devid, int count, bool align,
629 ++ struct pci_dev *pdev)
630 + {
631 + struct irq_remap_table *table;
632 + int index, c, alignment = 1;
633 +@@ -3782,7 +3801,7 @@ static int alloc_irq_index(u16 devid, int count, bool align)
634 + if (!iommu)
635 + return -ENODEV;
636 +
637 +- table = alloc_irq_table(devid);
638 ++ table = alloc_irq_table(devid, pdev);
639 + if (!table)
640 + return -ENODEV;
641 +
642 +@@ -4215,7 +4234,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq,
643 + struct irq_remap_table *table;
644 + struct amd_iommu *iommu;
645 +
646 +- table = alloc_irq_table(devid);
647 ++ table = alloc_irq_table(devid, NULL);
648 + if (table) {
649 + if (!table->min_index) {
650 + /*
651 +@@ -4232,11 +4251,15 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq,
652 + } else {
653 + index = -ENOMEM;
654 + }
655 +- } else {
656 ++ } else if (info->type == X86_IRQ_ALLOC_TYPE_MSI ||
657 ++ info->type == X86_IRQ_ALLOC_TYPE_MSIX) {
658 + bool align = (info->type == X86_IRQ_ALLOC_TYPE_MSI);
659 +
660 +- index = alloc_irq_index(devid, nr_irqs, align);
661 ++ index = alloc_irq_index(devid, nr_irqs, align, info->msi_dev);
662 ++ } else {
663 ++ index = alloc_irq_index(devid, nr_irqs, false, NULL);
664 + }
665 ++
666 + if (index < 0) {
667 + pr_warn("Failed to allocate IRTE\n");
668 + ret = index;
669 +diff --git a/drivers/misc/mei/hw-me-regs.h b/drivers/misc/mei/hw-me-regs.h
670 +index 9c4042420022..d80372d21c14 100644
671 +--- a/drivers/misc/mei/hw-me-regs.h
672 ++++ b/drivers/misc/mei/hw-me-regs.h
673 +@@ -141,8 +141,12 @@
674 +
675 + #define MEI_DEV_ID_CMP_LP 0x02e0 /* Comet Point LP */
676 + #define MEI_DEV_ID_CMP_LP_3 0x02e4 /* Comet Point LP 3 (iTouch) */
677 ++
678 + #define MEI_DEV_ID_CMP_V 0xA3BA /* Comet Point Lake V */
679 +
680 ++#define MEI_DEV_ID_CMP_H 0x06e0 /* Comet Lake H */
681 ++#define MEI_DEV_ID_CMP_H_3 0x06e4 /* Comet Lake H 3 (iTouch) */
682 ++
683 + #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
684 +
685 + #define MEI_DEV_ID_TGP_LP 0xA0E0 /* Tiger Lake Point LP */
686 +diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
687 +index 41a10e392839..3498c10b8263 100644
688 +--- a/drivers/misc/mei/pci-me.c
689 ++++ b/drivers/misc/mei/pci-me.c
690 +@@ -108,6 +108,8 @@ static const struct pci_device_id mei_me_pci_tbl[] = {
691 + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP, MEI_ME_PCH12_CFG)},
692 + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_LP_3, MEI_ME_PCH8_CFG)},
693 + {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_V, MEI_ME_PCH12_CFG)},
694 ++ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H, MEI_ME_PCH12_CFG)},
695 ++ {MEI_PCI_DEVICE(MEI_DEV_ID_CMP_H_3, MEI_ME_PCH8_CFG)},
696 +
697 + {MEI_PCI_DEVICE(MEI_DEV_ID_ICP_LP, MEI_ME_PCH12_CFG)},
698 +
699 +diff --git a/drivers/net/ethernet/broadcom/b44.c b/drivers/net/ethernet/broadcom/b44.c
700 +index e445ab724827..88f8d31e4c83 100644
701 +--- a/drivers/net/ethernet/broadcom/b44.c
702 ++++ b/drivers/net/ethernet/broadcom/b44.c
703 +@@ -1519,8 +1519,10 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
704 + int ethaddr_bytes = ETH_ALEN;
705 +
706 + memset(ppattern + offset, 0xff, magicsync);
707 +- for (j = 0; j < magicsync; j++)
708 +- set_bit(len++, (unsigned long *) pmask);
709 ++ for (j = 0; j < magicsync; j++) {
710 ++ pmask[len >> 3] |= BIT(len & 7);
711 ++ len++;
712 ++ }
713 +
714 + for (j = 0; j < B44_MAX_PATTERNS; j++) {
715 + if ((B44_PATTERN_SIZE - len) >= ETH_ALEN)
716 +@@ -1532,7 +1534,8 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
717 + for (k = 0; k< ethaddr_bytes; k++) {
718 + ppattern[offset + magicsync +
719 + (j * ETH_ALEN) + k] = macaddr[k];
720 +- set_bit(len++, (unsigned long *) pmask);
721 ++ pmask[len >> 3] |= BIT(len & 7);
722 ++ len++;
723 + }
724 + }
725 + return len - 1;
726 +diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
727 +index 57ed259c8208..09fde60a5f9d 100644
728 +--- a/drivers/net/wan/sdla.c
729 ++++ b/drivers/net/wan/sdla.c
730 +@@ -711,7 +711,7 @@ static netdev_tx_t sdla_transmit(struct sk_buff *skb,
731 +
732 + spin_lock_irqsave(&sdla_lock, flags);
733 + SDLA_WINDOW(dev, addr);
734 +- pbuf = (void *)(((int) dev->mem_start) + (addr & SDLA_ADDR_MASK));
735 ++ pbuf = (void *)(dev->mem_start + (addr & SDLA_ADDR_MASK));
736 + __sdla_write(dev, pbuf->buf_addr, skb->data, skb->len);
737 + SDLA_WINDOW(dev, addr);
738 + pbuf->opp_flag = 1;
739 +diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
740 +index fb649d85b8fc..dd0c32379375 100644
741 +--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
742 ++++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
743 +@@ -1216,7 +1216,7 @@ err_fw:
744 + static int send_eject_command(struct usb_interface *interface)
745 + {
746 + struct usb_device *udev = interface_to_usbdev(interface);
747 +- struct usb_host_interface *iface_desc = &interface->altsetting[0];
748 ++ struct usb_host_interface *iface_desc = interface->cur_altsetting;
749 + struct usb_endpoint_descriptor *endpoint;
750 + unsigned char *cmd;
751 + u8 bulk_out_ep;
752 +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
753 +index 44ead0fea7c6..6a213fe760ff 100644
754 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
755 ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
756 +@@ -1357,7 +1357,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
757 + goto fail;
758 + }
759 +
760 +- desc = &intf->altsetting[0].desc;
761 ++ desc = &intf->cur_altsetting->desc;
762 + if ((desc->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
763 + (desc->bInterfaceSubClass != 2) ||
764 + (desc->bInterfaceProtocol != 0xff)) {
765 +@@ -1370,7 +1370,7 @@ brcmf_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
766 +
767 + num_of_eps = desc->bNumEndpoints;
768 + for (ep = 0; ep < num_of_eps; ep++) {
769 +- endpoint = &intf->altsetting[0].endpoint[ep].desc;
770 ++ endpoint = &intf->cur_altsetting->endpoint[ep].desc;
771 + endpoint_num = usb_endpoint_num(endpoint);
772 + if (!usb_endpoint_xfer_bulk(endpoint))
773 + continue;
774 +diff --git a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
775 +index 94ad6fe29e69..2c7dd2a7350c 100644
776 +--- a/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
777 ++++ b/drivers/net/wireless/intersil/orinoco/orinoco_usb.c
778 +@@ -1611,9 +1611,9 @@ static int ezusb_probe(struct usb_interface *interface,
779 + /* set up the endpoint information */
780 + /* check out the endpoints */
781 +
782 +- iface_desc = &interface->altsetting[0].desc;
783 ++ iface_desc = &interface->cur_altsetting->desc;
784 + for (i = 0; i < iface_desc->bNumEndpoints; ++i) {
785 +- ep = &interface->altsetting[0].endpoint[i].desc;
786 ++ ep = &interface->cur_altsetting->endpoint[i].desc;
787 +
788 + if (usb_endpoint_is_bulk_in(ep)) {
789 + /* we found a bulk in endpoint */
790 +diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
791 +index b2e1523b4dc1..070ea0f456ab 100644
792 +--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
793 ++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
794 +@@ -5921,7 +5921,7 @@ static int rtl8xxxu_parse_usb(struct rtl8xxxu_priv *priv,
795 + u8 dir, xtype, num;
796 + int ret = 0;
797 +
798 +- host_interface = &interface->altsetting[0];
799 ++ host_interface = interface->cur_altsetting;
800 + interface_desc = &host_interface->desc;
801 + endpoints = interface_desc->bNumEndpoints;
802 +
803 +diff --git a/drivers/net/wireless/rsi/rsi_91x_hal.c b/drivers/net/wireless/rsi/rsi_91x_hal.c
804 +index 01edf960ff3c..a7b341e95e76 100644
805 +--- a/drivers/net/wireless/rsi/rsi_91x_hal.c
806 ++++ b/drivers/net/wireless/rsi/rsi_91x_hal.c
807 +@@ -616,6 +616,7 @@ static int bl_cmd(struct rsi_hw *adapter, u8 cmd, u8 exp_resp, char *str)
808 + bl_start_cmd_timer(adapter, timeout);
809 + status = bl_write_cmd(adapter, cmd, exp_resp, &regout_val);
810 + if (status < 0) {
811 ++ bl_stop_cmd_timer(adapter);
812 + rsi_dbg(ERR_ZONE,
813 + "%s: Command %s (%0x) writing failed..\n",
814 + __func__, str, cmd);
815 +@@ -731,10 +732,9 @@ static int ping_pong_write(struct rsi_hw *adapter, u8 cmd, u8 *addr, u32 size)
816 + }
817 +
818 + status = bl_cmd(adapter, cmd_req, cmd_resp, str);
819 +- if (status) {
820 +- bl_stop_cmd_timer(adapter);
821 ++ if (status)
822 + return status;
823 +- }
824 ++
825 + return 0;
826 + }
827 +
828 +@@ -822,10 +822,9 @@ static int auto_fw_upgrade(struct rsi_hw *adapter, u8 *flash_content,
829 +
830 + status = bl_cmd(adapter, EOF_REACHED, FW_LOADING_SUCCESSFUL,
831 + "EOF_REACHED");
832 +- if (status) {
833 +- bl_stop_cmd_timer(adapter);
834 ++ if (status)
835 + return status;
836 +- }
837 ++
838 + rsi_dbg(INFO_ZONE, "FW loading is done and FW is running..\n");
839 + return 0;
840 + }
841 +@@ -846,6 +845,7 @@ static int rsi_load_firmware(struct rsi_hw *adapter)
842 + status = hif_ops->master_reg_read(adapter, SWBL_REGOUT,
843 + &regout_val, 2);
844 + if (status < 0) {
845 ++ bl_stop_cmd_timer(adapter);
846 + rsi_dbg(ERR_ZONE,
847 + "%s: REGOUT read failed\n", __func__);
848 + return status;
849 +diff --git a/drivers/net/wireless/rsi/rsi_91x_usb.c b/drivers/net/wireless/rsi/rsi_91x_usb.c
850 +index 14e56bee0548..90eb749e2b61 100644
851 +--- a/drivers/net/wireless/rsi/rsi_91x_usb.c
852 ++++ b/drivers/net/wireless/rsi/rsi_91x_usb.c
853 +@@ -16,6 +16,7 @@
854 + */
855 +
856 + #include <linux/module.h>
857 ++#include <linux/types.h>
858 + #include <net/rsi_91x.h>
859 + #include "rsi_usb.h"
860 + #include "rsi_hal.h"
861 +@@ -29,7 +30,7 @@ MODULE_PARM_DESC(dev_oper_mode,
862 + "9[Wi-Fi STA + BT LE], 13[Wi-Fi STA + BT classic + BT LE]\n"
863 + "6[AP + BT classic], 14[AP + BT classic + BT LE]");
864 +
865 +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num);
866 ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t flags);
867 +
868 + /**
869 + * rsi_usb_card_write() - This function writes to the USB Card.
870 +@@ -117,7 +118,7 @@ static int rsi_find_bulk_in_and_out_endpoints(struct usb_interface *interface,
871 + __le16 buffer_size;
872 + int ii, bin_found = 0, bout_found = 0;
873 +
874 +- iface_desc = &(interface->altsetting[0]);
875 ++ iface_desc = interface->cur_altsetting;
876 +
877 + for (ii = 0; ii < iface_desc->desc.bNumEndpoints; ++ii) {
878 + endpoint = &(iface_desc->endpoint[ii].desc);
879 +@@ -283,7 +284,7 @@ static void rsi_rx_done_handler(struct urb *urb)
880 + status = 0;
881 +
882 + out:
883 +- if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num))
884 ++ if (rsi_rx_urb_submit(dev->priv, rx_cb->ep_num, GFP_ATOMIC))
885 + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission", __func__);
886 +
887 + if (status)
888 +@@ -296,7 +297,7 @@ out:
889 + *
890 + * Return: 0 on success, a negative error code on failure.
891 + */
892 +-static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num)
893 ++static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags)
894 + {
895 + struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)adapter->rsi_dev;
896 + struct rx_usb_ctrl_block *rx_cb = &dev->rx_cb[ep_num - 1];
897 +@@ -326,9 +327,11 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num)
898 + rsi_rx_done_handler,
899 + rx_cb);
900 +
901 +- status = usb_submit_urb(urb, GFP_KERNEL);
902 +- if (status)
903 ++ status = usb_submit_urb(urb, mem_flags);
904 ++ if (status) {
905 + rsi_dbg(ERR_ZONE, "%s: Failed in urb submission\n", __func__);
906 ++ dev_kfree_skb(skb);
907 ++ }
908 +
909 + return status;
910 + }
911 +@@ -781,12 +784,12 @@ static int rsi_probe(struct usb_interface *pfunction,
912 + rsi_dbg(INIT_ZONE, "%s: Device Init Done\n", __func__);
913 + }
914 +
915 +- status = rsi_rx_urb_submit(adapter, WLAN_EP);
916 ++ status = rsi_rx_urb_submit(adapter, WLAN_EP, GFP_KERNEL);
917 + if (status)
918 + goto err1;
919 +
920 + if (adapter->priv->coex_mode > 1) {
921 +- status = rsi_rx_urb_submit(adapter, BT_EP);
922 ++ status = rsi_rx_urb_submit(adapter, BT_EP, GFP_KERNEL);
923 + if (status)
924 + goto err1;
925 + }
926 +diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
927 +index c2cda3acd4af..0fddfb464e9c 100644
928 +--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
929 ++++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
930 +@@ -1275,7 +1275,7 @@ static void print_id(struct usb_device *udev)
931 + static int eject_installer(struct usb_interface *intf)
932 + {
933 + struct usb_device *udev = interface_to_usbdev(intf);
934 +- struct usb_host_interface *iface_desc = &intf->altsetting[0];
935 ++ struct usb_host_interface *iface_desc = intf->cur_altsetting;
936 + struct usb_endpoint_descriptor *endpoint;
937 + unsigned char *cmd;
938 + u8 bulk_out_ep;
939 +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
940 +index 36f8eb9f24a7..5b4c36ab1596 100644
941 +--- a/drivers/pci/quirks.c
942 ++++ b/drivers/pci/quirks.c
943 +@@ -3986,6 +3986,40 @@ static void quirk_mic_x200_dma_alias(struct pci_dev *pdev)
944 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2260, quirk_mic_x200_dma_alias);
945 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2264, quirk_mic_x200_dma_alias);
946 +
947 ++/*
948 ++ * Intel Visual Compute Accelerator (VCA) is a family of PCIe add-in devices
949 ++ * exposing computational units via Non Transparent Bridges (NTB, PEX 87xx).
950 ++ *
951 ++ * Similarly to MIC x200, we need to add DMA aliases to allow buffer access
952 ++ * when IOMMU is enabled. These aliases allow computational unit access to
953 ++ * host memory. These aliases mark the whole VCA device as one IOMMU
954 ++ * group.
955 ++ *
956 ++ * All possible slot numbers (0x20) are used, since we are unable to tell
957 ++ * what slot is used on other side. This quirk is intended for both host
958 ++ * and computational unit sides. The VCA devices have up to five functions
959 ++ * (four for DMA channels and one additional).
960 ++ */
961 ++static void quirk_pex_vca_alias(struct pci_dev *pdev)
962 ++{
963 ++ const unsigned int num_pci_slots = 0x20;
964 ++ unsigned int slot;
965 ++
966 ++ for (slot = 0; slot < num_pci_slots; slot++) {
967 ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x0));
968 ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x1));
969 ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x2));
970 ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x3));
971 ++ pci_add_dma_alias(pdev, PCI_DEVFN(slot, 0x4));
972 ++ }
973 ++}
974 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2954, quirk_pex_vca_alias);
975 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2955, quirk_pex_vca_alias);
976 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2956, quirk_pex_vca_alias);
977 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2958, quirk_pex_vca_alias);
978 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2959, quirk_pex_vca_alias);
979 ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x295A, quirk_pex_vca_alias);
980 ++
981 + /*
982 + * The IOMMU and interrupt controller on Broadcom Vulcan/Cavium ThunderX2 are
983 + * associated not at the root bus, but at a bridge below. This quirk avoids
984 +diff --git a/drivers/phy/motorola/phy-cpcap-usb.c b/drivers/phy/motorola/phy-cpcap-usb.c
985 +index 4ba3634009af..593c77dbde2e 100644
986 +--- a/drivers/phy/motorola/phy-cpcap-usb.c
987 ++++ b/drivers/phy/motorola/phy-cpcap-usb.c
988 +@@ -115,7 +115,7 @@ struct cpcap_usb_ints_state {
989 + enum cpcap_gpio_mode {
990 + CPCAP_DM_DP,
991 + CPCAP_MDM_RX_TX,
992 +- CPCAP_UNKNOWN,
993 ++ CPCAP_UNKNOWN_DISABLED, /* Seems to disable USB lines */
994 + CPCAP_OTG_DM_DP,
995 + };
996 +
997 +@@ -379,7 +379,8 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata)
998 + {
999 + int error;
1000 +
1001 +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP);
1002 ++ /* Disable lines to prevent glitches from waking up mdm6600 */
1003 ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED);
1004 + if (error)
1005 + goto out_err;
1006 +
1007 +@@ -406,6 +407,11 @@ static int cpcap_usb_set_uart_mode(struct cpcap_phy_ddata *ddata)
1008 + if (error)
1009 + goto out_err;
1010 +
1011 ++ /* Enable UART mode */
1012 ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_DM_DP);
1013 ++ if (error)
1014 ++ goto out_err;
1015 ++
1016 + return 0;
1017 +
1018 + out_err:
1019 +@@ -418,7 +424,8 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata)
1020 + {
1021 + int error;
1022 +
1023 +- error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP);
1024 ++ /* Disable lines to prevent glitches from waking up mdm6600 */
1025 ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_UNKNOWN_DISABLED);
1026 + if (error)
1027 + return error;
1028 +
1029 +@@ -458,6 +465,11 @@ static int cpcap_usb_set_usb_mode(struct cpcap_phy_ddata *ddata)
1030 + if (error)
1031 + goto out_err;
1032 +
1033 ++ /* Enable USB mode */
1034 ++ error = cpcap_usb_gpio_set_mode(ddata, CPCAP_OTG_DM_DP);
1035 ++ if (error)
1036 ++ goto out_err;
1037 ++
1038 + return 0;
1039 +
1040 + out_err:
1041 +diff --git a/drivers/phy/qualcomm/phy-qcom-qmp.c b/drivers/phy/qualcomm/phy-qcom-qmp.c
1042 +index 4c470104a0d6..cf515928fed0 100644
1043 +--- a/drivers/phy/qualcomm/phy-qcom-qmp.c
1044 ++++ b/drivers/phy/qualcomm/phy-qcom-qmp.c
1045 +@@ -66,7 +66,7 @@
1046 + /* QPHY_V3_PCS_MISC_CLAMP_ENABLE register bits */
1047 + #define CLAMP_EN BIT(0) /* enables i/o clamp_n */
1048 +
1049 +-#define PHY_INIT_COMPLETE_TIMEOUT 1000
1050 ++#define PHY_INIT_COMPLETE_TIMEOUT 10000
1051 + #define POWER_DOWN_DELAY_US_MIN 10
1052 + #define POWER_DOWN_DELAY_US_MAX 11
1053 +
1054 +diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
1055 +index 3433986d5220..949dbc8aab41 100644
1056 +--- a/drivers/platform/x86/dell-laptop.c
1057 ++++ b/drivers/platform/x86/dell-laptop.c
1058 +@@ -37,6 +37,7 @@
1059 +
1060 + struct quirk_entry {
1061 + bool touchpad_led;
1062 ++ bool kbd_led_not_present;
1063 + bool kbd_led_levels_off_1;
1064 + bool kbd_missing_ac_tag;
1065 +
1066 +@@ -77,6 +78,10 @@ static struct quirk_entry quirk_dell_latitude_e6410 = {
1067 + .kbd_led_levels_off_1 = true,
1068 + };
1069 +
1070 ++static struct quirk_entry quirk_dell_inspiron_1012 = {
1071 ++ .kbd_led_not_present = true,
1072 ++};
1073 ++
1074 + static struct platform_driver platform_driver = {
1075 + .driver = {
1076 + .name = "dell-laptop",
1077 +@@ -314,6 +319,24 @@ static const struct dmi_system_id dell_quirks[] __initconst = {
1078 + },
1079 + .driver_data = &quirk_dell_latitude_e6410,
1080 + },
1081 ++ {
1082 ++ .callback = dmi_matched,
1083 ++ .ident = "Dell Inspiron 1012",
1084 ++ .matches = {
1085 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1086 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1012"),
1087 ++ },
1088 ++ .driver_data = &quirk_dell_inspiron_1012,
1089 ++ },
1090 ++ {
1091 ++ .callback = dmi_matched,
1092 ++ .ident = "Dell Inspiron 1018",
1093 ++ .matches = {
1094 ++ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
1095 ++ DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 1018"),
1096 ++ },
1097 ++ .driver_data = &quirk_dell_inspiron_1012,
1098 ++ },
1099 + { }
1100 + };
1101 +
1102 +@@ -1497,6 +1520,9 @@ static void kbd_init(void)
1103 + {
1104 + int ret;
1105 +
1106 ++ if (quirks && quirks->kbd_led_not_present)
1107 ++ return;
1108 ++
1109 + ret = kbd_init_info();
1110 + kbd_init_tokens();
1111 +
1112 +diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
1113 +index ac2eb89ef7a5..5a47e28e38c1 100644
1114 +--- a/drivers/spi/spi-dw.c
1115 ++++ b/drivers/spi/spi-dw.c
1116 +@@ -179,9 +179,11 @@ static inline u32 rx_max(struct dw_spi *dws)
1117 +
1118 + static void dw_writer(struct dw_spi *dws)
1119 + {
1120 +- u32 max = tx_max(dws);
1121 ++ u32 max;
1122 + u16 txw = 0;
1123 +
1124 ++ spin_lock(&dws->buf_lock);
1125 ++ max = tx_max(dws);
1126 + while (max--) {
1127 + /* Set the tx word if the transfer's original "tx" is not null */
1128 + if (dws->tx_end - dws->len) {
1129 +@@ -193,13 +195,16 @@ static void dw_writer(struct dw_spi *dws)
1130 + dw_write_io_reg(dws, DW_SPI_DR, txw);
1131 + dws->tx += dws->n_bytes;
1132 + }
1133 ++ spin_unlock(&dws->buf_lock);
1134 + }
1135 +
1136 + static void dw_reader(struct dw_spi *dws)
1137 + {
1138 +- u32 max = rx_max(dws);
1139 ++ u32 max;
1140 + u16 rxw;
1141 +
1142 ++ spin_lock(&dws->buf_lock);
1143 ++ max = rx_max(dws);
1144 + while (max--) {
1145 + rxw = dw_read_io_reg(dws, DW_SPI_DR);
1146 + /* Care rx only if the transfer's original "rx" is not null */
1147 +@@ -211,6 +216,7 @@ static void dw_reader(struct dw_spi *dws)
1148 + }
1149 + dws->rx += dws->n_bytes;
1150 + }
1151 ++ spin_unlock(&dws->buf_lock);
1152 + }
1153 +
1154 + static void int_error_stop(struct dw_spi *dws, const char *msg)
1155 +@@ -283,18 +289,20 @@ static int dw_spi_transfer_one(struct spi_controller *master,
1156 + {
1157 + struct dw_spi *dws = spi_controller_get_devdata(master);
1158 + struct chip_data *chip = spi_get_ctldata(spi);
1159 ++ unsigned long flags;
1160 + u8 imask = 0;
1161 + u16 txlevel = 0;
1162 + u32 cr0;
1163 + int ret;
1164 +
1165 + dws->dma_mapped = 0;
1166 +-
1167 ++ spin_lock_irqsave(&dws->buf_lock, flags);
1168 + dws->tx = (void *)transfer->tx_buf;
1169 + dws->tx_end = dws->tx + transfer->len;
1170 + dws->rx = transfer->rx_buf;
1171 + dws->rx_end = dws->rx + transfer->len;
1172 + dws->len = transfer->len;
1173 ++ spin_unlock_irqrestore(&dws->buf_lock, flags);
1174 +
1175 + spi_enable_chip(dws, 0);
1176 +
1177 +@@ -485,6 +493,7 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
1178 + dws->type = SSI_MOTO_SPI;
1179 + dws->dma_inited = 0;
1180 + dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);
1181 ++ spin_lock_init(&dws->buf_lock);
1182 +
1183 + spi_controller_set_devdata(master, dws);
1184 +
1185 +diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
1186 +index 0168b08364d5..20a09fe79ae7 100644
1187 +--- a/drivers/spi/spi-dw.h
1188 ++++ b/drivers/spi/spi-dw.h
1189 +@@ -118,6 +118,7 @@ struct dw_spi {
1190 + size_t len;
1191 + void *tx;
1192 + void *tx_end;
1193 ++ spinlock_t buf_lock;
1194 + void *rx;
1195 + void *rx_end;
1196 + int dma_mapped;
1197 +diff --git a/drivers/staging/most/net/net.c b/drivers/staging/most/net/net.c
1198 +index 30d816b7e165..ff80834ef04a 100644
1199 +--- a/drivers/staging/most/net/net.c
1200 ++++ b/drivers/staging/most/net/net.c
1201 +@@ -81,6 +81,11 @@ static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
1202 + unsigned int payload_len = skb->len - ETH_HLEN;
1203 + unsigned int mdp_len = payload_len + MDP_HDR_LEN;
1204 +
1205 ++ if (mdp_len < skb->len) {
1206 ++ pr_err("drop: too large packet! (%u)\n", skb->len);
1207 ++ return -EINVAL;
1208 ++ }
1209 ++
1210 + if (mbo->buffer_length < mdp_len) {
1211 + pr_err("drop: too small buffer! (%d for %d)\n",
1212 + mbo->buffer_length, mdp_len);
1213 +@@ -128,6 +133,11 @@ static int skb_to_mep(const struct sk_buff *skb, struct mbo *mbo)
1214 + u8 *buff = mbo->virt_address;
1215 + unsigned int mep_len = skb->len + MEP_HDR_LEN;
1216 +
1217 ++ if (mep_len < skb->len) {
1218 ++ pr_err("drop: too large packet! (%u)\n", skb->len);
1219 ++ return -EINVAL;
1220 ++ }
1221 ++
1222 + if (mbo->buffer_length < mep_len) {
1223 + pr_err("drop: too small buffer! (%d for %d)\n",
1224 + mbo->buffer_length, mep_len);
1225 +diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
1226 +index cabdda259de2..77e59a92e80b 100644
1227 +--- a/drivers/staging/vt6656/device.h
1228 ++++ b/drivers/staging/vt6656/device.h
1229 +@@ -52,6 +52,8 @@
1230 + #define RATE_AUTO 12
1231 +
1232 + #define MAX_RATE 12
1233 ++#define VNT_B_RATES (BIT(RATE_1M) | BIT(RATE_2M) |\
1234 ++ BIT(RATE_5M) | BIT(RATE_11M))
1235 +
1236 + /*
1237 + * device specific
1238 +diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c
1239 +index 504424b19fcf..af0060c74530 100644
1240 +--- a/drivers/staging/vt6656/int.c
1241 ++++ b/drivers/staging/vt6656/int.c
1242 +@@ -97,9 +97,11 @@ static int vnt_int_report_rate(struct vnt_private *priv, u8 pkt_no, u8 tsr)
1243 +
1244 + info->status.rates[0].count = tx_retry;
1245 +
1246 +- if (!(tsr & (TSR_TMO | TSR_RETRYTMO))) {
1247 ++ if (!(tsr & TSR_TMO)) {
1248 + info->status.rates[0].idx = idx;
1249 +- info->flags |= IEEE80211_TX_STAT_ACK;
1250 ++
1251 ++ if (!(info->flags & IEEE80211_TX_CTL_NO_ACK))
1252 ++ info->flags |= IEEE80211_TX_STAT_ACK;
1253 + }
1254 +
1255 + ieee80211_tx_status_irqsafe(priv->hw, context->skb);
1256 +diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
1257 +index ff9cf0f9e7de..36562ac94c1f 100644
1258 +--- a/drivers/staging/vt6656/main_usb.c
1259 ++++ b/drivers/staging/vt6656/main_usb.c
1260 +@@ -978,6 +978,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id)
1261 + ieee80211_hw_set(priv->hw, RX_INCLUDES_FCS);
1262 + ieee80211_hw_set(priv->hw, REPORTS_TX_ACK_STATUS);
1263 + ieee80211_hw_set(priv->hw, SUPPORTS_PS);
1264 ++ ieee80211_hw_set(priv->hw, PS_NULLFUNC_STACK);
1265 +
1266 + priv->hw->max_signal = 100;
1267 +
1268 +diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c
1269 +index 9def0748ffee..4b4f07fbb9bf 100644
1270 +--- a/drivers/staging/vt6656/rxtx.c
1271 ++++ b/drivers/staging/vt6656/rxtx.c
1272 +@@ -278,11 +278,9 @@ static u16 vnt_rxtx_datahead_g(struct vnt_usb_send_context *tx_context,
1273 + PK_TYPE_11B, &buf->b);
1274 +
1275 + /* Get Duration and TimeStamp */
1276 +- if (ieee80211_is_pspoll(hdr->frame_control)) {
1277 +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
1278 +-
1279 +- buf->duration_a = dur;
1280 +- buf->duration_b = dur;
1281 ++ if (ieee80211_is_nullfunc(hdr->frame_control)) {
1282 ++ buf->duration_a = hdr->duration_id;
1283 ++ buf->duration_b = hdr->duration_id;
1284 + } else {
1285 + buf->duration_a = vnt_get_duration_le(priv,
1286 + tx_context->pkt_type, need_ack);
1287 +@@ -371,10 +369,8 @@ static u16 vnt_rxtx_datahead_ab(struct vnt_usb_send_context *tx_context,
1288 + tx_context->pkt_type, &buf->ab);
1289 +
1290 + /* Get Duration and TimeStampOff */
1291 +- if (ieee80211_is_pspoll(hdr->frame_control)) {
1292 +- __le16 dur = cpu_to_le16(priv->current_aid | BIT(14) | BIT(15));
1293 +-
1294 +- buf->duration = dur;
1295 ++ if (ieee80211_is_nullfunc(hdr->frame_control)) {
1296 ++ buf->duration = hdr->duration_id;
1297 + } else {
1298 + buf->duration = vnt_get_duration_le(priv, tx_context->pkt_type,
1299 + need_ack);
1300 +@@ -815,10 +811,14 @@ int vnt_tx_packet(struct vnt_private *priv, struct sk_buff *skb)
1301 + if (info->band == NL80211_BAND_5GHZ) {
1302 + pkt_type = PK_TYPE_11A;
1303 + } else {
1304 +- if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
1305 +- pkt_type = PK_TYPE_11GB;
1306 +- else
1307 +- pkt_type = PK_TYPE_11GA;
1308 ++ if (tx_rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
1309 ++ if (priv->basic_rates & VNT_B_RATES)
1310 ++ pkt_type = PK_TYPE_11GB;
1311 ++ else
1312 ++ pkt_type = PK_TYPE_11GA;
1313 ++ } else {
1314 ++ pkt_type = PK_TYPE_11A;
1315 ++ }
1316 + }
1317 + } else {
1318 + pkt_type = PK_TYPE_11B;
1319 +diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
1320 +index 7350fe5d96a3..a8860d2aee68 100644
1321 +--- a/drivers/staging/wlan-ng/prism2mgmt.c
1322 ++++ b/drivers/staging/wlan-ng/prism2mgmt.c
1323 +@@ -959,7 +959,7 @@ int prism2mgmt_flashdl_state(struct wlandevice *wlandev, void *msgp)
1324 + }
1325 + }
1326 +
1327 +- return 0;
1328 ++ return result;
1329 + }
1330 +
1331 + /*----------------------------------------------------------------
1332 +diff --git a/drivers/tty/serial/8250/8250_bcm2835aux.c b/drivers/tty/serial/8250/8250_bcm2835aux.c
1333 +index bd53661103eb..3173d98cb42d 100644
1334 +--- a/drivers/tty/serial/8250/8250_bcm2835aux.c
1335 ++++ b/drivers/tty/serial/8250/8250_bcm2835aux.c
1336 +@@ -115,7 +115,7 @@ static int bcm2835aux_serial_remove(struct platform_device *pdev)
1337 + {
1338 + struct bcm2835aux_data *data = platform_get_drvdata(pdev);
1339 +
1340 +- serial8250_unregister_port(data->uart.port.line);
1341 ++ serial8250_unregister_port(data->line);
1342 + clk_disable_unprepare(data->clk);
1343 +
1344 + return 0;
1345 +diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
1346 +index f52fcbc5c971..6666d2a52bf5 100644
1347 +--- a/drivers/usb/dwc3/core.c
1348 ++++ b/drivers/usb/dwc3/core.c
1349 +@@ -1199,6 +1199,9 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
1350 + /* do nothing */
1351 + break;
1352 + }
1353 ++
1354 ++ /* de-assert DRVVBUS for HOST and OTG mode */
1355 ++ dwc3_set_prtcap(dwc, DWC3_GCTL_PRTCAP_DEVICE);
1356 + }
1357 +
1358 + static void dwc3_get_properties(struct dwc3 *dwc)
1359 +diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
1360 +index 8fa39e664940..edf7984707b7 100644
1361 +--- a/drivers/usb/dwc3/dwc3-pci.c
1362 ++++ b/drivers/usb/dwc3/dwc3-pci.c
1363 +@@ -34,6 +34,7 @@
1364 + #define PCI_DEVICE_ID_INTEL_GLK 0x31aa
1365 + #define PCI_DEVICE_ID_INTEL_CNPLP 0x9dee
1366 + #define PCI_DEVICE_ID_INTEL_CNPH 0xa36e
1367 ++#define PCI_DEVICE_ID_INTEL_CNPV 0xa3b0
1368 + #define PCI_DEVICE_ID_INTEL_ICLLP 0x34ee
1369 +
1370 + #define PCI_INTEL_BXT_DSM_GUID "732b85d5-b7a7-4a1b-9ba0-4bbd00ffd511"
1371 +@@ -340,6 +341,9 @@ static const struct pci_device_id dwc3_pci_id_table[] = {
1372 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPH),
1373 + (kernel_ulong_t) &dwc3_pci_intel_properties, },
1374 +
1375 ++ { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_CNPV),
1376 ++ (kernel_ulong_t) &dwc3_pci_intel_properties, },
1377 ++
1378 + { PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICLLP),
1379 + (kernel_ulong_t) &dwc3_pci_intel_properties, },
1380 +
1381 +diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
1382 +index 7643716b5299..badd38586b54 100644
1383 +--- a/drivers/usb/serial/ir-usb.c
1384 ++++ b/drivers/usb/serial/ir-usb.c
1385 +@@ -45,9 +45,10 @@ static int buffer_size;
1386 + static int xbof = -1;
1387 +
1388 + static int ir_startup (struct usb_serial *serial);
1389 +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port);
1390 +-static int ir_prepare_write_buffer(struct usb_serial_port *port,
1391 +- void *dest, size_t size);
1392 ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port,
1393 ++ const unsigned char *buf, int count);
1394 ++static int ir_write_room(struct tty_struct *tty);
1395 ++static void ir_write_bulk_callback(struct urb *urb);
1396 + static void ir_process_read_urb(struct urb *urb);
1397 + static void ir_set_termios(struct tty_struct *tty,
1398 + struct usb_serial_port *port, struct ktermios *old_termios);
1399 +@@ -77,8 +78,9 @@ static struct usb_serial_driver ir_device = {
1400 + .num_ports = 1,
1401 + .set_termios = ir_set_termios,
1402 + .attach = ir_startup,
1403 +- .open = ir_open,
1404 +- .prepare_write_buffer = ir_prepare_write_buffer,
1405 ++ .write = ir_write,
1406 ++ .write_room = ir_write_room,
1407 ++ .write_bulk_callback = ir_write_bulk_callback,
1408 + .process_read_urb = ir_process_read_urb,
1409 + };
1410 +
1411 +@@ -195,6 +197,9 @@ static int ir_startup(struct usb_serial *serial)
1412 + struct usb_irda_cs_descriptor *irda_desc;
1413 + int rates;
1414 +
1415 ++ if (serial->num_bulk_in < 1 || serial->num_bulk_out < 1)
1416 ++ return -ENODEV;
1417 ++
1418 + irda_desc = irda_usb_find_class_desc(serial, 0);
1419 + if (!irda_desc) {
1420 + dev_err(&serial->dev->dev,
1421 +@@ -251,35 +256,102 @@ static int ir_startup(struct usb_serial *serial)
1422 + return 0;
1423 + }
1424 +
1425 +-static int ir_open(struct tty_struct *tty, struct usb_serial_port *port)
1426 ++static int ir_write(struct tty_struct *tty, struct usb_serial_port *port,
1427 ++ const unsigned char *buf, int count)
1428 + {
1429 +- int i;
1430 ++ struct urb *urb = NULL;
1431 ++ unsigned long flags;
1432 ++ int ret;
1433 +
1434 +- for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
1435 +- port->write_urbs[i]->transfer_flags = URB_ZERO_PACKET;
1436 ++ if (port->bulk_out_size == 0)
1437 ++ return -EINVAL;
1438 +
1439 +- /* Start reading from the device */
1440 +- return usb_serial_generic_open(tty, port);
1441 +-}
1442 ++ if (count == 0)
1443 ++ return 0;
1444 +
1445 +-static int ir_prepare_write_buffer(struct usb_serial_port *port,
1446 +- void *dest, size_t size)
1447 +-{
1448 +- unsigned char *buf = dest;
1449 +- int count;
1450 ++ count = min(count, port->bulk_out_size - 1);
1451 ++
1452 ++ spin_lock_irqsave(&port->lock, flags);
1453 ++ if (__test_and_clear_bit(0, &port->write_urbs_free)) {
1454 ++ urb = port->write_urbs[0];
1455 ++ port->tx_bytes += count;
1456 ++ }
1457 ++ spin_unlock_irqrestore(&port->lock, flags);
1458 ++
1459 ++ if (!urb)
1460 ++ return 0;
1461 +
1462 + /*
1463 + * The first byte of the packet we send to the device contains an
1464 +- * inbound header which indicates an additional number of BOFs and
1465 ++ * outbound header which indicates an additional number of BOFs and
1466 + * a baud rate change.
1467 + *
1468 + * See section 5.4.2.2 of the USB IrDA spec.
1469 + */
1470 +- *buf = ir_xbof | ir_baud;
1471 ++ *(u8 *)urb->transfer_buffer = ir_xbof | ir_baud;
1472 ++
1473 ++ memcpy(urb->transfer_buffer + 1, buf, count);
1474 ++
1475 ++ urb->transfer_buffer_length = count + 1;
1476 ++ urb->transfer_flags = URB_ZERO_PACKET;
1477 ++
1478 ++ ret = usb_submit_urb(urb, GFP_ATOMIC);
1479 ++ if (ret) {
1480 ++ dev_err(&port->dev, "failed to submit write urb: %d\n", ret);
1481 ++
1482 ++ spin_lock_irqsave(&port->lock, flags);
1483 ++ __set_bit(0, &port->write_urbs_free);
1484 ++ port->tx_bytes -= count;
1485 ++ spin_unlock_irqrestore(&port->lock, flags);
1486 ++
1487 ++ return ret;
1488 ++ }
1489 ++
1490 ++ return count;
1491 ++}
1492 ++
1493 ++static void ir_write_bulk_callback(struct urb *urb)
1494 ++{
1495 ++ struct usb_serial_port *port = urb->context;
1496 ++ int status = urb->status;
1497 ++ unsigned long flags;
1498 ++
1499 ++ spin_lock_irqsave(&port->lock, flags);
1500 ++ __set_bit(0, &port->write_urbs_free);
1501 ++ port->tx_bytes -= urb->transfer_buffer_length - 1;
1502 ++ spin_unlock_irqrestore(&port->lock, flags);
1503 ++
1504 ++ switch (status) {
1505 ++ case 0:
1506 ++ break;
1507 ++ case -ENOENT:
1508 ++ case -ECONNRESET:
1509 ++ case -ESHUTDOWN:
1510 ++ dev_dbg(&port->dev, "write urb stopped: %d\n", status);
1511 ++ return;
1512 ++ case -EPIPE:
1513 ++ dev_err(&port->dev, "write urb stopped: %d\n", status);
1514 ++ return;
1515 ++ default:
1516 ++ dev_err(&port->dev, "nonzero write-urb status: %d\n", status);
1517 ++ break;
1518 ++ }
1519 ++
1520 ++ usb_serial_port_softint(port);
1521 ++}
1522 ++
1523 ++static int ir_write_room(struct tty_struct *tty)
1524 ++{
1525 ++ struct usb_serial_port *port = tty->driver_data;
1526 ++ int count = 0;
1527 ++
1528 ++ if (port->bulk_out_size == 0)
1529 ++ return 0;
1530 ++
1531 ++ if (test_bit(0, &port->write_urbs_free))
1532 ++ count = port->bulk_out_size - 1;
1533 +
1534 +- count = kfifo_out_locked(&port->write_fifo, buf + 1, size - 1,
1535 +- &port->lock);
1536 +- return count + 1;
1537 ++ return count;
1538 + }
1539 +
1540 + static void ir_process_read_urb(struct urb *urb)
1541 +@@ -332,34 +404,34 @@ static void ir_set_termios(struct tty_struct *tty,
1542 +
1543 + switch (baud) {
1544 + case 2400:
1545 +- ir_baud = USB_IRDA_BR_2400;
1546 ++ ir_baud = USB_IRDA_LS_2400;
1547 + break;
1548 + case 9600:
1549 +- ir_baud = USB_IRDA_BR_9600;
1550 ++ ir_baud = USB_IRDA_LS_9600;
1551 + break;
1552 + case 19200:
1553 +- ir_baud = USB_IRDA_BR_19200;
1554 ++ ir_baud = USB_IRDA_LS_19200;
1555 + break;
1556 + case 38400:
1557 +- ir_baud = USB_IRDA_BR_38400;
1558 ++ ir_baud = USB_IRDA_LS_38400;
1559 + break;
1560 + case 57600:
1561 +- ir_baud = USB_IRDA_BR_57600;
1562 ++ ir_baud = USB_IRDA_LS_57600;
1563 + break;
1564 + case 115200:
1565 +- ir_baud = USB_IRDA_BR_115200;
1566 ++ ir_baud = USB_IRDA_LS_115200;
1567 + break;
1568 + case 576000:
1569 +- ir_baud = USB_IRDA_BR_576000;
1570 ++ ir_baud = USB_IRDA_LS_576000;
1571 + break;
1572 + case 1152000:
1573 +- ir_baud = USB_IRDA_BR_1152000;
1574 ++ ir_baud = USB_IRDA_LS_1152000;
1575 + break;
1576 + case 4000000:
1577 +- ir_baud = USB_IRDA_BR_4000000;
1578 ++ ir_baud = USB_IRDA_LS_4000000;
1579 + break;
1580 + default:
1581 +- ir_baud = USB_IRDA_BR_9600;
1582 ++ ir_baud = USB_IRDA_LS_9600;
1583 + baud = 9600;
1584 + }
1585 +
1586 +diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h
1587 +index d0bdebd87ce3..1b23741036ee 100644
1588 +--- a/drivers/usb/storage/unusual_uas.h
1589 ++++ b/drivers/usb/storage/unusual_uas.h
1590 +@@ -87,12 +87,15 @@ UNUSUAL_DEV(0x2537, 0x1068, 0x0000, 0x9999,
1591 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1592 + US_FL_IGNORE_UAS),
1593 +
1594 +-/* Reported-by: Takeo Nakayama <javhera@×××.com> */
1595 ++/*
1596 ++ * Initially Reported-by: Takeo Nakayama <javhera@×××.com>
1597 ++ * UAS Ignore Reported by Steven Ellis <sellis@××××××.com>
1598 ++ */
1599 + UNUSUAL_DEV(0x357d, 0x7788, 0x0000, 0x9999,
1600 + "JMicron",
1601 + "JMS566",
1602 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1603 +- US_FL_NO_REPORT_OPCODES),
1604 ++ US_FL_NO_REPORT_OPCODES | US_FL_IGNORE_UAS),
1605 +
1606 + /* Reported-by: Hans de Goede <hdegoede@××××××.com> */
1607 + UNUSUAL_DEV(0x4971, 0x1012, 0x0000, 0x9999,
1608 +diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
1609 +index b165c46aca74..709d4de11f40 100644
1610 +--- a/drivers/watchdog/Kconfig
1611 ++++ b/drivers/watchdog/Kconfig
1612 +@@ -594,6 +594,7 @@ config MAX63XX_WATCHDOG
1613 + config MAX77620_WATCHDOG
1614 + tristate "Maxim Max77620 Watchdog Timer"
1615 + depends on MFD_MAX77620 || COMPILE_TEST
1616 ++ select WATCHDOG_CORE
1617 + help
1618 + This is the driver for the Max77620 watchdog timer.
1619 + Say 'Y' here to enable the watchdog timer support for
1620 +diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c
1621 +index e60f55702ab7..d2e79cf70e77 100644
1622 +--- a/drivers/watchdog/rn5t618_wdt.c
1623 ++++ b/drivers/watchdog/rn5t618_wdt.c
1624 +@@ -193,6 +193,7 @@ static struct platform_driver rn5t618_wdt_driver = {
1625 +
1626 + module_platform_driver(rn5t618_wdt_driver);
1627 +
1628 ++MODULE_ALIAS("platform:rn5t618-wdt");
1629 + MODULE_AUTHOR("Beniamino Galvani <b.galvani@×××××.com>");
1630 + MODULE_DESCRIPTION("RN5T618 watchdog driver");
1631 + MODULE_LICENSE("GPL v2");
1632 +diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
1633 +index 766974fe637a..14265b4bbcc0 100644
1634 +--- a/fs/cifs/smb2misc.c
1635 ++++ b/fs/cifs/smb2misc.c
1636 +@@ -750,7 +750,7 @@ __smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
1637 + {
1638 + struct close_cancelled_open *cancelled;
1639 +
1640 +- cancelled = kzalloc(sizeof(*cancelled), GFP_KERNEL);
1641 ++ cancelled = kzalloc(sizeof(*cancelled), GFP_ATOMIC);
1642 + if (!cancelled)
1643 + return -ENOMEM;
1644 +
1645 +diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
1646 +index 7b81dad712de..37d9b70ed8f0 100644
1647 +--- a/include/linux/power/smartreflex.h
1648 ++++ b/include/linux/power/smartreflex.h
1649 +@@ -296,6 +296,9 @@ struct omap_sr_data {
1650 + struct voltagedomain *voltdm;
1651 + };
1652 +
1653 ++
1654 ++extern struct omap_sr_data omap_sr_pdata[OMAP_SR_NR];
1655 ++
1656 + #ifdef CONFIG_POWER_AVS_OMAP
1657 +
1658 + /* Smartreflex module enable/disable interface */
1659 +diff --git a/include/linux/usb/irda.h b/include/linux/usb/irda.h
1660 +index 396d2b043e64..556a801efce3 100644
1661 +--- a/include/linux/usb/irda.h
1662 ++++ b/include/linux/usb/irda.h
1663 +@@ -119,11 +119,22 @@ struct usb_irda_cs_descriptor {
1664 + * 6 - 115200 bps
1665 + * 7 - 576000 bps
1666 + * 8 - 1.152 Mbps
1667 +- * 9 - 5 mbps
1668 ++ * 9 - 4 Mbps
1669 + * 10..15 - Reserved
1670 + */
1671 + #define USB_IRDA_STATUS_LINK_SPEED 0x0f
1672 +
1673 ++#define USB_IRDA_LS_NO_CHANGE 0
1674 ++#define USB_IRDA_LS_2400 1
1675 ++#define USB_IRDA_LS_9600 2
1676 ++#define USB_IRDA_LS_19200 3
1677 ++#define USB_IRDA_LS_38400 4
1678 ++#define USB_IRDA_LS_57600 5
1679 ++#define USB_IRDA_LS_115200 6
1680 ++#define USB_IRDA_LS_576000 7
1681 ++#define USB_IRDA_LS_1152000 8
1682 ++#define USB_IRDA_LS_4000000 9
1683 ++
1684 + /* The following is a 4-bit value used only for
1685 + * outbound header:
1686 + *
1687 +diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
1688 +index 75a3f3fdb359..c1162f2fde78 100644
1689 +--- a/include/net/pkt_cls.h
1690 ++++ b/include/net/pkt_cls.h
1691 +@@ -206,31 +206,38 @@ __cls_set_class(unsigned long *clp, unsigned long cl)
1692 + return xchg(clp, cl);
1693 + }
1694 +
1695 +-static inline unsigned long
1696 +-cls_set_class(struct Qdisc *q, unsigned long *clp, unsigned long cl)
1697 ++static inline void
1698 ++__tcf_bind_filter(struct Qdisc *q, struct tcf_result *r, unsigned long base)
1699 + {
1700 +- unsigned long old_cl;
1701 ++ unsigned long cl;
1702 +
1703 +- sch_tree_lock(q);
1704 +- old_cl = __cls_set_class(clp, cl);
1705 +- sch_tree_unlock(q);
1706 +- return old_cl;
1707 ++ cl = q->ops->cl_ops->bind_tcf(q, base, r->classid);
1708 ++ cl = __cls_set_class(&r->class, cl);
1709 ++ if (cl)
1710 ++ q->ops->cl_ops->unbind_tcf(q, cl);
1711 + }
1712 +
1713 + static inline void
1714 + tcf_bind_filter(struct tcf_proto *tp, struct tcf_result *r, unsigned long base)
1715 + {
1716 + struct Qdisc *q = tp->chain->block->q;
1717 +- unsigned long cl;
1718 +
1719 + /* Check q as it is not set for shared blocks. In that case,
1720 + * setting class is not supported.
1721 + */
1722 + if (!q)
1723 + return;
1724 +- cl = q->ops->cl_ops->bind_tcf(q, base, r->classid);
1725 +- cl = cls_set_class(q, &r->class, cl);
1726 +- if (cl)
1727 ++ sch_tree_lock(q);
1728 ++ __tcf_bind_filter(q, r, base);
1729 ++ sch_tree_unlock(q);
1730 ++}
1731 ++
1732 ++static inline void
1733 ++__tcf_unbind_filter(struct Qdisc *q, struct tcf_result *r)
1734 ++{
1735 ++ unsigned long cl;
1736 ++
1737 ++ if ((cl = __cls_set_class(&r->class, 0)) != 0)
1738 + q->ops->cl_ops->unbind_tcf(q, cl);
1739 + }
1740 +
1741 +@@ -238,12 +245,10 @@ static inline void
1742 + tcf_unbind_filter(struct tcf_proto *tp, struct tcf_result *r)
1743 + {
1744 + struct Qdisc *q = tp->chain->block->q;
1745 +- unsigned long cl;
1746 +
1747 + if (!q)
1748 + return;
1749 +- if ((cl = __cls_set_class(&r->class, 0)) != 0)
1750 +- q->ops->cl_ops->unbind_tcf(q, cl);
1751 ++ __tcf_unbind_filter(q, r);
1752 + }
1753 +
1754 + struct tcf_exts {
1755 +diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
1756 +index c9cd5086bd54..d737a6a2600b 100644
1757 +--- a/include/net/sch_generic.h
1758 ++++ b/include/net/sch_generic.h
1759 +@@ -273,7 +273,8 @@ struct tcf_proto_ops {
1760 + int (*reoffload)(struct tcf_proto *tp, bool add,
1761 + tc_setup_cb_t *cb, void *cb_priv,
1762 + struct netlink_ext_ack *extack);
1763 +- void (*bind_class)(void *, u32, unsigned long);
1764 ++ void (*bind_class)(void *, u32, unsigned long,
1765 ++ void *, unsigned long);
1766 + void * (*tmplt_create)(struct net *net,
1767 + struct tcf_chain *chain,
1768 + struct nlattr **tca,
1769 +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
1770 +index f0abb8fe0ae9..7f4f4ab5bfef 100644
1771 +--- a/kernel/sched/fair.c
1772 ++++ b/kernel/sched/fair.c
1773 +@@ -282,66 +282,72 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
1774 + return grp->my_q;
1775 + }
1776 +
1777 +-static inline void list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1778 ++static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1779 + {
1780 +- if (!cfs_rq->on_list) {
1781 +- struct rq *rq = rq_of(cfs_rq);
1782 +- int cpu = cpu_of(rq);
1783 ++ struct rq *rq = rq_of(cfs_rq);
1784 ++ int cpu = cpu_of(rq);
1785 ++
1786 ++ if (cfs_rq->on_list)
1787 ++ return rq->tmp_alone_branch == &rq->leaf_cfs_rq_list;
1788 ++
1789 ++ cfs_rq->on_list = 1;
1790 ++
1791 ++ /*
1792 ++ * Ensure we either appear before our parent (if already
1793 ++ * enqueued) or force our parent to appear after us when it is
1794 ++ * enqueued. The fact that we always enqueue bottom-up
1795 ++ * reduces this to two cases and a special case for the root
1796 ++ * cfs_rq. Furthermore, it also means that we will always reset
1797 ++ * tmp_alone_branch either when the branch is connected
1798 ++ * to a tree or when we reach the top of the tree
1799 ++ */
1800 ++ if (cfs_rq->tg->parent &&
1801 ++ cfs_rq->tg->parent->cfs_rq[cpu]->on_list) {
1802 + /*
1803 +- * Ensure we either appear before our parent (if already
1804 +- * enqueued) or force our parent to appear after us when it is
1805 +- * enqueued. The fact that we always enqueue bottom-up
1806 +- * reduces this to two cases and a special case for the root
1807 +- * cfs_rq. Furthermore, it also means that we will always reset
1808 +- * tmp_alone_branch either when the branch is connected
1809 +- * to a tree or when we reach the beg of the tree
1810 ++ * If parent is already on the list, we add the child
1811 ++ * just before. Thanks to circular linked property of
1812 ++ * the list, this means to put the child at the tail
1813 ++ * of the list that starts by parent.
1814 + */
1815 +- if (cfs_rq->tg->parent &&
1816 +- cfs_rq->tg->parent->cfs_rq[cpu]->on_list) {
1817 +- /*
1818 +- * If parent is already on the list, we add the child
1819 +- * just before. Thanks to circular linked property of
1820 +- * the list, this means to put the child at the tail
1821 +- * of the list that starts by parent.
1822 +- */
1823 +- list_add_tail_rcu(&cfs_rq->leaf_cfs_rq_list,
1824 +- &(cfs_rq->tg->parent->cfs_rq[cpu]->leaf_cfs_rq_list));
1825 +- /*
1826 +- * The branch is now connected to its tree so we can
1827 +- * reset tmp_alone_branch to the beginning of the
1828 +- * list.
1829 +- */
1830 +- rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
1831 +- } else if (!cfs_rq->tg->parent) {
1832 +- /*
1833 +- * cfs rq without parent should be put
1834 +- * at the tail of the list.
1835 +- */
1836 +- list_add_tail_rcu(&cfs_rq->leaf_cfs_rq_list,
1837 +- &rq->leaf_cfs_rq_list);
1838 +- /*
1839 +- * We have reach the beg of a tree so we can reset
1840 +- * tmp_alone_branch to the beginning of the list.
1841 +- */
1842 +- rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
1843 +- } else {
1844 +- /*
1845 +- * The parent has not already been added so we want to
1846 +- * make sure that it will be put after us.
1847 +- * tmp_alone_branch points to the beg of the branch
1848 +- * where we will add parent.
1849 +- */
1850 +- list_add_rcu(&cfs_rq->leaf_cfs_rq_list,
1851 +- rq->tmp_alone_branch);
1852 +- /*
1853 +- * update tmp_alone_branch to points to the new beg
1854 +- * of the branch
1855 +- */
1856 +- rq->tmp_alone_branch = &cfs_rq->leaf_cfs_rq_list;
1857 +- }
1858 ++ list_add_tail_rcu(&cfs_rq->leaf_cfs_rq_list,
1859 ++ &(cfs_rq->tg->parent->cfs_rq[cpu]->leaf_cfs_rq_list));
1860 ++ /*
1861 ++ * The branch is now connected to its tree so we can
1862 ++ * reset tmp_alone_branch to the beginning of the
1863 ++ * list.
1864 ++ */
1865 ++ rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
1866 ++ return true;
1867 ++ }
1868 +
1869 +- cfs_rq->on_list = 1;
1870 ++ if (!cfs_rq->tg->parent) {
1871 ++ /*
1872 ++ * cfs rq without parent should be put
1873 ++ * at the tail of the list.
1874 ++ */
1875 ++ list_add_tail_rcu(&cfs_rq->leaf_cfs_rq_list,
1876 ++ &rq->leaf_cfs_rq_list);
1877 ++ /*
1878 ++ * We have reach the top of a tree so we can reset
1879 ++ * tmp_alone_branch to the beginning of the list.
1880 ++ */
1881 ++ rq->tmp_alone_branch = &rq->leaf_cfs_rq_list;
1882 ++ return true;
1883 + }
1884 ++
1885 ++ /*
1886 ++ * The parent has not already been added so we want to
1887 ++ * make sure that it will be put after us.
1888 ++ * tmp_alone_branch points to the begin of the branch
1889 ++ * where we will add parent.
1890 ++ */
1891 ++ list_add_rcu(&cfs_rq->leaf_cfs_rq_list, rq->tmp_alone_branch);
1892 ++ /*
1893 ++ * update tmp_alone_branch to points to the new begin
1894 ++ * of the branch
1895 ++ */
1896 ++ rq->tmp_alone_branch = &cfs_rq->leaf_cfs_rq_list;
1897 ++ return false;
1898 + }
1899 +
1900 + static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1901 +@@ -352,7 +358,12 @@ static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1902 + }
1903 + }
1904 +
1905 +-/* Iterate through all leaf cfs_rq's on a runqueue: */
1906 ++static inline void assert_list_leaf_cfs_rq(struct rq *rq)
1907 ++{
1908 ++ SCHED_WARN_ON(rq->tmp_alone_branch != &rq->leaf_cfs_rq_list);
1909 ++}
1910 ++
1911 ++/* Iterate through all cfs_rq's on a runqueue in bottom-up order */
1912 + #define for_each_leaf_cfs_rq(rq, cfs_rq) \
1913 + list_for_each_entry_rcu(cfs_rq, &rq->leaf_cfs_rq_list, leaf_cfs_rq_list)
1914 +
1915 +@@ -438,14 +449,19 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
1916 + return NULL;
1917 + }
1918 +
1919 +-static inline void list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1920 ++static inline bool list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1921 + {
1922 ++ return true;
1923 + }
1924 +
1925 + static inline void list_del_leaf_cfs_rq(struct cfs_rq *cfs_rq)
1926 + {
1927 + }
1928 +
1929 ++static inline void assert_list_leaf_cfs_rq(struct rq *rq)
1930 ++{
1931 ++}
1932 ++
1933 + #define for_each_leaf_cfs_rq(rq, cfs_rq) \
1934 + for (cfs_rq = &rq->cfs; cfs_rq; cfs_rq = NULL)
1935 +
1936 +@@ -5005,6 +5021,12 @@ static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq)
1937 + }
1938 +
1939 + #else /* CONFIG_CFS_BANDWIDTH */
1940 ++
1941 ++static inline bool cfs_bandwidth_used(void)
1942 ++{
1943 ++ return false;
1944 ++}
1945 ++
1946 + static inline u64 cfs_rq_clock_task(struct cfs_rq *cfs_rq)
1947 + {
1948 + return rq_clock_task(rq_of(cfs_rq));
1949 +@@ -5160,6 +5182,23 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags)
1950 + if (!se)
1951 + add_nr_running(rq, 1);
1952 +
1953 ++ if (cfs_bandwidth_used()) {
1954 ++ /*
1955 ++ * When bandwidth control is enabled; the cfs_rq_throttled()
1956 ++ * breaks in the above iteration can result in incomplete
1957 ++ * leaf list maintenance, resulting in triggering the assertion
1958 ++ * below.
1959 ++ */
1960 ++ for_each_sched_entity(se) {
1961 ++ cfs_rq = cfs_rq_of(se);
1962 ++
1963 ++ if (list_add_leaf_cfs_rq(cfs_rq))
1964 ++ break;
1965 ++ }
1966 ++ }
1967 ++
1968 ++ assert_list_leaf_cfs_rq(rq);
1969 ++
1970 + hrtick_update(rq);
1971 + }
1972 +
1973 +diff --git a/net/sched/cls_basic.c b/net/sched/cls_basic.c
1974 +index 6a5dce8baf19..14098da696f2 100644
1975 +--- a/net/sched/cls_basic.c
1976 ++++ b/net/sched/cls_basic.c
1977 +@@ -254,12 +254,17 @@ skip:
1978 + }
1979 + }
1980 +
1981 +-static void basic_bind_class(void *fh, u32 classid, unsigned long cl)
1982 ++static void basic_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
1983 ++ unsigned long base)
1984 + {
1985 + struct basic_filter *f = fh;
1986 +
1987 +- if (f && f->res.classid == classid)
1988 +- f->res.class = cl;
1989 ++ if (f && f->res.classid == classid) {
1990 ++ if (cl)
1991 ++ __tcf_bind_filter(q, &f->res, base);
1992 ++ else
1993 ++ __tcf_unbind_filter(q, &f->res);
1994 ++ }
1995 + }
1996 +
1997 + static int basic_dump(struct net *net, struct tcf_proto *tp, void *fh,
1998 +diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
1999 +index fa6fe2fe0f32..5d100126cbf3 100644
2000 +--- a/net/sched/cls_bpf.c
2001 ++++ b/net/sched/cls_bpf.c
2002 +@@ -627,12 +627,17 @@ nla_put_failure:
2003 + return -1;
2004 + }
2005 +
2006 +-static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl)
2007 ++static void cls_bpf_bind_class(void *fh, u32 classid, unsigned long cl,
2008 ++ void *q, unsigned long base)
2009 + {
2010 + struct cls_bpf_prog *prog = fh;
2011 +
2012 +- if (prog && prog->res.classid == classid)
2013 +- prog->res.class = cl;
2014 ++ if (prog && prog->res.classid == classid) {
2015 ++ if (cl)
2016 ++ __tcf_bind_filter(q, &prog->res, base);
2017 ++ else
2018 ++ __tcf_unbind_filter(q, &prog->res);
2019 ++ }
2020 + }
2021 +
2022 + static void cls_bpf_walk(struct tcf_proto *tp, struct tcf_walker *arg)
2023 +diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
2024 +index 09b359784629..22415311f324 100644
2025 +--- a/net/sched/cls_flower.c
2026 ++++ b/net/sched/cls_flower.c
2027 +@@ -1942,12 +1942,17 @@ nla_put_failure:
2028 + return -EMSGSIZE;
2029 + }
2030 +
2031 +-static void fl_bind_class(void *fh, u32 classid, unsigned long cl)
2032 ++static void fl_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2033 ++ unsigned long base)
2034 + {
2035 + struct cls_fl_filter *f = fh;
2036 +
2037 +- if (f && f->res.classid == classid)
2038 +- f->res.class = cl;
2039 ++ if (f && f->res.classid == classid) {
2040 ++ if (cl)
2041 ++ __tcf_bind_filter(q, &f->res, base);
2042 ++ else
2043 ++ __tcf_unbind_filter(q, &f->res);
2044 ++ }
2045 + }
2046 +
2047 + static struct tcf_proto_ops cls_fl_ops __read_mostly = {
2048 +diff --git a/net/sched/cls_fw.c b/net/sched/cls_fw.c
2049 +index 29eeeaf3ea44..cb2c62605fc7 100644
2050 +--- a/net/sched/cls_fw.c
2051 ++++ b/net/sched/cls_fw.c
2052 +@@ -432,12 +432,17 @@ nla_put_failure:
2053 + return -1;
2054 + }
2055 +
2056 +-static void fw_bind_class(void *fh, u32 classid, unsigned long cl)
2057 ++static void fw_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2058 ++ unsigned long base)
2059 + {
2060 + struct fw_filter *f = fh;
2061 +
2062 +- if (f && f->res.classid == classid)
2063 +- f->res.class = cl;
2064 ++ if (f && f->res.classid == classid) {
2065 ++ if (cl)
2066 ++ __tcf_bind_filter(q, &f->res, base);
2067 ++ else
2068 ++ __tcf_unbind_filter(q, &f->res);
2069 ++ }
2070 + }
2071 +
2072 + static struct tcf_proto_ops cls_fw_ops __read_mostly = {
2073 +diff --git a/net/sched/cls_matchall.c b/net/sched/cls_matchall.c
2074 +index 621bc1d5b057..40be745db357 100644
2075 +--- a/net/sched/cls_matchall.c
2076 ++++ b/net/sched/cls_matchall.c
2077 +@@ -310,12 +310,17 @@ nla_put_failure:
2078 + return -1;
2079 + }
2080 +
2081 +-static void mall_bind_class(void *fh, u32 classid, unsigned long cl)
2082 ++static void mall_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2083 ++ unsigned long base)
2084 + {
2085 + struct cls_mall_head *head = fh;
2086 +
2087 +- if (head && head->res.classid == classid)
2088 +- head->res.class = cl;
2089 ++ if (head && head->res.classid == classid) {
2090 ++ if (cl)
2091 ++ __tcf_bind_filter(q, &head->res, base);
2092 ++ else
2093 ++ __tcf_unbind_filter(q, &head->res);
2094 ++ }
2095 + }
2096 +
2097 + static struct tcf_proto_ops cls_mall_ops __read_mostly = {
2098 +diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c
2099 +index 0404aa5fa7cb..37ae23db4a44 100644
2100 +--- a/net/sched/cls_route.c
2101 ++++ b/net/sched/cls_route.c
2102 +@@ -645,12 +645,17 @@ nla_put_failure:
2103 + return -1;
2104 + }
2105 +
2106 +-static void route4_bind_class(void *fh, u32 classid, unsigned long cl)
2107 ++static void route4_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2108 ++ unsigned long base)
2109 + {
2110 + struct route4_filter *f = fh;
2111 +
2112 +- if (f && f->res.classid == classid)
2113 +- f->res.class = cl;
2114 ++ if (f && f->res.classid == classid) {
2115 ++ if (cl)
2116 ++ __tcf_bind_filter(q, &f->res, base);
2117 ++ else
2118 ++ __tcf_unbind_filter(q, &f->res);
2119 ++ }
2120 + }
2121 +
2122 + static struct tcf_proto_ops cls_route4_ops __read_mostly = {
2123 +diff --git a/net/sched/cls_rsvp.h b/net/sched/cls_rsvp.h
2124 +index e9ccf7daea7d..6d30a291bcd2 100644
2125 +--- a/net/sched/cls_rsvp.h
2126 ++++ b/net/sched/cls_rsvp.h
2127 +@@ -736,12 +736,17 @@ nla_put_failure:
2128 + return -1;
2129 + }
2130 +
2131 +-static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl)
2132 ++static void rsvp_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2133 ++ unsigned long base)
2134 + {
2135 + struct rsvp_filter *f = fh;
2136 +
2137 +- if (f && f->res.classid == classid)
2138 +- f->res.class = cl;
2139 ++ if (f && f->res.classid == classid) {
2140 ++ if (cl)
2141 ++ __tcf_bind_filter(q, &f->res, base);
2142 ++ else
2143 ++ __tcf_unbind_filter(q, &f->res);
2144 ++ }
2145 + }
2146 +
2147 + static struct tcf_proto_ops RSVP_OPS __read_mostly = {
2148 +diff --git a/net/sched/cls_tcindex.c b/net/sched/cls_tcindex.c
2149 +index 38bb882bb958..edf27365f91c 100644
2150 +--- a/net/sched/cls_tcindex.c
2151 ++++ b/net/sched/cls_tcindex.c
2152 +@@ -652,12 +652,17 @@ nla_put_failure:
2153 + return -1;
2154 + }
2155 +
2156 +-static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl)
2157 ++static void tcindex_bind_class(void *fh, u32 classid, unsigned long cl,
2158 ++ void *q, unsigned long base)
2159 + {
2160 + struct tcindex_filter_result *r = fh;
2161 +
2162 +- if (r && r->res.classid == classid)
2163 +- r->res.class = cl;
2164 ++ if (r && r->res.classid == classid) {
2165 ++ if (cl)
2166 ++ __tcf_bind_filter(q, &r->res, base);
2167 ++ else
2168 ++ __tcf_unbind_filter(q, &r->res);
2169 ++ }
2170 + }
2171 +
2172 + static struct tcf_proto_ops cls_tcindex_ops __read_mostly = {
2173 +diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
2174 +index b2c3406a2cf2..fe246e03fcd9 100644
2175 +--- a/net/sched/cls_u32.c
2176 ++++ b/net/sched/cls_u32.c
2177 +@@ -1315,12 +1315,17 @@ static int u32_reoffload(struct tcf_proto *tp, bool add, tc_setup_cb_t *cb,
2178 + return 0;
2179 + }
2180 +
2181 +-static void u32_bind_class(void *fh, u32 classid, unsigned long cl)
2182 ++static void u32_bind_class(void *fh, u32 classid, unsigned long cl, void *q,
2183 ++ unsigned long base)
2184 + {
2185 + struct tc_u_knode *n = fh;
2186 +
2187 +- if (n && n->res.classid == classid)
2188 +- n->res.class = cl;
2189 ++ if (n && n->res.classid == classid) {
2190 ++ if (cl)
2191 ++ __tcf_bind_filter(q, &n->res, base);
2192 ++ else
2193 ++ __tcf_unbind_filter(q, &n->res);
2194 ++ }
2195 + }
2196 +
2197 + static int u32_dump(struct net *net, struct tcf_proto *tp, void *fh,
2198 +diff --git a/net/sched/ematch.c b/net/sched/ematch.c
2199 +index 750d88d0cfd9..113a133ee544 100644
2200 +--- a/net/sched/ematch.c
2201 ++++ b/net/sched/ematch.c
2202 +@@ -242,6 +242,9 @@ static int tcf_em_validate(struct tcf_proto *tp,
2203 + goto errout;
2204 +
2205 + if (em->ops->change) {
2206 ++ err = -EINVAL;
2207 ++ if (em_hdr->flags & TCF_EM_SIMPLE)
2208 ++ goto errout;
2209 + err = em->ops->change(net, data, data_len, em);
2210 + if (err < 0)
2211 + goto errout;
2212 +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
2213 +index 84fdc4857771..39e319d04bb8 100644
2214 +--- a/net/sched/sch_api.c
2215 ++++ b/net/sched/sch_api.c
2216 +@@ -1803,8 +1803,9 @@ static int tclass_del_notify(struct net *net,
2217 +
2218 + struct tcf_bind_args {
2219 + struct tcf_walker w;
2220 +- u32 classid;
2221 ++ unsigned long base;
2222 + unsigned long cl;
2223 ++ u32 classid;
2224 + };
2225 +
2226 + static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg)
2227 +@@ -1815,7 +1816,7 @@ static int tcf_node_bind(struct tcf_proto *tp, void *n, struct tcf_walker *arg)
2228 + struct Qdisc *q = tcf_block_q(tp->chain->block);
2229 +
2230 + sch_tree_lock(q);
2231 +- tp->ops->bind_class(n, a->classid, a->cl);
2232 ++ tp->ops->bind_class(n, a->classid, a->cl, q, a->base);
2233 + sch_tree_unlock(q);
2234 + }
2235 + return 0;
2236 +@@ -1846,6 +1847,7 @@ static void tc_bind_tclass(struct Qdisc *q, u32 portid, u32 clid,
2237 +
2238 + arg.w.fn = tcf_node_bind;
2239 + arg.classid = clid;
2240 ++ arg.base = cl;
2241 + arg.cl = new_cl;
2242 + tp->ops->walk(tp, &arg.w);
2243 + }