Magellan Linux

Contents of /trunk/kernel-alx/patches-4.9/0118-4.9.19-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2956 - (show annotations) (download)
Mon Jul 24 12:03:46 2017 UTC (7 years, 3 months ago) by niro
File size: 101849 byte(s)
-added patches-4.9
1 diff --git a/Makefile b/Makefile
2 index c10d0e634e68..ba1c6a8e6a70 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -1,6 +1,6 @@
6 VERSION = 4
7 PATCHLEVEL = 9
8 -SUBLEVEL = 18
9 +SUBLEVEL = 19
10 EXTRAVERSION =
11 NAME = Roaring Lionus
12
13 diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
14 index 7173ec9059a1..8158c873b455 100644
15 --- a/arch/arm/boot/dts/sama5d2.dtsi
16 +++ b/arch/arm/boot/dts/sama5d2.dtsi
17 @@ -266,7 +266,7 @@
18 };
19
20 usb1: ohci@00400000 {
21 - compatible = "atmel,sama5d2-ohci", "usb-ohci";
22 + compatible = "atmel,at91rm9200-ohci", "usb-ohci";
23 reg = <0x00400000 0x100000>;
24 interrupts = <41 IRQ_TYPE_LEVEL_HIGH 2>;
25 clocks = <&uhphs_clk>, <&uhphs_clk>, <&uhpck>;
26 diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
27 index b4332b727e9c..31dde8b6f2ea 100644
28 --- a/arch/arm/mach-at91/pm.c
29 +++ b/arch/arm/mach-at91/pm.c
30 @@ -289,6 +289,22 @@ static void at91_ddr_standby(void)
31 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1);
32 }
33
34 +static void sama5d3_ddr_standby(void)
35 +{
36 + u32 lpr0;
37 + u32 saved_lpr0;
38 +
39 + saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
40 + lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
41 + lpr0 |= AT91_DDRSDRC_LPCB_POWER_DOWN;
42 +
43 + at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
44 +
45 + cpu_do_idle();
46 +
47 + at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0);
48 +}
49 +
50 /* We manage both DDRAM/SDRAM controllers, we need more than one value to
51 * remember.
52 */
53 @@ -323,7 +339,7 @@ static const struct of_device_id const ramc_ids[] __initconst = {
54 { .compatible = "atmel,at91rm9200-sdramc", .data = at91rm9200_standby },
55 { .compatible = "atmel,at91sam9260-sdramc", .data = at91sam9_sdram_standby },
56 { .compatible = "atmel,at91sam9g45-ddramc", .data = at91_ddr_standby },
57 - { .compatible = "atmel,sama5d3-ddramc", .data = at91_ddr_standby },
58 + { .compatible = "atmel,sama5d3-ddramc", .data = sama5d3_ddr_standby },
59 { /*sentinel*/ }
60 };
61
62 diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c
63 index 769f24ef628c..d7e90d97f5c4 100644
64 --- a/arch/arm64/kernel/kaslr.c
65 +++ b/arch/arm64/kernel/kaslr.c
66 @@ -131,11 +131,15 @@ u64 __init kaslr_early_init(u64 dt_phys, u64 modulo_offset)
67 /*
68 * The kernel Image should not extend across a 1GB/32MB/512MB alignment
69 * boundary (for 4KB/16KB/64KB granule kernels, respectively). If this
70 - * happens, increase the KASLR offset by the size of the kernel image.
71 + * happens, increase the KASLR offset by the size of the kernel image
72 + * rounded up by SWAPPER_BLOCK_SIZE.
73 */
74 if ((((u64)_text + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT) !=
75 - (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT))
76 - offset = (offset + (u64)(_end - _text)) & mask;
77 + (((u64)_end + offset + modulo_offset) >> SWAPPER_TABLE_SHIFT)) {
78 + u64 kimg_sz = _end - _text;
79 + offset = (offset + round_up(kimg_sz, SWAPPER_BLOCK_SIZE))
80 + & mask;
81 + }
82
83 if (IS_ENABLED(CONFIG_KASAN))
84 /*
85 diff --git a/arch/powerpc/kernel/idle_book3s.S b/arch/powerpc/kernel/idle_book3s.S
86 index 72dac0b58061..b350ac5e3111 100644
87 --- a/arch/powerpc/kernel/idle_book3s.S
88 +++ b/arch/powerpc/kernel/idle_book3s.S
89 @@ -439,9 +439,23 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
90 _GLOBAL(pnv_wakeup_tb_loss)
91 ld r1,PACAR1(r13)
92 /*
93 - * Before entering any idle state, the NVGPRs are saved in the stack
94 - * and they are restored before switching to the process context. Hence
95 - * until they are restored, they are free to be used.
96 + * Before entering any idle state, the NVGPRs are saved in the stack.
97 + * If there was a state loss, or PACA_NAPSTATELOST was set, then the
98 + * NVGPRs are restored. If we are here, it is likely that state is lost,
99 + * but not guaranteed -- neither ISA207 nor ISA300 tests to reach
100 + * here are the same as the test to restore NVGPRS:
101 + * PACA_THREAD_IDLE_STATE test for ISA207, PSSCR test for ISA300,
102 + * and SRR1 test for restoring NVGPRs.
103 + *
104 + * We are about to clobber NVGPRs now, so set NAPSTATELOST to
105 + * guarantee they will always be restored. This might be tightened
106 + * with careful reading of specs (particularly for ISA300) but this
107 + * is already a slow wakeup path and it's simpler to be safe.
108 + */
109 + li r0,1
110 + stb r0,PACA_NAPSTATELOST(r13)
111 +
112 + /*
113 *
114 * Save SRR1 and LR in NVGPRs as they might be clobbered in
115 * opal_call() (called in CHECK_HMI_INTERRUPT). SRR1 is required
116 diff --git a/block/blk-mq.c b/block/blk-mq.c
117 index 81caceb96c3c..ee54ad01f7ac 100644
118 --- a/block/blk-mq.c
119 +++ b/block/blk-mq.c
120 @@ -629,17 +629,8 @@ static void blk_mq_check_expired(struct blk_mq_hw_ctx *hctx,
121 {
122 struct blk_mq_timeout_data *data = priv;
123
124 - if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags)) {
125 - /*
126 - * If a request wasn't started before the queue was
127 - * marked dying, kill it here or it'll go unnoticed.
128 - */
129 - if (unlikely(blk_queue_dying(rq->q))) {
130 - rq->errors = -EIO;
131 - blk_mq_end_request(rq, rq->errors);
132 - }
133 + if (!test_bit(REQ_ATOM_STARTED, &rq->atomic_flags))
134 return;
135 - }
136
137 if (time_after_eq(jiffies, rq->deadline)) {
138 if (!blk_mark_rq_complete(rq))
139 diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
140 index d19b09cdf284..54fc90e8339c 100644
141 --- a/crypto/algif_hash.c
142 +++ b/crypto/algif_hash.c
143 @@ -245,7 +245,7 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
144 struct alg_sock *ask = alg_sk(sk);
145 struct hash_ctx *ctx = ask->private;
146 struct ahash_request *req = &ctx->req;
147 - char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];
148 + char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req)) ? : 1];
149 struct sock *sk2;
150 struct alg_sock *ask2;
151 struct hash_ctx *ctx2;
152 diff --git a/drivers/auxdisplay/img-ascii-lcd.c b/drivers/auxdisplay/img-ascii-lcd.c
153 index bf43b5d2aafc..83f1439e57fd 100644
154 --- a/drivers/auxdisplay/img-ascii-lcd.c
155 +++ b/drivers/auxdisplay/img-ascii-lcd.c
156 @@ -218,6 +218,7 @@ static const struct of_device_id img_ascii_lcd_matches[] = {
157 { .compatible = "img,boston-lcd", .data = &boston_config },
158 { .compatible = "mti,malta-lcd", .data = &malta_config },
159 { .compatible = "mti,sead3-lcd", .data = &sead3_config },
160 + { /* sentinel */ }
161 };
162
163 /**
164 diff --git a/drivers/char/hw_random/amd-rng.c b/drivers/char/hw_random/amd-rng.c
165 index 4a99ac756f08..9959c762da2f 100644
166 --- a/drivers/char/hw_random/amd-rng.c
167 +++ b/drivers/char/hw_random/amd-rng.c
168 @@ -55,6 +55,7 @@ MODULE_DEVICE_TABLE(pci, pci_tbl);
169 struct amd768_priv {
170 void __iomem *iobase;
171 struct pci_dev *pcidev;
172 + u32 pmbase;
173 };
174
175 static int amd_rng_read(struct hwrng *rng, void *buf, size_t max, bool wait)
176 @@ -148,33 +149,58 @@ static int __init mod_init(void)
177 if (pmbase == 0)
178 return -EIO;
179
180 - priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
181 + priv = kzalloc(sizeof(*priv), GFP_KERNEL);
182 if (!priv)
183 return -ENOMEM;
184
185 - if (!devm_request_region(&pdev->dev, pmbase + PMBASE_OFFSET,
186 - PMBASE_SIZE, DRV_NAME)) {
187 + if (!request_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE, DRV_NAME)) {
188 dev_err(&pdev->dev, DRV_NAME " region 0x%x already in use!\n",
189 pmbase + 0xF0);
190 - return -EBUSY;
191 + err = -EBUSY;
192 + goto out;
193 }
194
195 - priv->iobase = devm_ioport_map(&pdev->dev, pmbase + PMBASE_OFFSET,
196 - PMBASE_SIZE);
197 + priv->iobase = ioport_map(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
198 if (!priv->iobase) {
199 pr_err(DRV_NAME "Cannot map ioport\n");
200 - return -ENOMEM;
201 + err = -EINVAL;
202 + goto err_iomap;
203 }
204
205 amd_rng.priv = (unsigned long)priv;
206 + priv->pmbase = pmbase;
207 priv->pcidev = pdev;
208
209 pr_info(DRV_NAME " detected\n");
210 - return devm_hwrng_register(&pdev->dev, &amd_rng);
211 + err = hwrng_register(&amd_rng);
212 + if (err) {
213 + pr_err(DRV_NAME " registering failed (%d)\n", err);
214 + goto err_hwrng;
215 + }
216 + return 0;
217 +
218 +err_hwrng:
219 + ioport_unmap(priv->iobase);
220 +err_iomap:
221 + release_region(pmbase + PMBASE_OFFSET, PMBASE_SIZE);
222 +out:
223 + kfree(priv);
224 + return err;
225 }
226
227 static void __exit mod_exit(void)
228 {
229 + struct amd768_priv *priv;
230 +
231 + priv = (struct amd768_priv *)amd_rng.priv;
232 +
233 + hwrng_unregister(&amd_rng);
234 +
235 + ioport_unmap(priv->iobase);
236 +
237 + release_region(priv->pmbase + PMBASE_OFFSET, PMBASE_SIZE);
238 +
239 + kfree(priv);
240 }
241
242 module_init(mod_init);
243 diff --git a/drivers/char/hw_random/geode-rng.c b/drivers/char/hw_random/geode-rng.c
244 index e7a245942029..e1d421a36a13 100644
245 --- a/drivers/char/hw_random/geode-rng.c
246 +++ b/drivers/char/hw_random/geode-rng.c
247 @@ -31,6 +31,9 @@
248 #include <linux/module.h>
249 #include <linux/pci.h>
250
251 +
252 +#define PFX KBUILD_MODNAME ": "
253 +
254 #define GEODE_RNG_DATA_REG 0x50
255 #define GEODE_RNG_STATUS_REG 0x54
256
257 @@ -82,6 +85,7 @@ static struct hwrng geode_rng = {
258
259 static int __init mod_init(void)
260 {
261 + int err = -ENODEV;
262 struct pci_dev *pdev = NULL;
263 const struct pci_device_id *ent;
264 void __iomem *mem;
265 @@ -89,27 +93,43 @@ static int __init mod_init(void)
266
267 for_each_pci_dev(pdev) {
268 ent = pci_match_id(pci_tbl, pdev);
269 - if (ent) {
270 - rng_base = pci_resource_start(pdev, 0);
271 - if (rng_base == 0)
272 - return -ENODEV;
273 -
274 - mem = devm_ioremap(&pdev->dev, rng_base, 0x58);
275 - if (!mem)
276 - return -ENOMEM;
277 - geode_rng.priv = (unsigned long)mem;
278 -
279 - pr_info("AMD Geode RNG detected\n");
280 - return devm_hwrng_register(&pdev->dev, &geode_rng);
281 - }
282 + if (ent)
283 + goto found;
284 }
285 -
286 /* Device not found. */
287 - return -ENODEV;
288 + goto out;
289 +
290 +found:
291 + rng_base = pci_resource_start(pdev, 0);
292 + if (rng_base == 0)
293 + goto out;
294 + err = -ENOMEM;
295 + mem = ioremap(rng_base, 0x58);
296 + if (!mem)
297 + goto out;
298 + geode_rng.priv = (unsigned long)mem;
299 +
300 + pr_info("AMD Geode RNG detected\n");
301 + err = hwrng_register(&geode_rng);
302 + if (err) {
303 + pr_err(PFX "RNG registering failed (%d)\n",
304 + err);
305 + goto err_unmap;
306 + }
307 +out:
308 + return err;
309 +
310 +err_unmap:
311 + iounmap(mem);
312 + goto out;
313 }
314
315 static void __exit mod_exit(void)
316 {
317 + void __iomem *mem = (void __iomem *)geode_rng.priv;
318 +
319 + hwrng_unregister(&geode_rng);
320 + iounmap(mem);
321 }
322
323 module_init(mod_init);
324 diff --git a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
325 index fc75a335a7ce..8ca07fe8d3f3 100644
326 --- a/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
327 +++ b/drivers/clk/sunxi-ng/ccu-sun6i-a31.c
328 @@ -608,7 +608,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(hdmi_clk, "hdmi", lcd_ch1_parents,
329 0x150, 0, 4, 24, 2, BIT(31),
330 CLK_SET_RATE_PARENT);
331
332 -static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(31), 0);
333 +static SUNXI_CCU_GATE(hdmi_ddc_clk, "hdmi-ddc", "osc24M", 0x150, BIT(30), 0);
334
335 static SUNXI_CCU_GATE(ps_clk, "ps", "lcd1-ch1", 0x140, BIT(31), 0);
336
337 diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c
338 index ebb1b31568a5..ee7810429c30 100644
339 --- a/drivers/clk/sunxi-ng/ccu_mp.c
340 +++ b/drivers/clk/sunxi-ng/ccu_mp.c
341 @@ -85,6 +85,10 @@ static unsigned long ccu_mp_recalc_rate(struct clk_hw *hw,
342 unsigned int m, p;
343 u32 reg;
344
345 + /* Adjust parent_rate according to pre-dividers */
346 + ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
347 + -1, &parent_rate);
348 +
349 reg = readl(cmp->common.base + cmp->common.reg);
350
351 m = reg >> cmp->m.shift;
352 @@ -114,6 +118,10 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate,
353 unsigned int m, p;
354 u32 reg;
355
356 + /* Adjust parent_rate according to pre-dividers */
357 + ccu_mux_helper_adjust_parent_for_prediv(&cmp->common, &cmp->mux,
358 + -1, &parent_rate);
359 +
360 max_m = cmp->m.max ?: 1 << cmp->m.width;
361 max_p = cmp->p.max ?: 1 << ((1 << cmp->p.width) - 1);
362
363 diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
364 index 272608f102fb..cac4a92259da 100644
365 --- a/drivers/cpufreq/cpufreq.c
366 +++ b/drivers/cpufreq/cpufreq.c
367 @@ -1190,6 +1190,9 @@ static int cpufreq_online(unsigned int cpu)
368 for_each_cpu(j, policy->related_cpus)
369 per_cpu(cpufreq_cpu_data, j) = policy;
370 write_unlock_irqrestore(&cpufreq_driver_lock, flags);
371 + } else {
372 + policy->min = policy->user_policy.min;
373 + policy->max = policy->user_policy.max;
374 }
375
376 if (cpufreq_driver->get && !cpufreq_driver->setpolicy) {
377 diff --git a/drivers/crypto/ccp/ccp-dev.c b/drivers/crypto/ccp/ccp-dev.c
378 index cafa633aae10..f796e36d7ec3 100644
379 --- a/drivers/crypto/ccp/ccp-dev.c
380 +++ b/drivers/crypto/ccp/ccp-dev.c
381 @@ -283,11 +283,14 @@ EXPORT_SYMBOL_GPL(ccp_version);
382 */
383 int ccp_enqueue_cmd(struct ccp_cmd *cmd)
384 {
385 - struct ccp_device *ccp = ccp_get_device();
386 + struct ccp_device *ccp;
387 unsigned long flags;
388 unsigned int i;
389 int ret;
390
391 + /* Some commands might need to be sent to a specific device */
392 + ccp = cmd->ccp ? cmd->ccp : ccp_get_device();
393 +
394 if (!ccp)
395 return -ENODEV;
396
397 diff --git a/drivers/crypto/ccp/ccp-dmaengine.c b/drivers/crypto/ccp/ccp-dmaengine.c
398 index e5d9278f4019..8d0eeb46d4a2 100644
399 --- a/drivers/crypto/ccp/ccp-dmaengine.c
400 +++ b/drivers/crypto/ccp/ccp-dmaengine.c
401 @@ -390,6 +390,7 @@ static struct ccp_dma_desc *ccp_create_desc(struct dma_chan *dma_chan,
402 goto err;
403
404 ccp_cmd = &cmd->ccp_cmd;
405 + ccp_cmd->ccp = chan->ccp;
406 ccp_pt = &ccp_cmd->u.passthru_nomap;
407 ccp_cmd->flags = CCP_CMD_MAY_BACKLOG;
408 ccp_cmd->flags |= CCP_CMD_PASSTHRU_NO_DMA_MAP;
409 diff --git a/drivers/dax/dax.c b/drivers/dax/dax.c
410 index 286447a83dab..152552d2c306 100644
411 --- a/drivers/dax/dax.c
412 +++ b/drivers/dax/dax.c
413 @@ -334,6 +334,7 @@ static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_area_struct *vma,
414 int rc = VM_FAULT_SIGBUS;
415 phys_addr_t phys;
416 pfn_t pfn;
417 + unsigned int fault_size = PAGE_SIZE;
418
419 if (check_vma(dax_dev, vma, __func__))
420 return VM_FAULT_SIGBUS;
421 @@ -344,6 +345,9 @@ static int __dax_dev_fault(struct dax_dev *dax_dev, struct vm_area_struct *vma,
422 return VM_FAULT_SIGBUS;
423 }
424
425 + if (fault_size != dax_region->align)
426 + return VM_FAULT_SIGBUS;
427 +
428 phys = pgoff_to_phys(dax_dev, vmf->pgoff, PAGE_SIZE);
429 if (phys == -1) {
430 dev_dbg(dev, "%s: phys_to_pgoff(%#lx) failed\n", __func__,
431 @@ -389,6 +393,7 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev,
432 phys_addr_t phys;
433 pgoff_t pgoff;
434 pfn_t pfn;
435 + unsigned int fault_size = PMD_SIZE;
436
437 if (check_vma(dax_dev, vma, __func__))
438 return VM_FAULT_SIGBUS;
439 @@ -405,6 +410,16 @@ static int __dax_dev_pmd_fault(struct dax_dev *dax_dev,
440 return VM_FAULT_SIGBUS;
441 }
442
443 + if (fault_size < dax_region->align)
444 + return VM_FAULT_SIGBUS;
445 + else if (fault_size > dax_region->align)
446 + return VM_FAULT_FALLBACK;
447 +
448 + /* if we are outside of the VMA */
449 + if (pmd_addr < vma->vm_start ||
450 + (pmd_addr + PMD_SIZE) > vma->vm_end)
451 + return VM_FAULT_SIGBUS;
452 +
453 pgoff = linear_page_index(vma, pmd_addr);
454 phys = pgoff_to_phys(dax_dev, pgoff, PMD_SIZE);
455 if (phys == -1) {
456 diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
457 index 09e6a7320bb2..6f3c89178b6a 100644
458 --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
459 +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
460 @@ -3507,9 +3507,13 @@ static void si_apply_state_adjust_rules(struct amdgpu_device *adev,
461 max_mclk = 80000;
462 }
463 } else if (adev->asic_type == CHIP_OLAND) {
464 - if ((adev->pdev->device == 0x6604) &&
465 - (adev->pdev->subsystem_vendor == 0x1028) &&
466 - (adev->pdev->subsystem_device == 0x066F)) {
467 + if ((adev->pdev->revision == 0xC7) ||
468 + (adev->pdev->revision == 0x80) ||
469 + (adev->pdev->revision == 0x81) ||
470 + (adev->pdev->revision == 0x83) ||
471 + (adev->pdev->revision == 0x87) ||
472 + (adev->pdev->device == 0x6604) ||
473 + (adev->pdev->device == 0x6605)) {
474 max_sclk = 75000;
475 }
476 }
477 diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
478 index 6e0447f329a2..72ec93de0e76 100644
479 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
480 +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
481 @@ -1382,6 +1382,7 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
482
483 pm_runtime_enable(dev);
484
485 + pm_runtime_get_sync(dev);
486 phy_power_on(dp->phy);
487
488 analogix_dp_init_dp(dp);
489 @@ -1414,9 +1415,15 @@ int analogix_dp_bind(struct device *dev, struct drm_device *drm_dev,
490 goto err_disable_pm_runtime;
491 }
492
493 + phy_power_off(dp->phy);
494 + pm_runtime_put(dev);
495 +
496 return 0;
497
498 err_disable_pm_runtime:
499 +
500 + phy_power_off(dp->phy);
501 + pm_runtime_put(dev);
502 pm_runtime_disable(dev);
503
504 return ret;
505 diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
506 index 2e42a0584a84..50acd799babe 100644
507 --- a/drivers/gpu/drm/drm_atomic_helper.c
508 +++ b/drivers/gpu/drm/drm_atomic_helper.c
509 @@ -1382,6 +1382,15 @@ static int stall_checks(struct drm_crtc *crtc, bool nonblock)
510 return ret < 0 ? ret : 0;
511 }
512
513 +void release_crtc_commit(struct completion *completion)
514 +{
515 + struct drm_crtc_commit *commit = container_of(completion,
516 + typeof(*commit),
517 + flip_done);
518 +
519 + drm_crtc_commit_put(commit);
520 +}
521 +
522 /**
523 * drm_atomic_helper_setup_commit - setup possibly nonblocking commit
524 * @state: new modeset state to be committed
525 @@ -1474,6 +1483,8 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state,
526 }
527
528 crtc_state->event->base.completion = &commit->flip_done;
529 + crtc_state->event->base.completion_release = release_crtc_commit;
530 + drm_crtc_commit_get(commit);
531 }
532
533 return 0;
534 diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
535 index e84faecf5225..f5815e1a4390 100644
536 --- a/drivers/gpu/drm/drm_fops.c
537 +++ b/drivers/gpu/drm/drm_fops.c
538 @@ -686,8 +686,8 @@ void drm_send_event_locked(struct drm_device *dev, struct drm_pending_event *e)
539 assert_spin_locked(&dev->event_lock);
540
541 if (e->completion) {
542 - /* ->completion might disappear as soon as it signalled. */
543 complete_all(e->completion);
544 + e->completion_release(e->completion);
545 e->completion = NULL;
546 }
547
548 diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
549 index be34547cdb68..1606e7f08f4b 100644
550 --- a/drivers/hv/channel.c
551 +++ b/drivers/hv/channel.c
552 @@ -506,12 +506,15 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle)
553
554 wait_for_completion(&info->waitevent);
555
556 - if (channel->rescind) {
557 - ret = -ENODEV;
558 - goto post_msg_err;
559 - }
560 -
561 post_msg_err:
562 + /*
563 + * If the channel has been rescinded;
564 + * we will be awakened by the rescind
565 + * handler; set the error code to zero so we don't leak memory.
566 + */
567 + if (channel->rescind)
568 + ret = 0;
569 +
570 spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
571 list_del(&info->msglistentry);
572 spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
573 diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
574 index cb9531541a12..d8bc4b910192 100644
575 --- a/drivers/hv/channel_mgmt.c
576 +++ b/drivers/hv/channel_mgmt.c
577 @@ -779,6 +779,7 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr)
578 /* Allocate the channel object and save this offer. */
579 newchannel = alloc_channel();
580 if (!newchannel) {
581 + vmbus_release_relid(offer->child_relid);
582 pr_err("Unable to allocate channel object\n");
583 return;
584 }
585 diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
586 index 6f0a51a2c6ec..d439736c789b 100644
587 --- a/drivers/hwtracing/intel_th/core.c
588 +++ b/drivers/hwtracing/intel_th/core.c
589 @@ -218,8 +218,10 @@ static int intel_th_output_activate(struct intel_th_device *thdev)
590 else
591 intel_th_trace_enable(thdev);
592
593 - if (ret)
594 + if (ret) {
595 pm_runtime_put(&thdev->dev);
596 + module_put(thdrv->driver.owner);
597 + }
598
599 return ret;
600 }
601 diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c
602 index c3cfacca2541..2de1f52f1b19 100644
603 --- a/drivers/iio/adc/ti_am335x_adc.c
604 +++ b/drivers/iio/adc/ti_am335x_adc.c
605 @@ -151,7 +151,9 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
606 {
607 struct iio_dev *indio_dev = private;
608 struct tiadc_device *adc_dev = iio_priv(indio_dev);
609 - unsigned int status, config;
610 + unsigned int status, config, adc_fsm;
611 + unsigned short count = 0;
612 +
613 status = tiadc_readl(adc_dev, REG_IRQSTATUS);
614
615 /*
616 @@ -165,6 +167,15 @@ static irqreturn_t tiadc_irq_h(int irq, void *private)
617 tiadc_writel(adc_dev, REG_CTRL, config);
618 tiadc_writel(adc_dev, REG_IRQSTATUS, IRQENB_FIFO1OVRRUN
619 | IRQENB_FIFO1UNDRFLW | IRQENB_FIFO1THRES);
620 +
621 + /* wait for idle state.
622 + * ADC needs to finish the current conversion
623 + * before disabling the module
624 + */
625 + do {
626 + adc_fsm = tiadc_readl(adc_dev, REG_ADCFSM);
627 + } while (adc_fsm != 0x10 && count++ < 100);
628 +
629 tiadc_writel(adc_dev, REG_CTRL, (config | CNTRLREG_TSCSSENB));
630 return IRQ_HANDLED;
631 } else if (status & IRQENB_FIFO1THRES) {
632 diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
633 index a3cce3a38300..ecf592d69043 100644
634 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
635 +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c
636 @@ -51,8 +51,6 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
637 st->report_state.report_id,
638 st->report_state.index,
639 HID_USAGE_SENSOR_PROP_REPORTING_STATE_ALL_EVENTS_ENUM);
640 -
641 - poll_value = hid_sensor_read_poll_value(st);
642 } else {
643 int val;
644
645 @@ -89,7 +87,9 @@ static int _hid_sensor_power_state(struct hid_sensor_common *st, bool state)
646 sensor_hub_get_feature(st->hsdev, st->power_state.report_id,
647 st->power_state.index,
648 sizeof(state_val), &state_val);
649 - if (state && poll_value)
650 + if (state)
651 + poll_value = hid_sensor_read_poll_value(st);
652 + if (poll_value > 0)
653 msleep_interruptible(poll_value * 2);
654
655 return 0;
656 diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
657 index 217353145676..dd3fcd1704f8 100644
658 --- a/drivers/iio/magnetometer/ak8974.c
659 +++ b/drivers/iio/magnetometer/ak8974.c
660 @@ -767,7 +767,7 @@ static int ak8974_probe(struct i2c_client *i2c,
661 return ret;
662 }
663
664 -static int __exit ak8974_remove(struct i2c_client *i2c)
665 +static int ak8974_remove(struct i2c_client *i2c)
666 {
667 struct iio_dev *indio_dev = i2c_get_clientdata(i2c);
668 struct ak8974 *ak8974 = iio_priv(indio_dev);
669 @@ -849,7 +849,7 @@ static struct i2c_driver ak8974_driver = {
670 .of_match_table = of_match_ptr(ak8974_of_match),
671 },
672 .probe = ak8974_probe,
673 - .remove = __exit_p(ak8974_remove),
674 + .remove = ak8974_remove,
675 .id_table = ak8974_id,
676 };
677 module_i2c_driver(ak8974_driver);
678 diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
679 index d96aa27dfcdc..db64adfbe1af 100644
680 --- a/drivers/input/joystick/iforce/iforce-usb.c
681 +++ b/drivers/input/joystick/iforce/iforce-usb.c
682 @@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
683
684 interface = intf->cur_altsetting;
685
686 + if (interface->desc.bNumEndpoints < 2)
687 + return -ENODEV;
688 +
689 epirq = &interface->endpoint[0].desc;
690 epout = &interface->endpoint[1].desc;
691
692 diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
693 index 9cc6d057c302..23c191a2a071 100644
694 --- a/drivers/input/misc/cm109.c
695 +++ b/drivers/input/misc/cm109.c
696 @@ -700,6 +700,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
697 int error = -ENOMEM;
698
699 interface = intf->cur_altsetting;
700 +
701 + if (interface->desc.bNumEndpoints < 1)
702 + return -ENODEV;
703 +
704 endpoint = &interface->endpoint[0].desc;
705
706 if (!usb_endpoint_is_int_in(endpoint))
707 diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
708 index 9c0ea36913b4..f4e8fbec6a94 100644
709 --- a/drivers/input/misc/ims-pcu.c
710 +++ b/drivers/input/misc/ims-pcu.c
711 @@ -1667,6 +1667,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
712 return -EINVAL;
713
714 alt = pcu->ctrl_intf->cur_altsetting;
715 +
716 + if (alt->desc.bNumEndpoints < 1)
717 + return -ENODEV;
718 +
719 pcu->ep_ctrl = &alt->endpoint[0].desc;
720 pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
721
722 diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
723 index 79c964c075f1..6e7ff9561d92 100644
724 --- a/drivers/input/misc/yealink.c
725 +++ b/drivers/input/misc/yealink.c
726 @@ -875,6 +875,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
727 int ret, pipe, i;
728
729 interface = intf->cur_altsetting;
730 +
731 + if (interface->desc.bNumEndpoints < 1)
732 + return -ENODEV;
733 +
734 endpoint = &interface->endpoint[0].desc;
735 if (!usb_endpoint_is_int_in(endpoint))
736 return -ENODEV;
737 diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
738 index b93fe83a0b63..518e8a7bd5f9 100644
739 --- a/drivers/input/mouse/alps.c
740 +++ b/drivers/input/mouse/alps.c
741 @@ -1290,10 +1290,8 @@ static int alps_decode_ss4_v2(struct alps_fields *f,
742 /* handle buttons */
743 if (pkt_id == SS4_PACKET_ID_STICK) {
744 f->ts_left = !!(SS4_BTN_V2(p) & 0x01);
745 - if (!(priv->flags & ALPS_BUTTONPAD)) {
746 - f->ts_right = !!(SS4_BTN_V2(p) & 0x02);
747 - f->ts_middle = !!(SS4_BTN_V2(p) & 0x04);
748 - }
749 + f->ts_right = !!(SS4_BTN_V2(p) & 0x02);
750 + f->ts_middle = !!(SS4_BTN_V2(p) & 0x04);
751 } else {
752 f->left = !!(SS4_BTN_V2(p) & 0x01);
753 if (!(priv->flags & ALPS_BUTTONPAD)) {
754 @@ -2461,14 +2459,34 @@ static int alps_update_device_area_ss4_v2(unsigned char otp[][4],
755 int num_y_electrode;
756 int x_pitch, y_pitch, x_phys, y_phys;
757
758 - num_x_electrode = SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F);
759 - num_y_electrode = SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F);
760 + if (IS_SS4PLUS_DEV(priv->dev_id)) {
761 + num_x_electrode =
762 + SS4PLUS_NUMSENSOR_XOFFSET + (otp[0][2] & 0x0F);
763 + num_y_electrode =
764 + SS4PLUS_NUMSENSOR_YOFFSET + ((otp[0][2] >> 4) & 0x0F);
765 +
766 + priv->x_max =
767 + (num_x_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE;
768 + priv->y_max =
769 + (num_y_electrode - 1) * SS4PLUS_COUNT_PER_ELECTRODE;
770
771 - priv->x_max = (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
772 - priv->y_max = (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
773 + x_pitch = (otp[0][1] & 0x0F) + SS4PLUS_MIN_PITCH_MM;
774 + y_pitch = ((otp[0][1] >> 4) & 0x0F) + SS4PLUS_MIN_PITCH_MM;
775
776 - x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM;
777 - y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM;
778 + } else {
779 + num_x_electrode =
780 + SS4_NUMSENSOR_XOFFSET + (otp[1][0] & 0x0F);
781 + num_y_electrode =
782 + SS4_NUMSENSOR_YOFFSET + ((otp[1][0] >> 4) & 0x0F);
783 +
784 + priv->x_max =
785 + (num_x_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
786 + priv->y_max =
787 + (num_y_electrode - 1) * SS4_COUNT_PER_ELECTRODE;
788 +
789 + x_pitch = ((otp[1][2] >> 2) & 0x07) + SS4_MIN_PITCH_MM;
790 + y_pitch = ((otp[1][2] >> 5) & 0x07) + SS4_MIN_PITCH_MM;
791 + }
792
793 x_phys = x_pitch * (num_x_electrode - 1); /* In 0.1 mm units */
794 y_phys = y_pitch * (num_y_electrode - 1); /* In 0.1 mm units */
795 @@ -2484,7 +2502,10 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4],
796 {
797 unsigned char is_btnless;
798
799 - is_btnless = (otp[1][1] >> 3) & 0x01;
800 + if (IS_SS4PLUS_DEV(priv->dev_id))
801 + is_btnless = (otp[1][0] >> 1) & 0x01;
802 + else
803 + is_btnless = (otp[1][1] >> 3) & 0x01;
804
805 if (is_btnless)
806 priv->flags |= ALPS_BUTTONPAD;
807 @@ -2492,6 +2513,21 @@ static int alps_update_btn_info_ss4_v2(unsigned char otp[][4],
808 return 0;
809 }
810
811 +static int alps_update_dual_info_ss4_v2(unsigned char otp[][4],
812 + struct alps_data *priv)
813 +{
814 + bool is_dual = false;
815 +
816 + if (IS_SS4PLUS_DEV(priv->dev_id))
817 + is_dual = (otp[0][0] >> 4) & 0x01;
818 +
819 + if (is_dual)
820 + priv->flags |= ALPS_DUALPOINT |
821 + ALPS_DUALPOINT_WITH_PRESSURE;
822 +
823 + return 0;
824 +}
825 +
826 static int alps_set_defaults_ss4_v2(struct psmouse *psmouse,
827 struct alps_data *priv)
828 {
829 @@ -2507,6 +2543,8 @@ static int alps_set_defaults_ss4_v2(struct psmouse *psmouse,
830
831 alps_update_btn_info_ss4_v2(otp, priv);
832
833 + alps_update_dual_info_ss4_v2(otp, priv);
834 +
835 return 0;
836 }
837
838 @@ -2752,10 +2790,6 @@ static int alps_set_protocol(struct psmouse *psmouse,
839 if (alps_set_defaults_ss4_v2(psmouse, priv))
840 return -EIO;
841
842 - if (priv->fw_ver[1] == 0x1)
843 - priv->flags |= ALPS_DUALPOINT |
844 - ALPS_DUALPOINT_WITH_PRESSURE;
845 -
846 break;
847 }
848
849 @@ -2826,10 +2860,7 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
850 ec[2] >= 0x90 && ec[2] <= 0x9d) {
851 protocol = &alps_v3_protocol_data;
852 } else if (e7[0] == 0x73 && e7[1] == 0x03 &&
853 - e7[2] == 0x14 && ec[1] == 0x02) {
854 - protocol = &alps_v8_protocol_data;
855 - } else if (e7[0] == 0x73 && e7[1] == 0x03 &&
856 - e7[2] == 0x28 && ec[1] == 0x01) {
857 + (e7[2] == 0x14 || e7[2] == 0x28)) {
858 protocol = &alps_v8_protocol_data;
859 } else {
860 psmouse_dbg(psmouse,
861 @@ -2839,7 +2870,8 @@ static int alps_identify(struct psmouse *psmouse, struct alps_data *priv)
862 }
863
864 if (priv) {
865 - /* Save the Firmware version */
866 + /* Save Device ID and Firmware version */
867 + memcpy(priv->dev_id, e7, 3);
868 memcpy(priv->fw_ver, ec, 3);
869 error = alps_set_protocol(psmouse, priv, protocol);
870 if (error)
871 diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
872 index b9417e2d7ad3..dbfd26073e1a 100644
873 --- a/drivers/input/mouse/alps.h
874 +++ b/drivers/input/mouse/alps.h
875 @@ -54,6 +54,16 @@ enum SS4_PACKET_ID {
876
877 #define SS4_MASK_NORMAL_BUTTONS 0x07
878
879 +#define SS4PLUS_COUNT_PER_ELECTRODE 128
880 +#define SS4PLUS_NUMSENSOR_XOFFSET 16
881 +#define SS4PLUS_NUMSENSOR_YOFFSET 5
882 +#define SS4PLUS_MIN_PITCH_MM 37
883 +
884 +#define IS_SS4PLUS_DEV(_b) (((_b[0]) == 0x73) && \
885 + ((_b[1]) == 0x03) && \
886 + ((_b[2]) == 0x28) \
887 + )
888 +
889 #define SS4_1F_X_V2(_b) ((_b[0] & 0x0007) | \
890 ((_b[1] << 3) & 0x0078) | \
891 ((_b[1] << 2) & 0x0380) | \
892 @@ -263,6 +273,7 @@ struct alps_data {
893 int addr_command;
894 u16 proto_version;
895 u8 byte0, mask0;
896 + u8 dev_id[3];
897 u8 fw_ver[3];
898 int flags;
899 int x_max;
900 diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
901 index ed1935f300a7..da5458dfb1e3 100644
902 --- a/drivers/input/mouse/elan_i2c_core.c
903 +++ b/drivers/input/mouse/elan_i2c_core.c
904 @@ -218,17 +218,19 @@ static int elan_query_product(struct elan_tp_data *data)
905
906 static int elan_check_ASUS_special_fw(struct elan_tp_data *data)
907 {
908 - if (data->ic_type != 0x0E)
909 - return false;
910 -
911 - switch (data->product_id) {
912 - case 0x05 ... 0x07:
913 - case 0x09:
914 - case 0x13:
915 + if (data->ic_type == 0x0E) {
916 + switch (data->product_id) {
917 + case 0x05 ... 0x07:
918 + case 0x09:
919 + case 0x13:
920 + return true;
921 + }
922 + } else if (data->ic_type == 0x08 && data->product_id == 0x26) {
923 + /* ASUS EeeBook X205TA */
924 return true;
925 - default:
926 - return false;
927 }
928 +
929 + return false;
930 }
931
932 static int __elan_initialize(struct elan_tp_data *data)
933 diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
934 index 0cdd95801a25..25eab453f2b2 100644
935 --- a/drivers/input/serio/i8042-x86ia64io.h
936 +++ b/drivers/input/serio/i8042-x86ia64io.h
937 @@ -120,6 +120,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
938 },
939 },
940 {
941 + /* Dell Embedded Box PC 3000 */
942 + .matches = {
943 + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
944 + DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
945 + },
946 + },
947 + {
948 /* OQO Model 01 */
949 .matches = {
950 DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
951 diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
952 index cd852059b99e..df4bea96d7ed 100644
953 --- a/drivers/input/tablet/hanwang.c
954 +++ b/drivers/input/tablet/hanwang.c
955 @@ -340,6 +340,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
956 int error;
957 int i;
958
959 + if (intf->cur_altsetting->desc.bNumEndpoints < 1)
960 + return -ENODEV;
961 +
962 hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
963 input_dev = input_allocate_device();
964 if (!hanwang || !input_dev) {
965 diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
966 index e850d7e8afbc..4d9d64908b59 100644
967 --- a/drivers/input/tablet/kbtab.c
968 +++ b/drivers/input/tablet/kbtab.c
969 @@ -122,6 +122,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
970 struct input_dev *input_dev;
971 int error = -ENOMEM;
972
973 + if (intf->cur_altsetting->desc.bNumEndpoints < 1)
974 + return -ENODEV;
975 +
976 kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
977 input_dev = input_allocate_device();
978 if (!kbtab || !input_dev)
979 diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
980 index aefb6e11f88a..4c0eecae065c 100644
981 --- a/drivers/input/touchscreen/sur40.c
982 +++ b/drivers/input/touchscreen/sur40.c
983 @@ -527,6 +527,9 @@ static int sur40_probe(struct usb_interface *interface,
984 if (iface_desc->desc.bInterfaceClass != 0xFF)
985 return -ENODEV;
986
987 + if (iface_desc->desc.bNumEndpoints < 5)
988 + return -ENODEV;
989 +
990 /* Use endpoint #4 (0x86). */
991 endpoint = &iface_desc->endpoint[4].desc;
992 if (endpoint->bEndpointAddress != TOUCH_ENDPOINT)
993 diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
994 index 34be95ee9038..b9e50c10213b 100644
995 --- a/drivers/iommu/intel-iommu.c
996 +++ b/drivers/iommu/intel-iommu.c
997 @@ -915,7 +915,7 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devf
998 * which we used for the IOMMU lookup. Strictly speaking
999 * we could do this for all PCI devices; we only need to
1000 * get the BDF# from the scope table for ACPI matches. */
1001 - if (pdev->is_virtfn)
1002 + if (pdev && pdev->is_virtfn)
1003 goto got_pdev;
1004
1005 *bus = drhd->devices[i].bus;
1006 diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
1007 index 410a55b1c25f..1cfd7f900339 100644
1008 --- a/drivers/mmc/host/sdhci-of-arasan.c
1009 +++ b/drivers/mmc/host/sdhci-of-arasan.c
1010 @@ -28,13 +28,9 @@
1011 #include "sdhci-pltfm.h"
1012 #include <linux/of.h>
1013
1014 -#define SDHCI_ARASAN_CLK_CTRL_OFFSET 0x2c
1015 #define SDHCI_ARASAN_VENDOR_REGISTER 0x78
1016
1017 #define VENDOR_ENHANCED_STROBE BIT(0)
1018 -#define CLK_CTRL_TIMEOUT_SHIFT 16
1019 -#define CLK_CTRL_TIMEOUT_MASK (0xf << CLK_CTRL_TIMEOUT_SHIFT)
1020 -#define CLK_CTRL_TIMEOUT_MIN_EXP 13
1021
1022 #define PHY_CLK_TOO_SLOW_HZ 400000
1023
1024 @@ -163,15 +159,15 @@ static int sdhci_arasan_syscon_write(struct sdhci_host *host,
1025
1026 static unsigned int sdhci_arasan_get_timeout_clock(struct sdhci_host *host)
1027 {
1028 - u32 div;
1029 unsigned long freq;
1030 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
1031
1032 - div = readl(host->ioaddr + SDHCI_ARASAN_CLK_CTRL_OFFSET);
1033 - div = (div & CLK_CTRL_TIMEOUT_MASK) >> CLK_CTRL_TIMEOUT_SHIFT;
1034 + /* SDHCI timeout clock is in kHz */
1035 + freq = DIV_ROUND_UP(clk_get_rate(pltfm_host->clk), 1000);
1036
1037 - freq = clk_get_rate(pltfm_host->clk);
1038 - freq /= 1 << (CLK_CTRL_TIMEOUT_MIN_EXP + div);
1039 + /* or in MHz */
1040 + if (host->caps & SDHCI_TIMEOUT_CLK_UNIT)
1041 + freq = DIV_ROUND_UP(freq, 1000);
1042
1043 return freq;
1044 }
1045 diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-at91.c
1046 index a9b7fc06c434..387ae1cbf698 100644
1047 --- a/drivers/mmc/host/sdhci-of-at91.c
1048 +++ b/drivers/mmc/host/sdhci-of-at91.c
1049 @@ -85,11 +85,30 @@ static void sdhci_at91_set_clock(struct sdhci_host *host, unsigned int clock)
1050 sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
1051 }
1052
1053 +/*
1054 + * In this specific implementation of the SDHCI controller, the power register
1055 + * needs to have a valid voltage set even when the power supply is managed by
1056 + * an external regulator.
1057 + */
1058 +static void sdhci_at91_set_power(struct sdhci_host *host, unsigned char mode,
1059 + unsigned short vdd)
1060 +{
1061 + if (!IS_ERR(host->mmc->supply.vmmc)) {
1062 + struct mmc_host *mmc = host->mmc;
1063 +
1064 + spin_unlock_irq(&host->lock);
1065 + mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd);
1066 + spin_lock_irq(&host->lock);
1067 + }
1068 + sdhci_set_power_noreg(host, mode, vdd);
1069 +}
1070 +
1071 static const struct sdhci_ops sdhci_at91_sama5d2_ops = {
1072 .set_clock = sdhci_at91_set_clock,
1073 .set_bus_width = sdhci_set_bus_width,
1074 .reset = sdhci_reset,
1075 .set_uhs_signaling = sdhci_set_uhs_signaling,
1076 + .set_power = sdhci_at91_set_power,
1077 };
1078
1079 static const struct sdhci_pltfm_data soc_data_sama5d2 = {
1080 diff --git a/drivers/mmc/host/sdhci-pci-core.c b/drivers/mmc/host/sdhci-pci-core.c
1081 index 1d9e00a00e9f..b0b9ceb0ab01 100644
1082 --- a/drivers/mmc/host/sdhci-pci-core.c
1083 +++ b/drivers/mmc/host/sdhci-pci-core.c
1084 @@ -412,6 +412,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
1085 if (mode == MMC_POWER_OFF)
1086 return;
1087
1088 + spin_unlock_irq(&host->lock);
1089 +
1090 /*
1091 * Bus power might not enable after D3 -> D0 transition due to the
1092 * present state not yet having propagated. Retry for up to 2ms.
1093 @@ -424,6 +426,8 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,
1094 reg |= SDHCI_POWER_ON;
1095 sdhci_writeb(host, reg, SDHCI_POWER_CONTROL);
1096 }
1097 +
1098 + spin_lock_irq(&host->lock);
1099 }
1100
1101 static const struct sdhci_ops sdhci_intel_byt_ops = {
1102 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
1103 index ba637ff8aa7e..a983ba0349fb 100644
1104 --- a/drivers/mmc/host/sdhci.c
1105 +++ b/drivers/mmc/host/sdhci.c
1106 @@ -1371,7 +1371,9 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
1107 return;
1108 }
1109 timeout--;
1110 - mdelay(1);
1111 + spin_unlock_irq(&host->lock);
1112 + usleep_range(900, 1100);
1113 + spin_lock_irq(&host->lock);
1114 }
1115
1116 clk |= SDHCI_CLOCK_CARD_EN;
1117 diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
1118 index d2c386f09d69..1d843357422e 100644
1119 --- a/drivers/mmc/host/ushc.c
1120 +++ b/drivers/mmc/host/ushc.c
1121 @@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
1122 struct ushc_data *ushc;
1123 int ret;
1124
1125 + if (intf->cur_altsetting->desc.bNumEndpoints < 1)
1126 + return -ENODEV;
1127 +
1128 mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
1129 if (mmc == NULL)
1130 return -ENOMEM;
1131 diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-common.h b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
1132 index bbef95973c27..1592e1cc77ce 100644
1133 --- a/drivers/net/ethernet/amd/xgbe/xgbe-common.h
1134 +++ b/drivers/net/ethernet/amd/xgbe/xgbe-common.h
1135 @@ -917,8 +917,8 @@
1136 #define RX_PACKET_ATTRIBUTES_CSUM_DONE_WIDTH 1
1137 #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_INDEX 1
1138 #define RX_PACKET_ATTRIBUTES_VLAN_CTAG_WIDTH 1
1139 -#define RX_PACKET_ATTRIBUTES_INCOMPLETE_INDEX 2
1140 -#define RX_PACKET_ATTRIBUTES_INCOMPLETE_WIDTH 1
1141 +#define RX_PACKET_ATTRIBUTES_LAST_INDEX 2
1142 +#define RX_PACKET_ATTRIBUTES_LAST_WIDTH 1
1143 #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_INDEX 3
1144 #define RX_PACKET_ATTRIBUTES_CONTEXT_NEXT_WIDTH 1
1145 #define RX_PACKET_ATTRIBUTES_CONTEXT_INDEX 4
1146 @@ -927,6 +927,8 @@
1147 #define RX_PACKET_ATTRIBUTES_RX_TSTAMP_WIDTH 1
1148 #define RX_PACKET_ATTRIBUTES_RSS_HASH_INDEX 6
1149 #define RX_PACKET_ATTRIBUTES_RSS_HASH_WIDTH 1
1150 +#define RX_PACKET_ATTRIBUTES_FIRST_INDEX 7
1151 +#define RX_PACKET_ATTRIBUTES_FIRST_WIDTH 1
1152
1153 #define RX_NORMAL_DESC0_OVT_INDEX 0
1154 #define RX_NORMAL_DESC0_OVT_WIDTH 16
1155 diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
1156 index 1babcc11a248..ca106d4275cc 100644
1157 --- a/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
1158 +++ b/drivers/net/ethernet/amd/xgbe/xgbe-dev.c
1159 @@ -1721,10 +1721,15 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
1160
1161 /* Get the header length */
1162 if (XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, FD)) {
1163 + XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1164 + FIRST, 1);
1165 rdata->rx.hdr_len = XGMAC_GET_BITS_LE(rdesc->desc2,
1166 RX_NORMAL_DESC2, HL);
1167 if (rdata->rx.hdr_len)
1168 pdata->ext_stats.rx_split_header_packets++;
1169 + } else {
1170 + XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1171 + FIRST, 0);
1172 }
1173
1174 /* Get the RSS hash */
1175 @@ -1747,19 +1752,16 @@ static int xgbe_dev_read(struct xgbe_channel *channel)
1176 }
1177 }
1178
1179 - /* Get the packet length */
1180 - rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
1181 -
1182 - if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD)) {
1183 - /* Not all the data has been transferred for this packet */
1184 - XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1185 - INCOMPLETE, 1);
1186 + /* Not all the data has been transferred for this packet */
1187 + if (!XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, LD))
1188 return 0;
1189 - }
1190
1191 /* This is the last of the data for this packet */
1192 XGMAC_SET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1193 - INCOMPLETE, 0);
1194 + LAST, 1);
1195 +
1196 + /* Get the packet length */
1197 + rdata->rx.len = XGMAC_GET_BITS_LE(rdesc->desc3, RX_NORMAL_DESC3, PL);
1198
1199 /* Set checksum done indicator as appropriate */
1200 if (netdev->features & NETIF_F_RXCSUM)
1201 diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
1202 index 7f9216db026f..0f0f30149e5a 100644
1203 --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
1204 +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
1205 @@ -1752,13 +1752,12 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
1206 {
1207 struct sk_buff *skb;
1208 u8 *packet;
1209 - unsigned int copy_len;
1210
1211 skb = napi_alloc_skb(napi, rdata->rx.hdr.dma_len);
1212 if (!skb)
1213 return NULL;
1214
1215 - /* Start with the header buffer which may contain just the header
1216 + /* Pull in the header buffer which may contain just the header
1217 * or the header plus data
1218 */
1219 dma_sync_single_range_for_cpu(pdata->dev, rdata->rx.hdr.dma_base,
1220 @@ -1767,30 +1766,49 @@ static struct sk_buff *xgbe_create_skb(struct xgbe_prv_data *pdata,
1221
1222 packet = page_address(rdata->rx.hdr.pa.pages) +
1223 rdata->rx.hdr.pa.pages_offset;
1224 - copy_len = (rdata->rx.hdr_len) ? rdata->rx.hdr_len : len;
1225 - copy_len = min(rdata->rx.hdr.dma_len, copy_len);
1226 - skb_copy_to_linear_data(skb, packet, copy_len);
1227 - skb_put(skb, copy_len);
1228 -
1229 - len -= copy_len;
1230 - if (len) {
1231 - /* Add the remaining data as a frag */
1232 - dma_sync_single_range_for_cpu(pdata->dev,
1233 - rdata->rx.buf.dma_base,
1234 - rdata->rx.buf.dma_off,
1235 - rdata->rx.buf.dma_len,
1236 - DMA_FROM_DEVICE);
1237 -
1238 - skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
1239 - rdata->rx.buf.pa.pages,
1240 - rdata->rx.buf.pa.pages_offset,
1241 - len, rdata->rx.buf.dma_len);
1242 - rdata->rx.buf.pa.pages = NULL;
1243 - }
1244 + skb_copy_to_linear_data(skb, packet, len);
1245 + skb_put(skb, len);
1246
1247 return skb;
1248 }
1249
1250 +static unsigned int xgbe_rx_buf1_len(struct xgbe_ring_data *rdata,
1251 + struct xgbe_packet_data *packet)
1252 +{
1253 + /* Always zero if not the first descriptor */
1254 + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, FIRST))
1255 + return 0;
1256 +
1257 + /* First descriptor with split header, return header length */
1258 + if (rdata->rx.hdr_len)
1259 + return rdata->rx.hdr_len;
1260 +
1261 + /* First descriptor but not the last descriptor and no split header,
1262 + * so the full buffer was used
1263 + */
1264 + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
1265 + return rdata->rx.hdr.dma_len;
1266 +
1267 + /* First descriptor and last descriptor and no split header, so
1268 + * calculate how much of the buffer was used
1269 + */
1270 + return min_t(unsigned int, rdata->rx.hdr.dma_len, rdata->rx.len);
1271 +}
1272 +
1273 +static unsigned int xgbe_rx_buf2_len(struct xgbe_ring_data *rdata,
1274 + struct xgbe_packet_data *packet,
1275 + unsigned int len)
1276 +{
1277 + /* Always the full buffer if not the last descriptor */
1278 + if (!XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES, LAST))
1279 + return rdata->rx.buf.dma_len;
1280 +
1281 + /* Last descriptor so calculate how much of the buffer was used
1282 + * for the last bit of data
1283 + */
1284 + return rdata->rx.len - len;
1285 +}
1286 +
1287 static int xgbe_tx_poll(struct xgbe_channel *channel)
1288 {
1289 struct xgbe_prv_data *pdata = channel->pdata;
1290 @@ -1873,8 +1891,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1291 struct napi_struct *napi;
1292 struct sk_buff *skb;
1293 struct skb_shared_hwtstamps *hwtstamps;
1294 - unsigned int incomplete, error, context_next, context;
1295 - unsigned int len, rdesc_len, max_len;
1296 + unsigned int last, error, context_next, context;
1297 + unsigned int len, buf1_len, buf2_len, max_len;
1298 unsigned int received = 0;
1299 int packet_count = 0;
1300
1301 @@ -1884,7 +1902,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1302 if (!ring)
1303 return 0;
1304
1305 - incomplete = 0;
1306 + last = 0;
1307 context_next = 0;
1308
1309 napi = (pdata->per_channel_irq) ? &channel->napi : &pdata->napi;
1310 @@ -1918,9 +1936,8 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1311 received++;
1312 ring->cur++;
1313
1314 - incomplete = XGMAC_GET_BITS(packet->attributes,
1315 - RX_PACKET_ATTRIBUTES,
1316 - INCOMPLETE);
1317 + last = XGMAC_GET_BITS(packet->attributes, RX_PACKET_ATTRIBUTES,
1318 + LAST);
1319 context_next = XGMAC_GET_BITS(packet->attributes,
1320 RX_PACKET_ATTRIBUTES,
1321 CONTEXT_NEXT);
1322 @@ -1929,7 +1946,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1323 CONTEXT);
1324
1325 /* Earlier error, just drain the remaining data */
1326 - if ((incomplete || context_next) && error)
1327 + if ((!last || context_next) && error)
1328 goto read_again;
1329
1330 if (error || packet->errors) {
1331 @@ -1941,16 +1958,22 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1332 }
1333
1334 if (!context) {
1335 - /* Length is cumulative, get this descriptor's length */
1336 - rdesc_len = rdata->rx.len - len;
1337 - len += rdesc_len;
1338 + /* Get the data length in the descriptor buffers */
1339 + buf1_len = xgbe_rx_buf1_len(rdata, packet);
1340 + len += buf1_len;
1341 + buf2_len = xgbe_rx_buf2_len(rdata, packet, len);
1342 + len += buf2_len;
1343
1344 - if (rdesc_len && !skb) {
1345 + if (!skb) {
1346 skb = xgbe_create_skb(pdata, napi, rdata,
1347 - rdesc_len);
1348 - if (!skb)
1349 + buf1_len);
1350 + if (!skb) {
1351 error = 1;
1352 - } else if (rdesc_len) {
1353 + goto skip_data;
1354 + }
1355 + }
1356 +
1357 + if (buf2_len) {
1358 dma_sync_single_range_for_cpu(pdata->dev,
1359 rdata->rx.buf.dma_base,
1360 rdata->rx.buf.dma_off,
1361 @@ -1960,13 +1983,14 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1362 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
1363 rdata->rx.buf.pa.pages,
1364 rdata->rx.buf.pa.pages_offset,
1365 - rdesc_len,
1366 + buf2_len,
1367 rdata->rx.buf.dma_len);
1368 rdata->rx.buf.pa.pages = NULL;
1369 }
1370 }
1371
1372 - if (incomplete || context_next)
1373 +skip_data:
1374 + if (!last || context_next)
1375 goto read_again;
1376
1377 if (!skb)
1378 @@ -2024,7 +2048,7 @@ static int xgbe_rx_poll(struct xgbe_channel *channel, int budget)
1379 }
1380
1381 /* Check if we need to save state before leaving */
1382 - if (received && (incomplete || context_next)) {
1383 + if (received && (!last || context_next)) {
1384 rdata = XGBE_GET_DESC_DATA(ring, ring->cur);
1385 rdata->state_saved = 1;
1386 rdata->state.skb = skb;
1387 diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1388 index a4e60e56c14f..0975af2903ef 100644
1389 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1390 +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
1391 @@ -3402,7 +3402,8 @@ static int bcmgenet_suspend(struct device *d)
1392
1393 bcmgenet_netif_stop(dev);
1394
1395 - phy_suspend(priv->phydev);
1396 + if (!device_may_wakeup(d))
1397 + phy_suspend(priv->phydev);
1398
1399 netif_device_detach(dev);
1400
1401 @@ -3499,7 +3500,8 @@ static int bcmgenet_resume(struct device *d)
1402
1403 netif_device_attach(dev);
1404
1405 - phy_resume(priv->phydev);
1406 + if (!device_may_wakeup(d))
1407 + phy_resume(priv->phydev);
1408
1409 if (priv->eee.eee_enabled)
1410 bcmgenet_eee_enable_set(dev, true);
1411 diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1412 index e87607621e62..2f9281936f0e 100644
1413 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c
1414 +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c
1415 @@ -220,20 +220,6 @@ void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
1416 udelay(60);
1417 }
1418
1419 -static void bcmgenet_internal_phy_setup(struct net_device *dev)
1420 -{
1421 - struct bcmgenet_priv *priv = netdev_priv(dev);
1422 - u32 reg;
1423 -
1424 - /* Power up PHY */
1425 - bcmgenet_phy_power_set(dev, true);
1426 - /* enable APD */
1427 - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
1428 - reg |= EXT_PWR_DN_EN_LD;
1429 - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
1430 - bcmgenet_mii_reset(dev);
1431 -}
1432 -
1433 static void bcmgenet_moca_phy_setup(struct bcmgenet_priv *priv)
1434 {
1435 u32 reg;
1436 @@ -281,7 +267,6 @@ int bcmgenet_mii_config(struct net_device *dev)
1437
1438 if (priv->internal_phy) {
1439 phy_name = "internal PHY";
1440 - bcmgenet_internal_phy_setup(dev);
1441 } else if (priv->phy_interface == PHY_INTERFACE_MODE_MOCA) {
1442 phy_name = "MoCA";
1443 bcmgenet_moca_phy_setup(priv);
1444 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1445 index bfe410e8a469..3f51a44bde6b 100644
1446 --- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1447 +++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
1448 @@ -367,6 +367,8 @@ static int mlx5_internal_err_ret_value(struct mlx5_core_dev *dev, u16 op,
1449 case MLX5_CMD_OP_QUERY_VPORT_COUNTER:
1450 case MLX5_CMD_OP_ALLOC_Q_COUNTER:
1451 case MLX5_CMD_OP_QUERY_Q_COUNTER:
1452 + case MLX5_CMD_OP_SET_RATE_LIMIT:
1453 + case MLX5_CMD_OP_QUERY_RATE_LIMIT:
1454 case MLX5_CMD_OP_ALLOC_PD:
1455 case MLX5_CMD_OP_ALLOC_UAR:
1456 case MLX5_CMD_OP_CONFIG_INT_MODERATION:
1457 @@ -500,6 +502,8 @@ const char *mlx5_command_str(int command)
1458 MLX5_COMMAND_STR_CASE(ALLOC_Q_COUNTER);
1459 MLX5_COMMAND_STR_CASE(DEALLOC_Q_COUNTER);
1460 MLX5_COMMAND_STR_CASE(QUERY_Q_COUNTER);
1461 + MLX5_COMMAND_STR_CASE(SET_RATE_LIMIT);
1462 + MLX5_COMMAND_STR_CASE(QUERY_RATE_LIMIT);
1463 MLX5_COMMAND_STR_CASE(ALLOC_PD);
1464 MLX5_COMMAND_STR_CASE(DEALLOC_PD);
1465 MLX5_COMMAND_STR_CASE(ALLOC_UAR);
1466 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1467 index 796bdf06122c..7309ae3b8c7b 100644
1468 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1469 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
1470 @@ -602,6 +602,10 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
1471 if (lro_num_seg > 1) {
1472 mlx5e_lro_update_hdr(skb, cqe, cqe_bcnt);
1473 skb_shinfo(skb)->gso_size = DIV_ROUND_UP(cqe_bcnt, lro_num_seg);
1474 + /* Subtract one since we already counted this as one
1475 + * "regular" packet in mlx5e_complete_rx_cqe()
1476 + */
1477 + rq->stats.packets += lro_num_seg - 1;
1478 rq->stats.lro_packets++;
1479 rq->stats.lro_bytes += cqe_bcnt;
1480 }
1481 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
1482 index a543ea676de3..3fd471a41895 100644
1483 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
1484 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
1485 @@ -427,14 +427,16 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1486 }
1487
1488 if (is_tcf_vlan(a)) {
1489 - if (tcf_vlan_action(a) == VLAN_F_POP) {
1490 + if (tcf_vlan_action(a) == TCA_VLAN_ACT_POP) {
1491 attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_POP;
1492 - } else if (tcf_vlan_action(a) == VLAN_F_PUSH) {
1493 + } else if (tcf_vlan_action(a) == TCA_VLAN_ACT_PUSH) {
1494 if (tcf_vlan_push_proto(a) != htons(ETH_P_8021Q))
1495 return -EOPNOTSUPP;
1496
1497 attr->action |= MLX5_FLOW_CONTEXT_ACTION_VLAN_PUSH;
1498 attr->vlan = tcf_vlan_push_vid(a);
1499 + } else { /* action is TCA_VLAN_ACT_MODIFY */
1500 + return -EOPNOTSUPP;
1501 }
1502 continue;
1503 }
1504 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
1505 index cfb68371c397..574311018e6f 100644
1506 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
1507 +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
1508 @@ -272,15 +272,18 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
1509 sq->stats.tso_bytes += skb->len - ihs;
1510 }
1511
1512 + sq->stats.packets += skb_shinfo(skb)->gso_segs;
1513 num_bytes = skb->len + (skb_shinfo(skb)->gso_segs - 1) * ihs;
1514 } else {
1515 bf = sq->bf_budget &&
1516 !skb->xmit_more &&
1517 !skb_shinfo(skb)->nr_frags;
1518 ihs = mlx5e_get_inline_hdr_size(sq, skb, bf);
1519 + sq->stats.packets++;
1520 num_bytes = max_t(unsigned int, skb->len, ETH_ZLEN);
1521 }
1522
1523 + sq->stats.bytes += num_bytes;
1524 wi->num_bytes = num_bytes;
1525
1526 if (skb_vlan_tag_present(skb)) {
1527 @@ -377,8 +380,6 @@ static netdev_tx_t mlx5e_sq_xmit(struct mlx5e_sq *sq, struct sk_buff *skb)
1528 if (bf)
1529 sq->bf_budget--;
1530
1531 - sq->stats.packets++;
1532 - sq->stats.bytes += num_bytes;
1533 return NETDEV_TX_OK;
1534
1535 dma_unmap_wqe_err:
1536 diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1537 index 0c9ef8729ca7..7a196a07fa51 100644
1538 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
1539 +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
1540 @@ -87,7 +87,7 @@ static struct mlx5_profile profile[] = {
1541 [2] = {
1542 .mask = MLX5_PROF_MASK_QP_SIZE |
1543 MLX5_PROF_MASK_MR_CACHE,
1544 - .log_max_qp = 17,
1545 + .log_max_qp = 18,
1546 .mr_cache[0] = {
1547 .size = 500,
1548 .limit = 250
1549 diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
1550 index 24d5272cdce5..0d519a9582ca 100644
1551 --- a/drivers/net/usb/qmi_wwan.c
1552 +++ b/drivers/net/usb/qmi_wwan.c
1553 @@ -924,6 +924,8 @@ static const struct usb_device_id products[] = {
1554 {QMI_FIXED_INTF(0x413c, 0x81a9, 8)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
1555 {QMI_FIXED_INTF(0x413c, 0x81b1, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
1556 {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
1557 + {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
1558 + {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
1559 {QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
1560 {QMI_FIXED_INTF(0x22de, 0x9061, 3)}, /* WeTelecom WPD-600N */
1561 {QMI_FIXED_INTF(0x1e0e, 0x9001, 5)}, /* SIMCom 7230E */
1562 diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
1563 index bc744acabf98..a2afb8ecb5bc 100644
1564 --- a/drivers/net/vrf.c
1565 +++ b/drivers/net/vrf.c
1566 @@ -467,8 +467,10 @@ static void vrf_rt6_release(struct net_device *dev, struct net_vrf *vrf)
1567 }
1568
1569 if (rt6_local) {
1570 - if (rt6_local->rt6i_idev)
1571 + if (rt6_local->rt6i_idev) {
1572 in6_dev_put(rt6_local->rt6i_idev);
1573 + rt6_local->rt6i_idev = NULL;
1574 + }
1575
1576 dst = &rt6_local->dst;
1577 dev_put(dst->dev);
1578 diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
1579 index 3c3c4f197da8..7a310c491ea5 100644
1580 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c
1581 +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
1582 @@ -2700,6 +2700,21 @@ static void mwifiex_pcie_device_dump(struct mwifiex_adapter *adapter)
1583 schedule_work(&pcie_work);
1584 }
1585
1586 +static void mwifiex_pcie_free_buffers(struct mwifiex_adapter *adapter)
1587 +{
1588 + struct pcie_service_card *card = adapter->card;
1589 + const struct mwifiex_pcie_card_reg *reg = card->pcie.reg;
1590 +
1591 + if (reg->sleep_cookie)
1592 + mwifiex_pcie_delete_sleep_cookie_buf(adapter);
1593 +
1594 + mwifiex_pcie_delete_cmdrsp_buf(adapter);
1595 + mwifiex_pcie_delete_evtbd_ring(adapter);
1596 + mwifiex_pcie_delete_rxbd_ring(adapter);
1597 + mwifiex_pcie_delete_txbd_ring(adapter);
1598 + card->cmdrsp_buf = NULL;
1599 +}
1600 +
1601 /*
1602 * This function initializes the PCI-E host memory space, WCB rings, etc.
1603 *
1604 @@ -2812,13 +2827,6 @@ static int mwifiex_pcie_init(struct mwifiex_adapter *adapter)
1605
1606 /*
1607 * This function cleans up the allocated card buffers.
1608 - *
1609 - * The following are freed by this function -
1610 - * - TXBD ring buffers
1611 - * - RXBD ring buffers
1612 - * - Event BD ring buffers
1613 - * - Command response ring buffer
1614 - * - Sleep cookie buffer
1615 */
1616 static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
1617 {
1618 @@ -2834,6 +2842,8 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
1619 "Failed to write driver not-ready signature\n");
1620 }
1621
1622 + mwifiex_pcie_free_buffers(adapter);
1623 +
1624 if (pdev) {
1625 pci_iounmap(pdev, card->pci_mmap);
1626 pci_iounmap(pdev, card->pci_mmap1);
1627 @@ -3080,10 +3090,7 @@ static void mwifiex_pcie_up_dev(struct mwifiex_adapter *adapter)
1628 pci_iounmap(pdev, card->pci_mmap1);
1629 }
1630
1631 -/* This function cleans up the PCI-E host memory space.
1632 - * Some code is extracted from mwifiex_unregister_dev()
1633 - *
1634 - */
1635 +/* This function cleans up the PCI-E host memory space. */
1636 static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter)
1637 {
1638 struct pcie_service_card *card = adapter->card;
1639 @@ -3095,16 +3102,8 @@ static void mwifiex_pcie_down_dev(struct mwifiex_adapter *adapter)
1640 adapter->seq_num = 0;
1641 adapter->tx_buf_size = MWIFIEX_TX_DATA_BUF_SIZE_4K;
1642
1643 - if (card) {
1644 - if (reg->sleep_cookie)
1645 - mwifiex_pcie_delete_sleep_cookie_buf(adapter);
1646 -
1647 - mwifiex_pcie_delete_cmdrsp_buf(adapter);
1648 - mwifiex_pcie_delete_evtbd_ring(adapter);
1649 - mwifiex_pcie_delete_rxbd_ring(adapter);
1650 - mwifiex_pcie_delete_txbd_ring(adapter);
1651 - card->cmdrsp_buf = NULL;
1652 - }
1653 + if (card)
1654 + mwifiex_pcie_free_buffers(adapter);
1655
1656 return;
1657 }
1658 diff --git a/drivers/parport/share.c b/drivers/parport/share.c
1659 index 3308427ed9f7..4399de34054a 100644
1660 --- a/drivers/parport/share.c
1661 +++ b/drivers/parport/share.c
1662 @@ -939,8 +939,10 @@ parport_register_dev_model(struct parport *port, const char *name,
1663 * pardevice fields. -arca
1664 */
1665 port->ops->init_state(par_dev, par_dev->state);
1666 - port->proc_device = par_dev;
1667 - parport_device_proc_register(par_dev);
1668 + if (!test_and_set_bit(PARPORT_DEVPROC_REGISTERED, &port->devflags)) {
1669 + port->proc_device = par_dev;
1670 + parport_device_proc_register(par_dev);
1671 + }
1672
1673 return par_dev;
1674
1675 diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
1676 index a6c1fae7d52a..a391b50fb32f 100644
1677 --- a/drivers/usb/class/usbtmc.c
1678 +++ b/drivers/usb/class/usbtmc.c
1679 @@ -1380,7 +1380,7 @@ static int usbtmc_probe(struct usb_interface *intf,
1680
1681 dev_dbg(&intf->dev, "%s called\n", __func__);
1682
1683 - data = kmalloc(sizeof(*data), GFP_KERNEL);
1684 + data = kzalloc(sizeof(*data), GFP_KERNEL);
1685 if (!data)
1686 return -ENOMEM;
1687
1688 @@ -1443,6 +1443,13 @@ static int usbtmc_probe(struct usb_interface *intf,
1689 break;
1690 }
1691 }
1692 +
1693 + if (!data->bulk_out || !data->bulk_in) {
1694 + dev_err(&intf->dev, "bulk endpoints not found\n");
1695 + retcode = -ENODEV;
1696 + goto err_put;
1697 + }
1698 +
1699 /* Find int endpoint */
1700 for (n = 0; n < iface_desc->desc.bNumEndpoints; n++) {
1701 endpoint = &iface_desc->endpoint[n].desc;
1702 @@ -1468,8 +1475,10 @@ static int usbtmc_probe(struct usb_interface *intf,
1703 if (data->iin_ep_present) {
1704 /* allocate int urb */
1705 data->iin_urb = usb_alloc_urb(0, GFP_KERNEL);
1706 - if (!data->iin_urb)
1707 + if (!data->iin_urb) {
1708 + retcode = -ENOMEM;
1709 goto error_register;
1710 + }
1711
1712 /* will reference data in int urb */
1713 kref_get(&data->kref);
1714 @@ -1477,8 +1486,10 @@ static int usbtmc_probe(struct usb_interface *intf,
1715 /* allocate buffer for interrupt in */
1716 data->iin_buffer = kmalloc(data->iin_wMaxPacketSize,
1717 GFP_KERNEL);
1718 - if (!data->iin_buffer)
1719 + if (!data->iin_buffer) {
1720 + retcode = -ENOMEM;
1721 goto error_register;
1722 + }
1723
1724 /* fill interrupt urb */
1725 usb_fill_int_urb(data->iin_urb, data->usb_dev,
1726 @@ -1511,6 +1522,7 @@ static int usbtmc_probe(struct usb_interface *intf,
1727 sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
1728 sysfs_remove_group(&intf->dev.kobj, &data_attr_grp);
1729 usbtmc_free_int(data);
1730 +err_put:
1731 kref_put(&data->kref, usbtmc_delete);
1732 return retcode;
1733 }
1734 diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
1735 index 1f7036c8f57b..eef716bdc259 100644
1736 --- a/drivers/usb/core/config.c
1737 +++ b/drivers/usb/core/config.c
1738 @@ -275,6 +275,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
1739
1740 /*
1741 * Adjust bInterval for quirked devices.
1742 + */
1743 + /*
1744 + * This quirk fixes bIntervals reported in ms.
1745 + */
1746 + if (to_usb_device(ddev)->quirks &
1747 + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) {
1748 + n = clamp(fls(d->bInterval) + 3, i, j);
1749 + i = j = n;
1750 + }
1751 + /*
1752 * This quirk fixes bIntervals reported in
1753 * linear microframes.
1754 */
1755 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
1756 index aef81a16e2c8..c28ccf1b5a1f 100644
1757 --- a/drivers/usb/core/hub.c
1758 +++ b/drivers/usb/core/hub.c
1759 @@ -4266,7 +4266,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev)
1760 struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent);
1761 int connect_type = USB_PORT_CONNECT_TYPE_UNKNOWN;
1762
1763 - if (!udev->usb2_hw_lpm_capable)
1764 + if (!udev->usb2_hw_lpm_capable || !udev->bos)
1765 return;
1766
1767 if (hub)
1768 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1769 index 24f9f98968a5..96b21b0dac1e 100644
1770 --- a/drivers/usb/core/quirks.c
1771 +++ b/drivers/usb/core/quirks.c
1772 @@ -170,6 +170,14 @@ static const struct usb_device_id usb_quirk_list[] = {
1773 /* M-Systems Flash Disk Pioneers */
1774 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1775
1776 + /* Baum Vario Ultra */
1777 + { USB_DEVICE(0x0904, 0x6101), .driver_info =
1778 + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1779 + { USB_DEVICE(0x0904, 0x6102), .driver_info =
1780 + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1781 + { USB_DEVICE(0x0904, 0x6103), .driver_info =
1782 + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
1783 +
1784 /* Keytouch QWERTY Panel keyboard */
1785 { USB_DEVICE(0x0926, 0x3333), .driver_info =
1786 USB_QUIRK_CONFIG_INTF_STRINGS },
1787 diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
1788 index a30766ca4226..5e3828d9dac7 100644
1789 --- a/drivers/usb/gadget/function/f_acm.c
1790 +++ b/drivers/usb/gadget/function/f_acm.c
1791 @@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm)
1792 {
1793 struct usb_composite_dev *cdev = acm->port.func.config->cdev;
1794 int status;
1795 + __le16 serial_state;
1796
1797 spin_lock(&acm->lock);
1798 if (acm->notify_req) {
1799 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n",
1800 acm->port_num, acm->serial_state);
1801 + serial_state = cpu_to_le16(acm->serial_state);
1802 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
1803 - 0, &acm->serial_state, sizeof(acm->serial_state));
1804 + 0, &serial_state, sizeof(acm->serial_state));
1805 } else {
1806 acm->pending = true;
1807 status = 0;
1808 diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c
1809 index 29b41b5dee04..c7689d05356c 100644
1810 --- a/drivers/usb/gadget/function/f_uvc.c
1811 +++ b/drivers/usb/gadget/function/f_uvc.c
1812 @@ -625,7 +625,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
1813 uvc_ss_streaming_comp.bMaxBurst = opts->streaming_maxburst;
1814 uvc_ss_streaming_comp.wBytesPerInterval =
1815 cpu_to_le16(max_packet_size * max_packet_mult *
1816 - opts->streaming_maxburst);
1817 + (opts->streaming_maxburst + 1));
1818
1819 /* Allocate endpoints. */
1820 ep = usb_ep_autoconfig(cdev->gadget, &uvc_control_ep);
1821 diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
1822 index 2975e80b7a56..9a67ae39185b 100644
1823 --- a/drivers/usb/misc/idmouse.c
1824 +++ b/drivers/usb/misc/idmouse.c
1825 @@ -346,6 +346,9 @@ static int idmouse_probe(struct usb_interface *interface,
1826 if (iface_desc->desc.bInterfaceClass != 0x0A)
1827 return -ENODEV;
1828
1829 + if (iface_desc->desc.bNumEndpoints < 1)
1830 + return -ENODEV;
1831 +
1832 /* allocate memory for our device state and initialize it */
1833 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
1834 if (dev == NULL)
1835 diff --git a/drivers/usb/misc/lvstest.c b/drivers/usb/misc/lvstest.c
1836 index 77176511658f..d3d124753266 100644
1837 --- a/drivers/usb/misc/lvstest.c
1838 +++ b/drivers/usb/misc/lvstest.c
1839 @@ -366,6 +366,10 @@ static int lvs_rh_probe(struct usb_interface *intf,
1840
1841 hdev = interface_to_usbdev(intf);
1842 desc = intf->cur_altsetting;
1843 +
1844 + if (desc->desc.bNumEndpoints < 1)
1845 + return -ENODEV;
1846 +
1847 endpoint = &desc->endpoint[0].desc;
1848
1849 /* valid only for SS root hub */
1850 diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
1851 index 356d312add57..9ff66525924e 100644
1852 --- a/drivers/usb/misc/uss720.c
1853 +++ b/drivers/usb/misc/uss720.c
1854 @@ -708,6 +708,11 @@ static int uss720_probe(struct usb_interface *intf,
1855
1856 interface = intf->cur_altsetting;
1857
1858 + if (interface->desc.bNumEndpoints < 3) {
1859 + usb_put_dev(usbdev);
1860 + return -ENODEV;
1861 + }
1862 +
1863 /*
1864 * Allocate parport interface
1865 */
1866 diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c
1867 index d4d7c56b48c7..cb443df1113e 100644
1868 --- a/drivers/usb/musb/musb_cppi41.c
1869 +++ b/drivers/usb/musb/musb_cppi41.c
1870 @@ -232,8 +232,27 @@ static void cppi41_dma_callback(void *private_data)
1871 transferred < cppi41_channel->packet_sz)
1872 cppi41_channel->prog_len = 0;
1873
1874 - if (cppi41_channel->is_tx)
1875 - empty = musb_is_tx_fifo_empty(hw_ep);
1876 + if (cppi41_channel->is_tx) {
1877 + u8 type;
1878 +
1879 + if (is_host_active(musb))
1880 + type = hw_ep->out_qh->type;
1881 + else
1882 + type = hw_ep->ep_in.type;
1883 +
1884 + if (type == USB_ENDPOINT_XFER_ISOC)
1885 + /*
1886 + * Don't use the early-TX-interrupt workaround below
1887 + * for Isoch transfter. Since Isoch are periodic
1888 + * transfer, by the time the next transfer is
1889 + * scheduled, the current one should be done already.
1890 + *
1891 + * This avoids audio playback underrun issue.
1892 + */
1893 + empty = true;
1894 + else
1895 + empty = musb_is_tx_fifo_empty(hw_ep);
1896 + }
1897
1898 if (!cppi41_channel->is_tx || empty) {
1899 cppi41_trans_done(cppi41_channel);
1900 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1901 index 42cc72e54c05..af67a0de6b5d 100644
1902 --- a/drivers/usb/serial/option.c
1903 +++ b/drivers/usb/serial/option.c
1904 @@ -233,6 +233,14 @@ static void option_instat_callback(struct urb *urb);
1905 #define BANDRICH_PRODUCT_1012 0x1012
1906
1907 #define QUALCOMM_VENDOR_ID 0x05C6
1908 +/* These Quectel products use Qualcomm's vendor ID */
1909 +#define QUECTEL_PRODUCT_UC20 0x9003
1910 +#define QUECTEL_PRODUCT_UC15 0x9090
1911 +
1912 +#define QUECTEL_VENDOR_ID 0x2c7c
1913 +/* These Quectel products use Quectel's vendor ID */
1914 +#define QUECTEL_PRODUCT_EC21 0x0121
1915 +#define QUECTEL_PRODUCT_EC25 0x0125
1916
1917 #define CMOTECH_VENDOR_ID 0x16d8
1918 #define CMOTECH_PRODUCT_6001 0x6001
1919 @@ -1161,7 +1169,14 @@ static const struct usb_device_id option_ids[] = {
1920 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
1921 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
1922 { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
1923 - { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */
1924 + /* Quectel products using Qualcomm vendor ID */
1925 + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
1926 + { USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
1927 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1928 + /* Quectel products using Quectel vendor ID */
1929 + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
1930 + .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1931 + { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
1932 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1933 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
1934 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
1935 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1936 index 696458db7e3c..38b3f0d8cd58 100644
1937 --- a/drivers/usb/serial/qcserial.c
1938 +++ b/drivers/usb/serial/qcserial.c
1939 @@ -169,6 +169,8 @@ static const struct usb_device_id id_table[] = {
1940 {DEVICE_SWI(0x413c, 0x81a9)}, /* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
1941 {DEVICE_SWI(0x413c, 0x81b1)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
1942 {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
1943 + {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
1944 + {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
1945
1946 /* Huawei devices */
1947 {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
1948 diff --git a/drivers/usb/wusbcore/wa-hc.c b/drivers/usb/wusbcore/wa-hc.c
1949 index 252c7bd9218a..d01496fd27fe 100644
1950 --- a/drivers/usb/wusbcore/wa-hc.c
1951 +++ b/drivers/usb/wusbcore/wa-hc.c
1952 @@ -39,6 +39,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface,
1953 int result;
1954 struct device *dev = &iface->dev;
1955
1956 + if (iface->cur_altsetting->desc.bNumEndpoints < 3)
1957 + return -ENODEV;
1958 +
1959 result = wa_rpipes_create(wa);
1960 if (result < 0)
1961 goto error_rpipes_create;
1962 diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
1963 index 0aa6c3c29d17..35a1e777b449 100644
1964 --- a/drivers/uwb/hwa-rc.c
1965 +++ b/drivers/uwb/hwa-rc.c
1966 @@ -823,6 +823,9 @@ static int hwarc_probe(struct usb_interface *iface,
1967 struct hwarc *hwarc;
1968 struct device *dev = &iface->dev;
1969
1970 + if (iface->cur_altsetting->desc.bNumEndpoints < 1)
1971 + return -ENODEV;
1972 +
1973 result = -ENOMEM;
1974 uwb_rc = uwb_rc_alloc();
1975 if (uwb_rc == NULL) {
1976 diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
1977 index 2bfc846ac071..6345e85822a4 100644
1978 --- a/drivers/uwb/i1480/dfu/usb.c
1979 +++ b/drivers/uwb/i1480/dfu/usb.c
1980 @@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)
1981 result);
1982 }
1983
1984 + if (iface->cur_altsetting->desc.bNumEndpoints < 1)
1985 + return -ENODEV;
1986 +
1987 result = -ENOMEM;
1988 i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL);
1989 if (i1480_usb == NULL) {
1990 diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
1991 index b87f5cfdaea5..4db10d7990c9 100644
1992 --- a/drivers/video/console/fbcon.c
1993 +++ b/drivers/video/console/fbcon.c
1994 @@ -1167,6 +1167,8 @@ static void fbcon_free_font(struct display *p, bool freefont)
1995 p->userfont = 0;
1996 }
1997
1998 +static void set_vc_hi_font(struct vc_data *vc, bool set);
1999 +
2000 static void fbcon_deinit(struct vc_data *vc)
2001 {
2002 struct display *p = &fb_display[vc->vc_num];
2003 @@ -1202,6 +1204,9 @@ static void fbcon_deinit(struct vc_data *vc)
2004 if (free_font)
2005 vc->vc_font.data = NULL;
2006
2007 + if (vc->vc_hi_font_mask)
2008 + set_vc_hi_font(vc, false);
2009 +
2010 if (!con_is_bound(&fb_con))
2011 fbcon_exit();
2012
2013 @@ -2438,32 +2443,10 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
2014 return 0;
2015 }
2016
2017 -static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2018 - const u8 * data, int userfont)
2019 +/* set/clear vc_hi_font_mask and update vc attrs accordingly */
2020 +static void set_vc_hi_font(struct vc_data *vc, bool set)
2021 {
2022 - struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2023 - struct fbcon_ops *ops = info->fbcon_par;
2024 - struct display *p = &fb_display[vc->vc_num];
2025 - int resize;
2026 - int cnt;
2027 - char *old_data = NULL;
2028 -
2029 - if (con_is_visible(vc) && softback_lines)
2030 - fbcon_set_origin(vc);
2031 -
2032 - resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
2033 - if (p->userfont)
2034 - old_data = vc->vc_font.data;
2035 - if (userfont)
2036 - cnt = FNTCHARCNT(data);
2037 - else
2038 - cnt = 256;
2039 - vc->vc_font.data = (void *)(p->fontdata = data);
2040 - if ((p->userfont = userfont))
2041 - REFCOUNT(data)++;
2042 - vc->vc_font.width = w;
2043 - vc->vc_font.height = h;
2044 - if (vc->vc_hi_font_mask && cnt == 256) {
2045 + if (!set) {
2046 vc->vc_hi_font_mask = 0;
2047 if (vc->vc_can_do_color) {
2048 vc->vc_complement_mask >>= 1;
2049 @@ -2486,7 +2469,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2050 ((c & 0xfe00) >> 1) | (c & 0xff);
2051 vc->vc_attr >>= 1;
2052 }
2053 - } else if (!vc->vc_hi_font_mask && cnt == 512) {
2054 + } else {
2055 vc->vc_hi_font_mask = 0x100;
2056 if (vc->vc_can_do_color) {
2057 vc->vc_complement_mask <<= 1;
2058 @@ -2518,8 +2501,38 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2059 } else
2060 vc->vc_video_erase_char = c & ~0x100;
2061 }
2062 -
2063 }
2064 +}
2065 +
2066 +static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
2067 + const u8 * data, int userfont)
2068 +{
2069 + struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
2070 + struct fbcon_ops *ops = info->fbcon_par;
2071 + struct display *p = &fb_display[vc->vc_num];
2072 + int resize;
2073 + int cnt;
2074 + char *old_data = NULL;
2075 +
2076 + if (con_is_visible(vc) && softback_lines)
2077 + fbcon_set_origin(vc);
2078 +
2079 + resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
2080 + if (p->userfont)
2081 + old_data = vc->vc_font.data;
2082 + if (userfont)
2083 + cnt = FNTCHARCNT(data);
2084 + else
2085 + cnt = 256;
2086 + vc->vc_font.data = (void *)(p->fontdata = data);
2087 + if ((p->userfont = userfont))
2088 + REFCOUNT(data)++;
2089 + vc->vc_font.width = w;
2090 + vc->vc_font.height = h;
2091 + if (vc->vc_hi_font_mask && cnt == 256)
2092 + set_vc_hi_font(vc, false);
2093 + else if (!vc->vc_hi_font_mask && cnt == 512)
2094 + set_vc_hi_font(vc, true);
2095
2096 if (resize) {
2097 int cols, rows;
2098 diff --git a/drivers/xen/xen-acpi-processor.c b/drivers/xen/xen-acpi-processor.c
2099 index 4ce10bcca18b..4b857463a2b4 100644
2100 --- a/drivers/xen/xen-acpi-processor.c
2101 +++ b/drivers/xen/xen-acpi-processor.c
2102 @@ -27,10 +27,10 @@
2103 #include <linux/init.h>
2104 #include <linux/module.h>
2105 #include <linux/types.h>
2106 +#include <linux/syscore_ops.h>
2107 #include <linux/acpi.h>
2108 #include <acpi/processor.h>
2109 #include <xen/xen.h>
2110 -#include <xen/xen-ops.h>
2111 #include <xen/interface/platform.h>
2112 #include <asm/xen/hypercall.h>
2113
2114 @@ -466,15 +466,33 @@ static int xen_upload_processor_pm_data(void)
2115 return rc;
2116 }
2117
2118 -static int xen_acpi_processor_resume(struct notifier_block *nb,
2119 - unsigned long action, void *data)
2120 +static void xen_acpi_processor_resume_worker(struct work_struct *dummy)
2121 {
2122 + int rc;
2123 +
2124 bitmap_zero(acpi_ids_done, nr_acpi_bits);
2125 - return xen_upload_processor_pm_data();
2126 +
2127 + rc = xen_upload_processor_pm_data();
2128 + if (rc != 0)
2129 + pr_info("ACPI data upload failed, error = %d\n", rc);
2130 +}
2131 +
2132 +static void xen_acpi_processor_resume(void)
2133 +{
2134 + static DECLARE_WORK(wq, xen_acpi_processor_resume_worker);
2135 +
2136 + /*
2137 + * xen_upload_processor_pm_data() calls non-atomic code.
2138 + * However, the context for xen_acpi_processor_resume is syscore
2139 + * with only the boot CPU online and in an atomic context.
2140 + *
2141 + * So defer the upload for some point safer.
2142 + */
2143 + schedule_work(&wq);
2144 }
2145
2146 -struct notifier_block xen_acpi_processor_resume_nb = {
2147 - .notifier_call = xen_acpi_processor_resume,
2148 +static struct syscore_ops xap_syscore_ops = {
2149 + .resume = xen_acpi_processor_resume,
2150 };
2151
2152 static int __init xen_acpi_processor_init(void)
2153 @@ -527,7 +545,7 @@ static int __init xen_acpi_processor_init(void)
2154 if (rc)
2155 goto err_unregister;
2156
2157 - xen_resume_notifier_register(&xen_acpi_processor_resume_nb);
2158 + register_syscore_ops(&xap_syscore_ops);
2159
2160 return 0;
2161 err_unregister:
2162 @@ -544,7 +562,7 @@ static void __exit xen_acpi_processor_exit(void)
2163 {
2164 int i;
2165
2166 - xen_resume_notifier_unregister(&xen_acpi_processor_resume_nb);
2167 + unregister_syscore_ops(&xap_syscore_ops);
2168 kfree(acpi_ids_done);
2169 kfree(acpi_id_present);
2170 kfree(acpi_id_cst_present);
2171 diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
2172 index 37b521ed39df..73cbc01ef5ad 100644
2173 --- a/fs/ext4/inline.c
2174 +++ b/fs/ext4/inline.c
2175 @@ -1157,10 +1157,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
2176 set_buffer_uptodate(dir_block);
2177 err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
2178 if (err)
2179 - goto out;
2180 + return err;
2181 set_buffer_verified(dir_block);
2182 -out:
2183 - return err;
2184 + return ext4_mark_inode_dirty(handle, inode);
2185 }
2186
2187 static int ext4_convert_inline_data_nolock(handle_t *handle,
2188 diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
2189 index 4448ed37181b..3eeed8f0aa06 100644
2190 --- a/fs/ext4/xattr.c
2191 +++ b/fs/ext4/xattr.c
2192 @@ -131,31 +131,26 @@ static __le32 ext4_xattr_block_csum(struct inode *inode,
2193 }
2194
2195 static int ext4_xattr_block_csum_verify(struct inode *inode,
2196 - sector_t block_nr,
2197 - struct ext4_xattr_header *hdr)
2198 + struct buffer_head *bh)
2199 {
2200 - if (ext4_has_metadata_csum(inode->i_sb) &&
2201 - (hdr->h_checksum != ext4_xattr_block_csum(inode, block_nr, hdr)))
2202 - return 0;
2203 - return 1;
2204 -}
2205 -
2206 -static void ext4_xattr_block_csum_set(struct inode *inode,
2207 - sector_t block_nr,
2208 - struct ext4_xattr_header *hdr)
2209 -{
2210 - if (!ext4_has_metadata_csum(inode->i_sb))
2211 - return;
2212 + struct ext4_xattr_header *hdr = BHDR(bh);
2213 + int ret = 1;
2214
2215 - hdr->h_checksum = ext4_xattr_block_csum(inode, block_nr, hdr);
2216 + if (ext4_has_metadata_csum(inode->i_sb)) {
2217 + lock_buffer(bh);
2218 + ret = (hdr->h_checksum == ext4_xattr_block_csum(inode,
2219 + bh->b_blocknr, hdr));
2220 + unlock_buffer(bh);
2221 + }
2222 + return ret;
2223 }
2224
2225 -static inline int ext4_handle_dirty_xattr_block(handle_t *handle,
2226 - struct inode *inode,
2227 - struct buffer_head *bh)
2228 +static void ext4_xattr_block_csum_set(struct inode *inode,
2229 + struct buffer_head *bh)
2230 {
2231 - ext4_xattr_block_csum_set(inode, bh->b_blocknr, BHDR(bh));
2232 - return ext4_handle_dirty_metadata(handle, inode, bh);
2233 + if (ext4_has_metadata_csum(inode->i_sb))
2234 + BHDR(bh)->h_checksum = ext4_xattr_block_csum(inode,
2235 + bh->b_blocknr, BHDR(bh));
2236 }
2237
2238 static inline const struct xattr_handler *
2239 @@ -218,7 +213,7 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh)
2240 if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) ||
2241 BHDR(bh)->h_blocks != cpu_to_le32(1))
2242 return -EFSCORRUPTED;
2243 - if (!ext4_xattr_block_csum_verify(inode, bh->b_blocknr, BHDR(bh)))
2244 + if (!ext4_xattr_block_csum_verify(inode, bh))
2245 return -EFSBADCRC;
2246 error = ext4_xattr_check_names(BFIRST(bh), bh->b_data + bh->b_size,
2247 bh->b_data);
2248 @@ -601,23 +596,22 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
2249 }
2250 }
2251
2252 + ext4_xattr_block_csum_set(inode, bh);
2253 /*
2254 * Beware of this ugliness: Releasing of xattr block references
2255 * from different inodes can race and so we have to protect
2256 * from a race where someone else frees the block (and releases
2257 * its journal_head) before we are done dirtying the buffer. In
2258 * nojournal mode this race is harmless and we actually cannot
2259 - * call ext4_handle_dirty_xattr_block() with locked buffer as
2260 + * call ext4_handle_dirty_metadata() with locked buffer as
2261 * that function can call sync_dirty_buffer() so for that case
2262 * we handle the dirtying after unlocking the buffer.
2263 */
2264 if (ext4_handle_valid(handle))
2265 - error = ext4_handle_dirty_xattr_block(handle, inode,
2266 - bh);
2267 + error = ext4_handle_dirty_metadata(handle, inode, bh);
2268 unlock_buffer(bh);
2269 if (!ext4_handle_valid(handle))
2270 - error = ext4_handle_dirty_xattr_block(handle, inode,
2271 - bh);
2272 + error = ext4_handle_dirty_metadata(handle, inode, bh);
2273 if (IS_SYNC(inode))
2274 ext4_handle_sync(handle);
2275 dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1));
2276 @@ -846,13 +840,14 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
2277 ext4_xattr_cache_insert(ext4_mb_cache,
2278 bs->bh);
2279 }
2280 + ext4_xattr_block_csum_set(inode, bs->bh);
2281 unlock_buffer(bs->bh);
2282 if (error == -EFSCORRUPTED)
2283 goto bad_block;
2284 if (!error)
2285 - error = ext4_handle_dirty_xattr_block(handle,
2286 - inode,
2287 - bs->bh);
2288 + error = ext4_handle_dirty_metadata(handle,
2289 + inode,
2290 + bs->bh);
2291 if (error)
2292 goto cleanup;
2293 goto inserted;
2294 @@ -950,10 +945,11 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
2295 ce->e_reusable = 0;
2296 ea_bdebug(new_bh, "reusing; refcount now=%d",
2297 ref);
2298 + ext4_xattr_block_csum_set(inode, new_bh);
2299 unlock_buffer(new_bh);
2300 - error = ext4_handle_dirty_xattr_block(handle,
2301 - inode,
2302 - new_bh);
2303 + error = ext4_handle_dirty_metadata(handle,
2304 + inode,
2305 + new_bh);
2306 if (error)
2307 goto cleanup_dquot;
2308 }
2309 @@ -1003,11 +999,12 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
2310 goto getblk_failed;
2311 }
2312 memcpy(new_bh->b_data, s->base, new_bh->b_size);
2313 + ext4_xattr_block_csum_set(inode, new_bh);
2314 set_buffer_uptodate(new_bh);
2315 unlock_buffer(new_bh);
2316 ext4_xattr_cache_insert(ext4_mb_cache, new_bh);
2317 - error = ext4_handle_dirty_xattr_block(handle,
2318 - inode, new_bh);
2319 + error = ext4_handle_dirty_metadata(handle, inode,
2320 + new_bh);
2321 if (error)
2322 goto cleanup;
2323 }
2324 diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
2325 index 927da4956a89..7d4b557f1962 100644
2326 --- a/fs/jbd2/journal.c
2327 +++ b/fs/jbd2/journal.c
2328 @@ -1125,10 +1125,8 @@ static journal_t *journal_init_common(struct block_device *bdev,
2329
2330 /* Set up a default-sized revoke table for the new mount. */
2331 err = jbd2_journal_init_revoke(journal, JOURNAL_REVOKE_DEFAULT_HASH);
2332 - if (err) {
2333 - kfree(journal);
2334 - return NULL;
2335 - }
2336 + if (err)
2337 + goto err_cleanup;
2338
2339 spin_lock_init(&journal->j_history_lock);
2340
2341 @@ -1145,23 +1143,25 @@ static journal_t *journal_init_common(struct block_device *bdev,
2342 journal->j_wbufsize = n;
2343 journal->j_wbuf = kmalloc_array(n, sizeof(struct buffer_head *),
2344 GFP_KERNEL);
2345 - if (!journal->j_wbuf) {
2346 - kfree(journal);
2347 - return NULL;
2348 - }
2349 + if (!journal->j_wbuf)
2350 + goto err_cleanup;
2351
2352 bh = getblk_unmovable(journal->j_dev, start, journal->j_blocksize);
2353 if (!bh) {
2354 pr_err("%s: Cannot get buffer for journal superblock\n",
2355 __func__);
2356 - kfree(journal->j_wbuf);
2357 - kfree(journal);
2358 - return NULL;
2359 + goto err_cleanup;
2360 }
2361 journal->j_sb_buffer = bh;
2362 journal->j_superblock = (journal_superblock_t *)bh->b_data;
2363
2364 return journal;
2365 +
2366 +err_cleanup:
2367 + kfree(journal->j_wbuf);
2368 + jbd2_journal_destroy_revoke(journal);
2369 + kfree(journal);
2370 + return NULL;
2371 }
2372
2373 /* jbd2_journal_init_dev and jbd2_journal_init_inode:
2374 diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c
2375 index 91171dc352cb..3cd73059da9a 100644
2376 --- a/fs/jbd2/revoke.c
2377 +++ b/fs/jbd2/revoke.c
2378 @@ -280,6 +280,7 @@ int jbd2_journal_init_revoke(journal_t *journal, int hash_size)
2379
2380 fail1:
2381 jbd2_journal_destroy_revoke_table(journal->j_revoke_table[0]);
2382 + journal->j_revoke_table[0] = NULL;
2383 fail0:
2384 return -ENOMEM;
2385 }
2386 diff --git a/include/drm/drmP.h b/include/drm/drmP.h
2387 index 672644031bd5..e9fb2e802feb 100644
2388 --- a/include/drm/drmP.h
2389 +++ b/include/drm/drmP.h
2390 @@ -361,6 +361,7 @@ struct drm_ioctl_desc {
2391 /* Event queued up for userspace to read */
2392 struct drm_pending_event {
2393 struct completion *completion;
2394 + void (*completion_release)(struct completion *completion);
2395 struct drm_event *event;
2396 struct fence *fence;
2397 struct list_head link;
2398 diff --git a/include/linux/ccp.h b/include/linux/ccp.h
2399 index a7653339fedb..edc5d04b9632 100644
2400 --- a/include/linux/ccp.h
2401 +++ b/include/linux/ccp.h
2402 @@ -556,7 +556,7 @@ enum ccp_engine {
2403 * struct ccp_cmd - CPP operation request
2404 * @entry: list element (ccp driver use only)
2405 * @work: work element used for callbacks (ccp driver use only)
2406 - * @ccp: CCP device to be run on (ccp driver use only)
2407 + * @ccp: CCP device to be run on
2408 * @ret: operation return code (ccp driver use only)
2409 * @flags: cmd processing flags
2410 * @engine: CCP operation to perform
2411 diff --git a/include/linux/iio/sw_device.h b/include/linux/iio/sw_device.h
2412 index 23ca41515527..fa7931933067 100644
2413 --- a/include/linux/iio/sw_device.h
2414 +++ b/include/linux/iio/sw_device.h
2415 @@ -62,7 +62,7 @@ void iio_swd_group_init_type_name(struct iio_sw_device *d,
2416 const char *name,
2417 struct config_item_type *type)
2418 {
2419 -#ifdef CONFIG_CONFIGFS_FS
2420 +#if IS_ENABLED(CONFIG_CONFIGFS_FS)
2421 config_group_init_type_name(&d->group, name, type);
2422 #endif
2423 }
2424 diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
2425 index 1d0043dc34e4..de2a722fe3cf 100644
2426 --- a/include/linux/usb/quirks.h
2427 +++ b/include/linux/usb/quirks.h
2428 @@ -50,4 +50,10 @@
2429 /* device can't handle Link Power Management */
2430 #define USB_QUIRK_NO_LPM BIT(10)
2431
2432 +/*
2433 + * Device reports its bInterval as linear frames instead of the
2434 + * USB 2.0 calculation.
2435 + */
2436 +#define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11)
2437 +
2438 #endif /* __LINUX_USB_QUIRKS_H */
2439 diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
2440 index d2436880b305..d3f6c26425b3 100644
2441 --- a/net/ceph/osdmap.c
2442 +++ b/net/ceph/osdmap.c
2443 @@ -1334,7 +1334,6 @@ static int decode_new_up_state_weight(void **p, void *end,
2444 if ((map->osd_state[osd] & CEPH_OSD_EXISTS) &&
2445 (xorstate & CEPH_OSD_EXISTS)) {
2446 pr_info("osd%d does not exist\n", osd);
2447 - map->osd_weight[osd] = CEPH_OSD_IN;
2448 ret = set_primary_affinity(map, osd,
2449 CEPH_OSD_DEFAULT_PRIMARY_AFFINITY);
2450 if (ret)
2451 diff --git a/net/core/netclassid_cgroup.c b/net/core/netclassid_cgroup.c
2452 index 11fce17274f6..46e8830c1979 100644
2453 --- a/net/core/netclassid_cgroup.c
2454 +++ b/net/core/netclassid_cgroup.c
2455 @@ -69,27 +69,17 @@ static int update_classid_sock(const void *v, struct file *file, unsigned n)
2456 return 0;
2457 }
2458
2459 -static void update_classid(struct cgroup_subsys_state *css, void *v)
2460 +static void cgrp_attach(struct cgroup_taskset *tset)
2461 {
2462 - struct css_task_iter it;
2463 + struct cgroup_subsys_state *css;
2464 struct task_struct *p;
2465
2466 - css_task_iter_start(css, &it);
2467 - while ((p = css_task_iter_next(&it))) {
2468 + cgroup_taskset_for_each(p, css, tset) {
2469 task_lock(p);
2470 - iterate_fd(p->files, 0, update_classid_sock, v);
2471 + iterate_fd(p->files, 0, update_classid_sock,
2472 + (void *)(unsigned long)css_cls_state(css)->classid);
2473 task_unlock(p);
2474 }
2475 - css_task_iter_end(&it);
2476 -}
2477 -
2478 -static void cgrp_attach(struct cgroup_taskset *tset)
2479 -{
2480 - struct cgroup_subsys_state *css;
2481 -
2482 - cgroup_taskset_first(tset, &css);
2483 - update_classid(css,
2484 - (void *)(unsigned long)css_cls_state(css)->classid);
2485 }
2486
2487 static u64 read_classid(struct cgroup_subsys_state *css, struct cftype *cft)
2488 @@ -101,12 +91,22 @@ static int write_classid(struct cgroup_subsys_state *css, struct cftype *cft,
2489 u64 value)
2490 {
2491 struct cgroup_cls_state *cs = css_cls_state(css);
2492 + struct css_task_iter it;
2493 + struct task_struct *p;
2494
2495 cgroup_sk_alloc_disable();
2496
2497 cs->classid = (u32)value;
2498
2499 - update_classid(css, (void *)(unsigned long)cs->classid);
2500 + css_task_iter_start(css, &it);
2501 + while ((p = css_task_iter_next(&it))) {
2502 + task_lock(p);
2503 + iterate_fd(p->files, 0, update_classid_sock,
2504 + (void *)(unsigned long)cs->classid);
2505 + task_unlock(p);
2506 + }
2507 + css_task_iter_end(&it);
2508 +
2509 return 0;
2510 }
2511
2512 diff --git a/net/core/sock.c b/net/core/sock.c
2513 index bc6543f7de36..470a2043b846 100644
2514 --- a/net/core/sock.c
2515 +++ b/net/core/sock.c
2516 @@ -1437,6 +1437,11 @@ static void __sk_destruct(struct rcu_head *head)
2517 pr_debug("%s: optmem leakage (%d bytes) detected\n",
2518 __func__, atomic_read(&sk->sk_omem_alloc));
2519
2520 + if (sk->sk_frag.page) {
2521 + put_page(sk->sk_frag.page);
2522 + sk->sk_frag.page = NULL;
2523 + }
2524 +
2525 if (sk->sk_peer_cred)
2526 put_cred(sk->sk_peer_cred);
2527 put_pid(sk->sk_peer_pid);
2528 @@ -1533,6 +1538,12 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)
2529 is_charged = sk_filter_charge(newsk, filter);
2530
2531 if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) {
2532 + /* We need to make sure that we don't uncharge the new
2533 + * socket if we couldn't charge it in the first place
2534 + * as otherwise we uncharge the parent's filter.
2535 + */
2536 + if (!is_charged)
2537 + RCU_INIT_POINTER(newsk->sk_filter, NULL);
2538 /* It is still raw copy of parent, so invalidate
2539 * destructor and make plain sk_free() */
2540 newsk->sk_destruct = NULL;
2541 @@ -2738,11 +2749,6 @@ void sk_common_release(struct sock *sk)
2542
2543 sk_refcnt_debug_release(sk);
2544
2545 - if (sk->sk_frag.page) {
2546 - put_page(sk->sk_frag.page);
2547 - sk->sk_frag.page = NULL;
2548 - }
2549 -
2550 sock_put(sk);
2551 }
2552 EXPORT_SYMBOL(sk_common_release);
2553 diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
2554 index 5b03d7f3b255..6789e48b7085 100644
2555 --- a/net/ipv4/fib_frontend.c
2556 +++ b/net/ipv4/fib_frontend.c
2557 @@ -1081,7 +1081,8 @@ static void nl_fib_input(struct sk_buff *skb)
2558
2559 net = sock_net(skb->sk);
2560 nlh = nlmsg_hdr(skb);
2561 - if (skb->len < NLMSG_HDRLEN || skb->len < nlh->nlmsg_len ||
2562 + if (skb->len < nlmsg_total_size(sizeof(*frn)) ||
2563 + skb->len < nlh->nlmsg_len ||
2564 nlmsg_len(nlh) < sizeof(*frn))
2565 return;
2566
2567 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
2568 index ce42ded59958..7727ffeaaf9d 100644
2569 --- a/net/ipv4/tcp_input.c
2570 +++ b/net/ipv4/tcp_input.c
2571 @@ -5571,6 +5571,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_buff *skb)
2572 struct inet_connection_sock *icsk = inet_csk(sk);
2573
2574 tcp_set_state(sk, TCP_ESTABLISHED);
2575 + icsk->icsk_ack.lrcvtime = tcp_time_stamp;
2576
2577 if (skb) {
2578 icsk->icsk_af_ops->sk_rx_dst_set(sk, skb);
2579 @@ -5789,7 +5790,6 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
2580 * to stand against the temptation 8) --ANK
2581 */
2582 inet_csk_schedule_ack(sk);
2583 - icsk->icsk_ack.lrcvtime = tcp_time_stamp;
2584 tcp_enter_quickack_mode(sk);
2585 inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK,
2586 TCP_DELACK_MAX, TCP_RTO_MAX);
2587 diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
2588 index 6234ebaa7db1..8615a6b8550f 100644
2589 --- a/net/ipv4/tcp_minisocks.c
2590 +++ b/net/ipv4/tcp_minisocks.c
2591 @@ -466,6 +466,7 @@ struct sock *tcp_create_openreq_child(const struct sock *sk,
2592 newtp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT);
2593 minmax_reset(&newtp->rtt_min, tcp_time_stamp, ~0U);
2594 newicsk->icsk_rto = TCP_TIMEOUT_INIT;
2595 + newicsk->icsk_ack.lrcvtime = tcp_time_stamp;
2596
2597 newtp->packets_out = 0;
2598 newtp->retrans_out = 0;
2599 diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
2600 index e4a8000d59ad..40a289f78d77 100644
2601 --- a/net/ipv6/udp.c
2602 +++ b/net/ipv6/udp.c
2603 @@ -1037,6 +1037,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
2604 ipc6.hlimit = -1;
2605 ipc6.tclass = -1;
2606 ipc6.dontfrag = -1;
2607 + sockc.tsflags = sk->sk_tsflags;
2608
2609 /* destination address check */
2610 if (sin6) {
2611 @@ -1156,7 +1157,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
2612 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
2613
2614 fl6.flowi6_mark = sk->sk_mark;
2615 - sockc.tsflags = sk->sk_tsflags;
2616
2617 if (msg->msg_controllen) {
2618 opt = &opt_space;
2619 diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
2620 index ae25ded82b3b..07925418c2a5 100644
2621 --- a/net/openvswitch/flow_netlink.c
2622 +++ b/net/openvswitch/flow_netlink.c
2623 @@ -588,7 +588,7 @@ static int ip_tun_from_nlattr(const struct nlattr *attr,
2624 ipv4 = true;
2625 break;
2626 case OVS_TUNNEL_KEY_ATTR_IPV6_SRC:
2627 - SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.dst,
2628 + SW_FLOW_KEY_PUT(match, tun_key.u.ipv6.src,
2629 nla_get_in6_addr(a), is_mask);
2630 ipv6 = true;
2631 break;
2632 @@ -649,6 +649,8 @@ static int ip_tun_from_nlattr(const struct nlattr *attr,
2633 tun_flags |= TUNNEL_VXLAN_OPT;
2634 opts_type = type;
2635 break;
2636 + case OVS_TUNNEL_KEY_ATTR_PAD:
2637 + break;
2638 default:
2639 OVS_NLERR(log, "Unknown IP tunnel attribute %d",
2640 type);
2641 diff --git a/net/unix/garbage.c b/net/unix/garbage.c
2642 index 6a0d48525fcf..c36757e72844 100644
2643 --- a/net/unix/garbage.c
2644 +++ b/net/unix/garbage.c
2645 @@ -146,6 +146,7 @@ void unix_notinflight(struct user_struct *user, struct file *fp)
2646 if (s) {
2647 struct unix_sock *u = unix_sk(s);
2648
2649 + BUG_ON(!atomic_long_read(&u->inflight));
2650 BUG_ON(list_empty(&u->link));
2651
2652 if (atomic_long_dec_and_test(&u->inflight))
2653 @@ -341,6 +342,14 @@ void unix_gc(void)
2654 }
2655 list_del(&cursor);
2656
2657 + /* Now gc_candidates contains only garbage. Restore original
2658 + * inflight counters for these as well, and remove the skbuffs
2659 + * which are creating the cycle(s).
2660 + */
2661 + skb_queue_head_init(&hitlist);
2662 + list_for_each_entry(u, &gc_candidates, link)
2663 + scan_children(&u->sk, inc_inflight, &hitlist);
2664 +
2665 /* not_cycle_list contains those sockets which do not make up a
2666 * cycle. Restore these to the inflight list.
2667 */
2668 @@ -350,14 +359,6 @@ void unix_gc(void)
2669 list_move_tail(&u->link, &gc_inflight_list);
2670 }
2671
2672 - /* Now gc_candidates contains only garbage. Restore original
2673 - * inflight counters for these as well, and remove the skbuffs
2674 - * which are creating the cycle(s).
2675 - */
2676 - skb_queue_head_init(&hitlist);
2677 - list_for_each_entry(u, &gc_candidates, link)
2678 - scan_children(&u->sk, inc_inflight, &hitlist);
2679 -
2680 spin_unlock(&unix_gc_lock);
2681
2682 /* Here we are. Hitlist is filled. Die. */
2683 diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
2684 index cd7a419faa21..e7a3068a1c3b 100644
2685 --- a/net/wireless/nl80211.c
2686 +++ b/net/wireless/nl80211.c
2687 @@ -548,21 +548,17 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2688 {
2689 int err;
2690
2691 - rtnl_lock();
2692 -
2693 if (!cb->args[0]) {
2694 err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
2695 nl80211_fam.attrbuf, nl80211_fam.maxattr,
2696 nl80211_policy);
2697 if (err)
2698 - goto out_unlock;
2699 + return err;
2700
2701 *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
2702 nl80211_fam.attrbuf);
2703 - if (IS_ERR(*wdev)) {
2704 - err = PTR_ERR(*wdev);
2705 - goto out_unlock;
2706 - }
2707 + if (IS_ERR(*wdev))
2708 + return PTR_ERR(*wdev);
2709 *rdev = wiphy_to_rdev((*wdev)->wiphy);
2710 /* 0 is the first index - add 1 to parse only once */
2711 cb->args[0] = (*rdev)->wiphy_idx + 1;
2712 @@ -572,10 +568,8 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2713 struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
2714 struct wireless_dev *tmp;
2715
2716 - if (!wiphy) {
2717 - err = -ENODEV;
2718 - goto out_unlock;
2719 - }
2720 + if (!wiphy)
2721 + return -ENODEV;
2722 *rdev = wiphy_to_rdev(wiphy);
2723 *wdev = NULL;
2724
2725 @@ -586,21 +580,11 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
2726 }
2727 }
2728
2729 - if (!*wdev) {
2730 - err = -ENODEV;
2731 - goto out_unlock;
2732 - }
2733 + if (!*wdev)
2734 + return -ENODEV;
2735 }
2736
2737 return 0;
2738 - out_unlock:
2739 - rtnl_unlock();
2740 - return err;
2741 -}
2742 -
2743 -static void nl80211_finish_wdev_dump(struct cfg80211_registered_device *rdev)
2744 -{
2745 - rtnl_unlock();
2746 }
2747
2748 /* IE validation */
2749 @@ -2584,17 +2568,17 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
2750 int filter_wiphy = -1;
2751 struct cfg80211_registered_device *rdev;
2752 struct wireless_dev *wdev;
2753 + int ret;
2754
2755 rtnl_lock();
2756 if (!cb->args[2]) {
2757 struct nl80211_dump_wiphy_state state = {
2758 .filter_wiphy = -1,
2759 };
2760 - int ret;
2761
2762 ret = nl80211_dump_wiphy_parse(skb, cb, &state);
2763 if (ret)
2764 - return ret;
2765 + goto out_unlock;
2766
2767 filter_wiphy = state.filter_wiphy;
2768
2769 @@ -2639,12 +2623,14 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
2770 wp_idx++;
2771 }
2772 out:
2773 - rtnl_unlock();
2774 -
2775 cb->args[0] = wp_idx;
2776 cb->args[1] = if_idx;
2777
2778 - return skb->len;
2779 + ret = skb->len;
2780 + out_unlock:
2781 + rtnl_unlock();
2782 +
2783 + return ret;
2784 }
2785
2786 static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
2787 @@ -4371,9 +4357,10 @@ static int nl80211_dump_station(struct sk_buff *skb,
2788 int sta_idx = cb->args[2];
2789 int err;
2790
2791 + rtnl_lock();
2792 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2793 if (err)
2794 - return err;
2795 + goto out_err;
2796
2797 if (!wdev->netdev) {
2798 err = -EINVAL;
2799 @@ -4408,7 +4395,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
2800 cb->args[2] = sta_idx;
2801 err = skb->len;
2802 out_err:
2803 - nl80211_finish_wdev_dump(rdev);
2804 + rtnl_unlock();
2805
2806 return err;
2807 }
2808 @@ -5179,9 +5166,10 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
2809 int path_idx = cb->args[2];
2810 int err;
2811
2812 + rtnl_lock();
2813 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2814 if (err)
2815 - return err;
2816 + goto out_err;
2817
2818 if (!rdev->ops->dump_mpath) {
2819 err = -EOPNOTSUPP;
2820 @@ -5214,7 +5202,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
2821 cb->args[2] = path_idx;
2822 err = skb->len;
2823 out_err:
2824 - nl80211_finish_wdev_dump(rdev);
2825 + rtnl_unlock();
2826 return err;
2827 }
2828
2829 @@ -5374,9 +5362,10 @@ static int nl80211_dump_mpp(struct sk_buff *skb,
2830 int path_idx = cb->args[2];
2831 int err;
2832
2833 + rtnl_lock();
2834 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2835 if (err)
2836 - return err;
2837 + goto out_err;
2838
2839 if (!rdev->ops->dump_mpp) {
2840 err = -EOPNOTSUPP;
2841 @@ -5409,7 +5398,7 @@ static int nl80211_dump_mpp(struct sk_buff *skb,
2842 cb->args[2] = path_idx;
2843 err = skb->len;
2844 out_err:
2845 - nl80211_finish_wdev_dump(rdev);
2846 + rtnl_unlock();
2847 return err;
2848 }
2849
2850 @@ -7556,9 +7545,12 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
2851 int start = cb->args[2], idx = 0;
2852 int err;
2853
2854 + rtnl_lock();
2855 err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2856 - if (err)
2857 + if (err) {
2858 + rtnl_unlock();
2859 return err;
2860 + }
2861
2862 wdev_lock(wdev);
2863 spin_lock_bh(&rdev->bss_lock);
2864 @@ -7581,7 +7573,7 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
2865 wdev_unlock(wdev);
2866
2867 cb->args[2] = idx;
2868 - nl80211_finish_wdev_dump(rdev);
2869 + rtnl_unlock();
2870
2871 return skb->len;
2872 }
2873 @@ -7665,9 +7657,10 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
2874 int res;
2875 bool radio_stats;
2876
2877 + rtnl_lock();
2878 res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
2879 if (res)
2880 - return res;
2881 + goto out_err;
2882
2883 /* prepare_wdev_dump parsed the attributes */
2884 radio_stats = nl80211_fam.attrbuf[NL80211_ATTR_SURVEY_RADIO_STATS];
2885 @@ -7708,7 +7701,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, struct netlink_callback *cb)
2886 cb->args[2] = survey_idx;
2887 res = skb->len;
2888 out_err:
2889 - nl80211_finish_wdev_dump(rdev);
2890 + rtnl_unlock();
2891 return res;
2892 }
2893
2894 @@ -11299,17 +11292,13 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2895 void *data = NULL;
2896 unsigned int data_len = 0;
2897
2898 - rtnl_lock();
2899 -
2900 if (cb->args[0]) {
2901 /* subtract the 1 again here */
2902 struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
2903 struct wireless_dev *tmp;
2904
2905 - if (!wiphy) {
2906 - err = -ENODEV;
2907 - goto out_unlock;
2908 - }
2909 + if (!wiphy)
2910 + return -ENODEV;
2911 *rdev = wiphy_to_rdev(wiphy);
2912 *wdev = NULL;
2913
2914 @@ -11330,13 +11319,11 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2915 nl80211_fam.attrbuf, nl80211_fam.maxattr,
2916 nl80211_policy);
2917 if (err)
2918 - goto out_unlock;
2919 + return err;
2920
2921 if (!nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID] ||
2922 - !nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]) {
2923 - err = -EINVAL;
2924 - goto out_unlock;
2925 - }
2926 + !nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD])
2927 + return -EINVAL;
2928
2929 *wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
2930 nl80211_fam.attrbuf);
2931 @@ -11345,10 +11332,8 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2932
2933 *rdev = __cfg80211_rdev_from_attrs(sock_net(skb->sk),
2934 nl80211_fam.attrbuf);
2935 - if (IS_ERR(*rdev)) {
2936 - err = PTR_ERR(*rdev);
2937 - goto out_unlock;
2938 - }
2939 + if (IS_ERR(*rdev))
2940 + return PTR_ERR(*rdev);
2941
2942 vid = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_ID]);
2943 subcmd = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_SUBCMD]);
2944 @@ -11361,19 +11346,15 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2945 if (vcmd->info.vendor_id != vid || vcmd->info.subcmd != subcmd)
2946 continue;
2947
2948 - if (!vcmd->dumpit) {
2949 - err = -EOPNOTSUPP;
2950 - goto out_unlock;
2951 - }
2952 + if (!vcmd->dumpit)
2953 + return -EOPNOTSUPP;
2954
2955 vcmd_idx = i;
2956 break;
2957 }
2958
2959 - if (vcmd_idx < 0) {
2960 - err = -EOPNOTSUPP;
2961 - goto out_unlock;
2962 - }
2963 + if (vcmd_idx < 0)
2964 + return -EOPNOTSUPP;
2965
2966 if (nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]) {
2967 data = nla_data(nl80211_fam.attrbuf[NL80211_ATTR_VENDOR_DATA]);
2968 @@ -11390,9 +11371,6 @@ static int nl80211_prepare_vendor_dump(struct sk_buff *skb,
2969
2970 /* keep rtnl locked in successful case */
2971 return 0;
2972 - out_unlock:
2973 - rtnl_unlock();
2974 - return err;
2975 }
2976
2977 static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2978 @@ -11407,9 +11385,10 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2979 int err;
2980 struct nlattr *vendor_data;
2981
2982 + rtnl_lock();
2983 err = nl80211_prepare_vendor_dump(skb, cb, &rdev, &wdev);
2984 if (err)
2985 - return err;
2986 + goto out;
2987
2988 vcmd_idx = cb->args[2];
2989 data = (void *)cb->args[3];
2990 @@ -11418,18 +11397,26 @@ static int nl80211_vendor_cmd_dump(struct sk_buff *skb,
2991
2992 if (vcmd->flags & (WIPHY_VENDOR_CMD_NEED_WDEV |
2993 WIPHY_VENDOR_CMD_NEED_NETDEV)) {
2994 - if (!wdev)
2995 - return -EINVAL;
2996 + if (!wdev) {
2997 + err = -EINVAL;
2998 + goto out;
2999 + }
3000 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_NETDEV &&
3001 - !wdev->netdev)
3002 - return -EINVAL;
3003 + !wdev->netdev) {
3004 + err = -EINVAL;
3005 + goto out;
3006 + }
3007
3008 if (vcmd->flags & WIPHY_VENDOR_CMD_NEED_RUNNING) {
3009 if (wdev->netdev &&
3010 - !netif_running(wdev->netdev))
3011 - return -ENETDOWN;
3012 - if (!wdev->netdev && !wdev->p2p_started)
3013 - return -ENETDOWN;
3014 + !netif_running(wdev->netdev)) {
3015 + err = -ENETDOWN;
3016 + goto out;
3017 + }
3018 + if (!wdev->netdev && !wdev->p2p_started) {
3019 + err = -ENETDOWN;
3020 + goto out;
3021 + }
3022 }
3023 }
3024
3025 diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
3026 index 4c935202ce23..f3b1d7f50b81 100644
3027 --- a/sound/core/seq/seq_clientmgr.c
3028 +++ b/sound/core/seq/seq_clientmgr.c
3029 @@ -1832,6 +1832,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
3030 info->output_pool != client->pool->size)) {
3031 if (snd_seq_write_pool_allocated(client)) {
3032 /* remove all existing cells */
3033 + snd_seq_pool_mark_closing(client->pool);
3034 snd_seq_queue_client_leave_cells(client->number);
3035 snd_seq_pool_done(client->pool);
3036 }
3037 diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
3038 index 86240d02b530..3f4efcb85df5 100644
3039 --- a/sound/core/seq/seq_fifo.c
3040 +++ b/sound/core/seq/seq_fifo.c
3041 @@ -70,6 +70,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
3042 return;
3043 *fifo = NULL;
3044
3045 + if (f->pool)
3046 + snd_seq_pool_mark_closing(f->pool);
3047 +
3048 snd_seq_fifo_clear(f);
3049
3050 /* wake up clients if any */
3051 diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
3052 index dfa5156f3585..5847c4475bf3 100644
3053 --- a/sound/core/seq/seq_memory.c
3054 +++ b/sound/core/seq/seq_memory.c
3055 @@ -414,6 +414,18 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
3056 return 0;
3057 }
3058
3059 +/* refuse the further insertion to the pool */
3060 +void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
3061 +{
3062 + unsigned long flags;
3063 +
3064 + if (snd_BUG_ON(!pool))
3065 + return;
3066 + spin_lock_irqsave(&pool->lock, flags);
3067 + pool->closing = 1;
3068 + spin_unlock_irqrestore(&pool->lock, flags);
3069 +}
3070 +
3071 /* remove events */
3072 int snd_seq_pool_done(struct snd_seq_pool *pool)
3073 {
3074 @@ -424,10 +436,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool)
3075 return -EINVAL;
3076
3077 /* wait for closing all threads */
3078 - spin_lock_irqsave(&pool->lock, flags);
3079 - pool->closing = 1;
3080 - spin_unlock_irqrestore(&pool->lock, flags);
3081 -
3082 if (waitqueue_active(&pool->output_sleep))
3083 wake_up(&pool->output_sleep);
3084
3085 @@ -484,6 +492,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool)
3086 *ppool = NULL;
3087 if (pool == NULL)
3088 return 0;
3089 + snd_seq_pool_mark_closing(pool);
3090 snd_seq_pool_done(pool);
3091 kfree(pool);
3092 return 0;
3093 diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
3094 index 4a2ec779b8a7..32f959c17786 100644
3095 --- a/sound/core/seq/seq_memory.h
3096 +++ b/sound/core/seq/seq_memory.h
3097 @@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
3098 int snd_seq_pool_init(struct snd_seq_pool *pool);
3099
3100 /* done pool - free events */
3101 +void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
3102 int snd_seq_pool_done(struct snd_seq_pool *pool);
3103
3104 /* create pool */
3105 diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
3106 index ab4cdab5cfa5..79edd88d5cd0 100644
3107 --- a/sound/pci/ctxfi/cthw20k1.c
3108 +++ b/sound/pci/ctxfi/cthw20k1.c
3109 @@ -1905,7 +1905,7 @@ static int hw_card_start(struct hw *hw)
3110 return err;
3111
3112 /* Set DMA transfer mask */
3113 - if (dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
3114 + if (!dma_set_mask(&pci->dev, DMA_BIT_MASK(dma_bits))) {
3115 dma_set_coherent_mask(&pci->dev, DMA_BIT_MASK(dma_bits));
3116 } else {
3117 dma_set_mask(&pci->dev, DMA_BIT_MASK(32));
3118 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3119 index 0c62b1d8c11b..112caa2d3c14 100644
3120 --- a/sound/pci/hda/patch_realtek.c
3121 +++ b/sound/pci/hda/patch_realtek.c
3122 @@ -6058,6 +6058,8 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
3123 ALC295_STANDARD_PINS,
3124 {0x17, 0x21014040},
3125 {0x18, 0x21a19050}),
3126 + SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
3127 + ALC295_STANDARD_PINS),
3128 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
3129 ALC298_STANDARD_PINS,
3130 {0x17, 0x90170110}),