Magellan Linux

Annotation of /trunk/kernel-magellan/patches-4.13/0107-4.13.8-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3011 - (hide annotations) (download)
Wed Oct 25 09:41:44 2017 UTC (6 years, 7 months ago) by niro
File size: 57443 byte(s)
-linux-4.13.8
1 niro 3011 diff --git a/Makefile b/Makefile
2     index 0d4f1b19869d..66ec023da822 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 13
8     -SUBLEVEL = 7
9     +SUBLEVEL = 8
10     EXTRAVERSION =
11     NAME = Fearless Coyote
12    
13     diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
14     index f08a7b4facb9..4f0a1a6f7589 100644
15     --- a/arch/mips/math-emu/cp1emu.c
16     +++ b/arch/mips/math-emu/cp1emu.c
17     @@ -2387,7 +2387,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
18     break;
19     default:
20     /* Reserved R6 ops */
21     - pr_err("Reserved MIPS R6 CMP.condn.S operation\n");
22     return SIGILL;
23     }
24     }
25     @@ -2461,7 +2460,6 @@ static int fpu_emu(struct pt_regs *xcp, struct mips_fpu_struct *ctx,
26     break;
27     default:
28     /* Reserved R6 ops */
29     - pr_err("Reserved MIPS R6 CMP.condn.D operation\n");
30     return SIGILL;
31     }
32     }
33     diff --git a/arch/mips/net/ebpf_jit.c b/arch/mips/net/ebpf_jit.c
34     index 3f87b96da5c4..401776f92288 100644
35     --- a/arch/mips/net/ebpf_jit.c
36     +++ b/arch/mips/net/ebpf_jit.c
37     @@ -679,7 +679,7 @@ static int build_one_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
38     {
39     int src, dst, r, td, ts, mem_off, b_off;
40     bool need_swap, did_move, cmp_eq;
41     - unsigned int target;
42     + unsigned int target = 0;
43     u64 t64;
44     s64 t64s;
45    
46     diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h
47     index e7636bac7372..6c98821fef5e 100644
48     --- a/arch/x86/include/asm/alternative-asm.h
49     +++ b/arch/x86/include/asm/alternative-asm.h
50     @@ -62,8 +62,10 @@
51     #define new_len2 145f-144f
52    
53     /*
54     - * max without conditionals. Idea adapted from:
55     + * gas compatible max based on the idea from:
56     * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
57     + *
58     + * The additional "-" is needed because gas uses a "true" value of -1.
59     */
60     #define alt_max_short(a, b) ((a) ^ (((a) ^ (b)) & -(-((a) < (b)))))
61    
62     diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
63     index 1b020381ab38..d4aea31eec03 100644
64     --- a/arch/x86/include/asm/alternative.h
65     +++ b/arch/x86/include/asm/alternative.h
66     @@ -103,12 +103,12 @@ static inline int alternatives_text_reserved(void *start, void *end)
67     alt_end_marker ":\n"
68    
69     /*
70     - * max without conditionals. Idea adapted from:
71     + * gas compatible max based on the idea from:
72     * http://graphics.stanford.edu/~seander/bithacks.html#IntegerMinOrMax
73     *
74     - * The additional "-" is needed because gas works with s32s.
75     + * The additional "-" is needed because gas uses a "true" value of -1.
76     */
77     -#define alt_max_short(a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") - (" b ")))))"
78     +#define alt_max_short(a, b) "((" a ") ^ (((" a ") ^ (" b ")) & -(-((" a ") < (" b ")))))"
79    
80     /*
81     * Pad the second replacement alternative with additional NOPs if it is
82     diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
83     index 86e8f0b2537b..c4fa4a85d4cb 100644
84     --- a/arch/x86/kernel/cpu/microcode/core.c
85     +++ b/arch/x86/kernel/cpu/microcode/core.c
86     @@ -122,9 +122,6 @@ static bool __init check_loader_disabled_bsp(void)
87     bool *res = &dis_ucode_ldr;
88     #endif
89    
90     - if (!have_cpuid_p())
91     - return *res;
92     -
93     /*
94     * CPUID(1).ECX[31]: reserved for hypervisor use. This is still not
95     * completely accurate as xen pv guests don't see that CPUID bit set but
96     @@ -166,24 +163,36 @@ bool get_builtin_firmware(struct cpio_data *cd, const char *name)
97     void __init load_ucode_bsp(void)
98     {
99     unsigned int cpuid_1_eax;
100     + bool intel = true;
101    
102     - if (check_loader_disabled_bsp())
103     + if (!have_cpuid_p())
104     return;
105    
106     cpuid_1_eax = native_cpuid_eax(1);
107    
108     switch (x86_cpuid_vendor()) {
109     case X86_VENDOR_INTEL:
110     - if (x86_family(cpuid_1_eax) >= 6)
111     - load_ucode_intel_bsp();
112     + if (x86_family(cpuid_1_eax) < 6)
113     + return;
114     break;
115     +
116     case X86_VENDOR_AMD:
117     - if (x86_family(cpuid_1_eax) >= 0x10)
118     - load_ucode_amd_bsp(cpuid_1_eax);
119     + if (x86_family(cpuid_1_eax) < 0x10)
120     + return;
121     + intel = false;
122     break;
123     +
124     default:
125     - break;
126     + return;
127     }
128     +
129     + if (check_loader_disabled_bsp())
130     + return;
131     +
132     + if (intel)
133     + load_ucode_intel_bsp();
134     + else
135     + load_ucode_amd_bsp(cpuid_1_eax);
136     }
137    
138     static bool check_loader_disabled_ap(void)
139     diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
140     index 7558531c1215..bd4e058c25a4 100644
141     --- a/arch/x86/kvm/mmu.c
142     +++ b/arch/x86/kvm/mmu.c
143     @@ -3934,13 +3934,6 @@ static bool sync_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, gfn_t gfn,
144     static inline bool is_last_gpte(struct kvm_mmu *mmu,
145     unsigned level, unsigned gpte)
146     {
147     - /*
148     - * PT_PAGE_TABLE_LEVEL always terminates. The RHS has bit 7 set
149     - * iff level <= PT_PAGE_TABLE_LEVEL, which for our purpose means
150     - * level == PT_PAGE_TABLE_LEVEL; set PT_PAGE_SIZE_MASK in gpte then.
151     - */
152     - gpte |= level - PT_PAGE_TABLE_LEVEL - 1;
153     -
154     /*
155     * The RHS has bit 7 set iff level < mmu->last_nonleaf_level.
156     * If it is clear, there are no large pages at this level, so clear
157     @@ -3948,6 +3941,13 @@ static inline bool is_last_gpte(struct kvm_mmu *mmu,
158     */
159     gpte &= level - mmu->last_nonleaf_level;
160    
161     + /*
162     + * PT_PAGE_TABLE_LEVEL always terminates. The RHS has bit 7 set
163     + * iff level <= PT_PAGE_TABLE_LEVEL, which for our purpose means
164     + * level == PT_PAGE_TABLE_LEVEL; set PT_PAGE_SIZE_MASK in gpte then.
165     + */
166     + gpte |= level - PT_PAGE_TABLE_LEVEL - 1;
167     +
168     return gpte & PT_PAGE_SIZE_MASK;
169     }
170    
171     @@ -4459,6 +4459,7 @@ void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly,
172    
173     update_permission_bitmask(vcpu, context, true);
174     update_pkru_bitmask(vcpu, context, true);
175     + update_last_nonleaf_level(vcpu, context);
176     reset_rsvds_bits_mask_ept(vcpu, context, execonly);
177     reset_ept_shadow_zero_bits_mask(vcpu, context, execonly);
178     }
179     diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
180     index b0454c7e4cff..da06dc8c4fc4 100644
181     --- a/arch/x86/kvm/paging_tmpl.h
182     +++ b/arch/x86/kvm/paging_tmpl.h
183     @@ -334,10 +334,11 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
184     --walker->level;
185    
186     index = PT_INDEX(addr, walker->level);
187     -
188     table_gfn = gpte_to_gfn(pte);
189     offset = index * sizeof(pt_element_t);
190     pte_gpa = gfn_to_gpa(table_gfn) + offset;
191     +
192     + BUG_ON(walker->level < 1);
193     walker->table_gfn[walker->level - 1] = table_gfn;
194     walker->pte_gpa[walker->level - 1] = pte_gpa;
195    
196     diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
197     index 95796e2efc38..118709e7597d 100644
198     --- a/arch/x86/kvm/vmx.c
199     +++ b/arch/x86/kvm/vmx.c
200     @@ -11013,7 +11013,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
201    
202     /* Same as above - no reason to call set_cr4_guest_host_mask(). */
203     vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl(CR4_GUEST_HOST_MASK);
204     - kvm_set_cr4(vcpu, vmcs12->host_cr4);
205     + vmx_set_cr4(vcpu, vmcs12->host_cr4);
206    
207     nested_ept_uninit_mmu_context(vcpu);
208    
209     diff --git a/block/bio.c b/block/bio.c
210     index 9a63597aaacc..30f56b8b1fb2 100644
211     --- a/block/bio.c
212     +++ b/block/bio.c
213     @@ -1235,8 +1235,8 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
214     */
215     bmd->is_our_pages = map_data ? 0 : 1;
216     memcpy(bmd->iov, iter->iov, sizeof(struct iovec) * iter->nr_segs);
217     - iov_iter_init(&bmd->iter, iter->type, bmd->iov,
218     - iter->nr_segs, iter->count);
219     + bmd->iter = *iter;
220     + bmd->iter.iov = bmd->iov;
221    
222     ret = -ENOMEM;
223     bio = bio_kmalloc(gfp_mask, nr_pages);
224     @@ -1327,6 +1327,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
225     int ret, offset;
226     struct iov_iter i;
227     struct iovec iov;
228     + struct bio_vec *bvec;
229    
230     iov_for_each(iov, i, *iter) {
231     unsigned long uaddr = (unsigned long) iov.iov_base;
232     @@ -1371,7 +1372,12 @@ struct bio *bio_map_user_iov(struct request_queue *q,
233     ret = get_user_pages_fast(uaddr, local_nr_pages,
234     (iter->type & WRITE) != WRITE,
235     &pages[cur_page]);
236     - if (ret < local_nr_pages) {
237     + if (unlikely(ret < local_nr_pages)) {
238     + for (j = cur_page; j < page_limit; j++) {
239     + if (!pages[j])
240     + break;
241     + put_page(pages[j]);
242     + }
243     ret = -EFAULT;
244     goto out_unmap;
245     }
246     @@ -1379,6 +1385,7 @@ struct bio *bio_map_user_iov(struct request_queue *q,
247     offset = offset_in_page(uaddr);
248     for (j = cur_page; j < page_limit; j++) {
249     unsigned int bytes = PAGE_SIZE - offset;
250     + unsigned short prev_bi_vcnt = bio->bi_vcnt;
251    
252     if (len <= 0)
253     break;
254     @@ -1393,6 +1400,13 @@ struct bio *bio_map_user_iov(struct request_queue *q,
255     bytes)
256     break;
257    
258     + /*
259     + * check if vector was merged with previous
260     + * drop page reference if needed
261     + */
262     + if (bio->bi_vcnt == prev_bi_vcnt)
263     + put_page(pages[j]);
264     +
265     len -= bytes;
266     offset = 0;
267     }
268     @@ -1419,10 +1433,8 @@ struct bio *bio_map_user_iov(struct request_queue *q,
269     return bio;
270    
271     out_unmap:
272     - for (j = 0; j < nr_pages; j++) {
273     - if (!pages[j])
274     - break;
275     - put_page(pages[j]);
276     + bio_for_each_segment_all(bvec, bio, j) {
277     + put_page(bvec->bv_page);
278     }
279     out:
280     kfree(pages);
281     diff --git a/crypto/shash.c b/crypto/shash.c
282     index 5e31c8d776df..f4161f3cfed6 100644
283     --- a/crypto/shash.c
284     +++ b/crypto/shash.c
285     @@ -275,12 +275,14 @@ static int shash_async_finup(struct ahash_request *req)
286    
287     int shash_ahash_digest(struct ahash_request *req, struct shash_desc *desc)
288     {
289     - struct scatterlist *sg = req->src;
290     - unsigned int offset = sg->offset;
291     unsigned int nbytes = req->nbytes;
292     + struct scatterlist *sg;
293     + unsigned int offset;
294     int err;
295    
296     - if (nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset)) {
297     + if (nbytes &&
298     + (sg = req->src, offset = sg->offset,
299     + nbytes < min(sg->length, ((unsigned int)(PAGE_SIZE)) - offset))) {
300     void *data;
301    
302     data = kmap_atomic(sg_page(sg));
303     diff --git a/crypto/skcipher.c b/crypto/skcipher.c
304     index 4faa0fd53b0c..d5692e35fab1 100644
305     --- a/crypto/skcipher.c
306     +++ b/crypto/skcipher.c
307     @@ -426,14 +426,9 @@ static int skcipher_copy_iv(struct skcipher_walk *walk)
308    
309     static int skcipher_walk_first(struct skcipher_walk *walk)
310     {
311     - walk->nbytes = 0;
312     -
313     if (WARN_ON_ONCE(in_irq()))
314     return -EDEADLK;
315    
316     - if (unlikely(!walk->total))
317     - return 0;
318     -
319     walk->buffer = NULL;
320     if (unlikely(((unsigned long)walk->iv & walk->alignmask))) {
321     int err = skcipher_copy_iv(walk);
322     @@ -452,10 +447,15 @@ static int skcipher_walk_skcipher(struct skcipher_walk *walk,
323     {
324     struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
325    
326     + walk->total = req->cryptlen;
327     + walk->nbytes = 0;
328     +
329     + if (unlikely(!walk->total))
330     + return 0;
331     +
332     scatterwalk_start(&walk->in, req->src);
333     scatterwalk_start(&walk->out, req->dst);
334    
335     - walk->total = req->cryptlen;
336     walk->iv = req->iv;
337     walk->oiv = req->iv;
338    
339     @@ -509,6 +509,11 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk,
340     struct crypto_aead *tfm = crypto_aead_reqtfm(req);
341     int err;
342    
343     + walk->nbytes = 0;
344     +
345     + if (unlikely(!walk->total))
346     + return 0;
347     +
348     walk->flags &= ~SKCIPHER_WALK_PHYS;
349    
350     scatterwalk_start(&walk->in, req->src);
351     diff --git a/drivers/base/property.c b/drivers/base/property.c
352     index edf02c1b5845..5d0c26a53876 100644
353     --- a/drivers/base/property.c
354     +++ b/drivers/base/property.c
355     @@ -21,6 +21,7 @@
356     #include <linux/phy.h>
357    
358     struct property_set {
359     + struct device *dev;
360     struct fwnode_handle fwnode;
361     const struct property_entry *properties;
362     };
363     @@ -855,6 +856,7 @@ static struct property_set *pset_copy_set(const struct property_set *pset)
364     void device_remove_properties(struct device *dev)
365     {
366     struct fwnode_handle *fwnode;
367     + struct property_set *pset;
368    
369     fwnode = dev_fwnode(dev);
370     if (!fwnode)
371     @@ -864,16 +866,16 @@ void device_remove_properties(struct device *dev)
372     * the pset. If there is no real firmware node (ACPI/DT) primary
373     * will hold the pset.
374     */
375     - if (is_pset_node(fwnode)) {
376     + pset = to_pset_node(fwnode);
377     + if (pset) {
378     set_primary_fwnode(dev, NULL);
379     - pset_free_set(to_pset_node(fwnode));
380     } else {
381     - fwnode = fwnode->secondary;
382     - if (!IS_ERR(fwnode) && is_pset_node(fwnode)) {
383     + pset = to_pset_node(fwnode->secondary);
384     + if (pset && dev == pset->dev)
385     set_secondary_fwnode(dev, NULL);
386     - pset_free_set(to_pset_node(fwnode));
387     - }
388     }
389     + if (pset && dev == pset->dev)
390     + pset_free_set(pset);
391     }
392     EXPORT_SYMBOL_GPL(device_remove_properties);
393    
394     @@ -903,6 +905,7 @@ int device_add_properties(struct device *dev,
395     p->fwnode.type = FWNODE_PDATA;
396     p->fwnode.ops = &pset_fwnode_ops;
397     set_secondary_fwnode(dev, &p->fwnode);
398     + p->dev = dev;
399     return 0;
400     }
401     EXPORT_SYMBOL_GPL(device_add_properties);
402     diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c
403     index 3879f80a4815..a7ea20e7b8e9 100644
404     --- a/drivers/dma/edma.c
405     +++ b/drivers/dma/edma.c
406     @@ -1143,11 +1143,24 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy(
407     struct edma_desc *edesc;
408     struct device *dev = chan->device->dev;
409     struct edma_chan *echan = to_edma_chan(chan);
410     - unsigned int width, pset_len;
411     + unsigned int width, pset_len, array_size;
412    
413     if (unlikely(!echan || !len))
414     return NULL;
415    
416     + /* Align the array size (acnt block) with the transfer properties */
417     + switch (__ffs((src | dest | len))) {
418     + case 0:
419     + array_size = SZ_32K - 1;
420     + break;
421     + case 1:
422     + array_size = SZ_32K - 2;
423     + break;
424     + default:
425     + array_size = SZ_32K - 4;
426     + break;
427     + }
428     +
429     if (len < SZ_64K) {
430     /*
431     * Transfer size less than 64K can be handled with one paRAM
432     @@ -1169,7 +1182,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy(
433     * When the full_length is multibple of 32767 one slot can be
434     * used to complete the transfer.
435     */
436     - width = SZ_32K - 1;
437     + width = array_size;
438     pset_len = rounddown(len, width);
439     /* One slot is enough for lengths multiple of (SZ_32K -1) */
440     if (unlikely(pset_len == len))
441     @@ -1217,7 +1230,7 @@ static struct dma_async_tx_descriptor *edma_prep_dma_memcpy(
442     }
443     dest += pset_len;
444     src += pset_len;
445     - pset_len = width = len % (SZ_32K - 1);
446     + pset_len = width = len % array_size;
447    
448     ret = edma_config_pset(chan, &edesc->pset[1], src, dest, 1,
449     width, pset_len, DMA_MEM_TO_MEM);
450     diff --git a/drivers/dma/ti-dma-crossbar.c b/drivers/dma/ti-dma-crossbar.c
451     index 2403475a37cf..88a00d06def6 100644
452     --- a/drivers/dma/ti-dma-crossbar.c
453     +++ b/drivers/dma/ti-dma-crossbar.c
454     @@ -262,13 +262,14 @@ static void *ti_dra7_xbar_route_allocate(struct of_phandle_args *dma_spec,
455     mutex_lock(&xbar->mutex);
456     map->xbar_out = find_first_zero_bit(xbar->dma_inuse,
457     xbar->dma_requests);
458     - mutex_unlock(&xbar->mutex);
459     if (map->xbar_out == xbar->dma_requests) {
460     + mutex_unlock(&xbar->mutex);
461     dev_err(&pdev->dev, "Run out of free DMA requests\n");
462     kfree(map);
463     return ERR_PTR(-ENOMEM);
464     }
465     set_bit(map->xbar_out, xbar->dma_inuse);
466     + mutex_unlock(&xbar->mutex);
467    
468     map->xbar_in = (u16)dma_spec->args[0];
469    
470     diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
471     index 86d3093c6c9b..c73763959945 100644
472     --- a/drivers/gpu/drm/drm_atomic_helper.c
473     +++ b/drivers/gpu/drm/drm_atomic_helper.c
474     @@ -2756,6 +2756,7 @@ int drm_atomic_helper_resume(struct drm_device *dev,
475     drm_modeset_backoff(&ctx);
476     }
477    
478     + drm_atomic_state_put(state);
479     drm_modeset_drop_locks(&ctx);
480     drm_modeset_acquire_fini(&ctx);
481    
482     diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
483     index 645488071944..f814359c86c9 100644
484     --- a/drivers/gpu/drm/i915/intel_bios.c
485     +++ b/drivers/gpu/drm/i915/intel_bios.c
486     @@ -1231,7 +1231,7 @@ static void parse_ddi_ports(struct drm_i915_private *dev_priv,
487     {
488     enum port port;
489    
490     - if (!HAS_DDI(dev_priv))
491     + if (!HAS_DDI(dev_priv) && !IS_CHERRYVIEW(dev_priv))
492     return;
493    
494     if (!dev_priv->vbt.child_dev_num)
495     diff --git a/drivers/gpu/drm/i915/intel_color.c b/drivers/gpu/drm/i915/intel_color.c
496     index 17c4ae7e4e7c..824042ed04f6 100644
497     --- a/drivers/gpu/drm/i915/intel_color.c
498     +++ b/drivers/gpu/drm/i915/intel_color.c
499     @@ -58,7 +58,7 @@
500     #define I9XX_CSC_COEFF_1_0 \
501     ((7 << 12) | I9XX_CSC_COEFF_FP(CTM_COEFF_1_0, 8))
502    
503     -static bool crtc_state_is_legacy(struct drm_crtc_state *state)
504     +static bool crtc_state_is_legacy_gamma(struct drm_crtc_state *state)
505     {
506     return !state->degamma_lut &&
507     !state->ctm &&
508     @@ -245,7 +245,7 @@ static void cherryview_load_csc_matrix(struct drm_crtc_state *state)
509     }
510    
511     mode = (state->ctm ? CGM_PIPE_MODE_CSC : 0);
512     - if (!crtc_state_is_legacy(state)) {
513     + if (!crtc_state_is_legacy_gamma(state)) {
514     mode |= (state->degamma_lut ? CGM_PIPE_MODE_DEGAMMA : 0) |
515     (state->gamma_lut ? CGM_PIPE_MODE_GAMMA : 0);
516     }
517     @@ -426,7 +426,7 @@ static void broadwell_load_luts(struct drm_crtc_state *state)
518     struct intel_crtc_state *intel_state = to_intel_crtc_state(state);
519     enum pipe pipe = to_intel_crtc(state->crtc)->pipe;
520    
521     - if (crtc_state_is_legacy(state)) {
522     + if (crtc_state_is_legacy_gamma(state)) {
523     haswell_load_luts(state);
524     return;
525     }
526     @@ -486,7 +486,7 @@ static void glk_load_luts(struct drm_crtc_state *state)
527    
528     glk_load_degamma_lut(state);
529    
530     - if (crtc_state_is_legacy(state)) {
531     + if (crtc_state_is_legacy_gamma(state)) {
532     haswell_load_luts(state);
533     return;
534     }
535     @@ -508,7 +508,7 @@ static void cherryview_load_luts(struct drm_crtc_state *state)
536     uint32_t i, lut_size;
537     uint32_t word0, word1;
538    
539     - if (crtc_state_is_legacy(state)) {
540     + if (crtc_state_is_legacy_gamma(state)) {
541     /* Turn off degamma/gamma on CGM block. */
542     I915_WRITE(CGM_PIPE_MODE(pipe),
543     (state->ctm ? CGM_PIPE_MODE_CSC : 0));
544     @@ -589,12 +589,10 @@ int intel_color_check(struct drm_crtc *crtc,
545     return 0;
546    
547     /*
548     - * We also allow no degamma lut and a gamma lut at the legacy
549     + * We also allow no degamma lut/ctm and a gamma lut at the legacy
550     * size (256 entries).
551     */
552     - if (!crtc_state->degamma_lut &&
553     - crtc_state->gamma_lut &&
554     - crtc_state->gamma_lut->length == LEGACY_LUT_LENGTH)
555     + if (crtc_state_is_legacy_gamma(crtc_state))
556     return 0;
557    
558     return -EINVAL;
559     diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
560     index cc484b56eeaa..20b458551157 100644
561     --- a/drivers/gpu/drm/i915/intel_display.c
562     +++ b/drivers/gpu/drm/i915/intel_display.c
563     @@ -10059,13 +10059,10 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
564     {
565     struct drm_i915_private *dev_priv = to_i915(dev);
566     struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
567     - enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
568     + enum transcoder cpu_transcoder;
569     struct drm_display_mode *mode;
570     struct intel_crtc_state *pipe_config;
571     - int htot = I915_READ(HTOTAL(cpu_transcoder));
572     - int hsync = I915_READ(HSYNC(cpu_transcoder));
573     - int vtot = I915_READ(VTOTAL(cpu_transcoder));
574     - int vsync = I915_READ(VSYNC(cpu_transcoder));
575     + u32 htot, hsync, vtot, vsync;
576     enum pipe pipe = intel_crtc->pipe;
577    
578     mode = kzalloc(sizeof(*mode), GFP_KERNEL);
579     @@ -10093,6 +10090,13 @@ struct drm_display_mode *intel_crtc_mode_get(struct drm_device *dev,
580     i9xx_crtc_clock_get(intel_crtc, pipe_config);
581    
582     mode->clock = pipe_config->port_clock / pipe_config->pixel_multiplier;
583     +
584     + cpu_transcoder = pipe_config->cpu_transcoder;
585     + htot = I915_READ(HTOTAL(cpu_transcoder));
586     + hsync = I915_READ(HSYNC(cpu_transcoder));
587     + vtot = I915_READ(VTOTAL(cpu_transcoder));
588     + vsync = I915_READ(VSYNC(cpu_transcoder));
589     +
590     mode->hdisplay = (htot & 0xffff) + 1;
591     mode->htotal = ((htot & 0xffff0000) >> 16) + 1;
592     mode->hsync_start = (hsync & 0xffff) + 1;
593     diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
594     index 64fa774c855b..61c313e21a91 100644
595     --- a/drivers/gpu/drm/i915/intel_dp.c
596     +++ b/drivers/gpu/drm/i915/intel_dp.c
597     @@ -2263,8 +2263,8 @@ static void edp_panel_off(struct intel_dp *intel_dp)
598     I915_WRITE(pp_ctrl_reg, pp);
599     POSTING_READ(pp_ctrl_reg);
600    
601     - intel_dp->panel_power_off_time = ktime_get_boottime();
602     wait_panel_off(intel_dp);
603     + intel_dp->panel_power_off_time = ktime_get_boottime();
604    
605     /* We got a reference when we enabled the VDD. */
606     intel_display_power_put(dev_priv, intel_dp->aux_power_domain);
607     diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
608     index c008847e0b20..3f11b02f9857 100644
609     --- a/drivers/hid/usbhid/hid-core.c
610     +++ b/drivers/hid/usbhid/hid-core.c
611     @@ -975,6 +975,8 @@ static int usbhid_parse(struct hid_device *hid)
612     unsigned int rsize = 0;
613     char *rdesc;
614     int ret, n;
615     + int num_descriptors;
616     + size_t offset = offsetof(struct hid_descriptor, desc);
617    
618     quirks = usbhid_lookup_quirk(le16_to_cpu(dev->descriptor.idVendor),
619     le16_to_cpu(dev->descriptor.idProduct));
620     @@ -997,10 +999,18 @@ static int usbhid_parse(struct hid_device *hid)
621     return -ENODEV;
622     }
623    
624     + if (hdesc->bLength < sizeof(struct hid_descriptor)) {
625     + dbg_hid("hid descriptor is too short\n");
626     + return -EINVAL;
627     + }
628     +
629     hid->version = le16_to_cpu(hdesc->bcdHID);
630     hid->country = hdesc->bCountryCode;
631    
632     - for (n = 0; n < hdesc->bNumDescriptors; n++)
633     + num_descriptors = min_t(int, hdesc->bNumDescriptors,
634     + (hdesc->bLength - offset) / sizeof(struct hid_class_descriptor));
635     +
636     + for (n = 0; n < num_descriptors; n++)
637     if (hdesc->desc[n].bDescriptorType == HID_DT_REPORT)
638     rsize = le16_to_cpu(hdesc->desc[n].wDescriptorLength);
639    
640     diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
641     index 354cbd6392cd..632643939147 100644
642     --- a/drivers/iommu/amd_iommu.c
643     +++ b/drivers/iommu/amd_iommu.c
644     @@ -3262,6 +3262,7 @@ static size_t amd_iommu_unmap(struct iommu_domain *dom, unsigned long iova,
645     mutex_unlock(&domain->api_lock);
646    
647     domain_flush_tlb_pde(domain);
648     + domain_flush_complete(domain);
649    
650     return unmap_size;
651     }
652     diff --git a/drivers/misc/mei/pci-me.c b/drivers/misc/mei/pci-me.c
653     index bac33311f55a..1d37a4782c78 100644
654     --- a/drivers/misc/mei/pci-me.c
655     +++ b/drivers/misc/mei/pci-me.c
656     @@ -222,12 +222,15 @@ static int mei_me_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
657     pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
658    
659     /*
660     - * For not wake-able HW runtime pm framework
661     - * can't be used on pci device level.
662     - * Use domain runtime pm callbacks instead.
663     - */
664     - if (!pci_dev_run_wake(pdev))
665     - mei_me_set_pm_domain(dev);
666     + * ME maps runtime suspend/resume to D0i states,
667     + * hence we need to go around native PCI runtime service which
668     + * eventually brings the device into D3cold/hot state,
669     + * but the mei device cannot wake up from D3 unlike from D0i3.
670     + * To get around the PCI device native runtime pm,
671     + * ME uses runtime pm domain handlers which take precedence
672     + * over the driver's pm handlers.
673     + */
674     + mei_me_set_pm_domain(dev);
675    
676     if (mei_pg_is_enabled(dev))
677     pm_runtime_put_noidle(&pdev->dev);
678     @@ -267,8 +270,7 @@ static void mei_me_shutdown(struct pci_dev *pdev)
679     dev_dbg(&pdev->dev, "shutdown\n");
680     mei_stop(dev);
681    
682     - if (!pci_dev_run_wake(pdev))
683     - mei_me_unset_pm_domain(dev);
684     + mei_me_unset_pm_domain(dev);
685    
686     mei_disable_interrupts(dev);
687     free_irq(pdev->irq, dev);
688     @@ -296,8 +298,7 @@ static void mei_me_remove(struct pci_dev *pdev)
689     dev_dbg(&pdev->dev, "stop\n");
690     mei_stop(dev);
691    
692     - if (!pci_dev_run_wake(pdev))
693     - mei_me_unset_pm_domain(dev);
694     + mei_me_unset_pm_domain(dev);
695    
696     mei_disable_interrupts(dev);
697    
698     diff --git a/drivers/misc/mei/pci-txe.c b/drivers/misc/mei/pci-txe.c
699     index e38a5f144373..0566f9bfa7de 100644
700     --- a/drivers/misc/mei/pci-txe.c
701     +++ b/drivers/misc/mei/pci-txe.c
702     @@ -144,12 +144,14 @@ static int mei_txe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
703     pdev->dev_flags |= PCI_DEV_FLAGS_NEEDS_RESUME;
704    
705     /*
706     - * For not wake-able HW runtime pm framework
707     - * can't be used on pci device level.
708     - * Use domain runtime pm callbacks instead.
709     - */
710     - if (!pci_dev_run_wake(pdev))
711     - mei_txe_set_pm_domain(dev);
712     + * TXE maps runtime suspend/resume to own power gating states,
713     + * hence we need to go around native PCI runtime service which
714     + * eventually brings the device into D3cold/hot state.
715     + * But the TXE device cannot wake up from D3 unlike from own
716     + * power gating. To get around PCI device native runtime pm,
717     + * TXE uses runtime pm domain handlers which take precedence.
718     + */
719     + mei_txe_set_pm_domain(dev);
720    
721     pm_runtime_put_noidle(&pdev->dev);
722    
723     @@ -186,8 +188,7 @@ static void mei_txe_shutdown(struct pci_dev *pdev)
724     dev_dbg(&pdev->dev, "shutdown\n");
725     mei_stop(dev);
726    
727     - if (!pci_dev_run_wake(pdev))
728     - mei_txe_unset_pm_domain(dev);
729     + mei_txe_unset_pm_domain(dev);
730    
731     mei_disable_interrupts(dev);
732     free_irq(pdev->irq, dev);
733     @@ -215,8 +216,7 @@ static void mei_txe_remove(struct pci_dev *pdev)
734    
735     mei_stop(dev);
736    
737     - if (!pci_dev_run_wake(pdev))
738     - mei_txe_unset_pm_domain(dev);
739     + mei_txe_unset_pm_domain(dev);
740    
741     mei_disable_interrupts(dev);
742     free_irq(pdev->irq, dev);
743     @@ -318,15 +318,7 @@ static int mei_txe_pm_runtime_suspend(struct device *device)
744     else
745     ret = -EAGAIN;
746    
747     - /*
748     - * If everything is okay we're about to enter PCI low
749     - * power state (D3) therefor we need to disable the
750     - * interrupts towards host.
751     - * However if device is not wakeable we do not enter
752     - * D-low state and we need to keep the interrupt kicking
753     - */
754     - if (!ret && pci_dev_run_wake(pdev))
755     - mei_disable_interrupts(dev);
756     + /* keep irq on we are staying in D0 */
757    
758     dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret);
759    
760     diff --git a/drivers/pci/host/pci-aardvark.c b/drivers/pci/host/pci-aardvark.c
761     index 5fb9b620ac78..20f1d048582f 100644
762     --- a/drivers/pci/host/pci-aardvark.c
763     +++ b/drivers/pci/host/pci-aardvark.c
764     @@ -936,6 +936,8 @@ static int advk_pcie_probe(struct platform_device *pdev)
765     bridge->sysdata = pcie;
766     bridge->busnr = 0;
767     bridge->ops = &advk_pcie_ops;
768     + bridge->map_irq = of_irq_parse_and_map_pci;
769     + bridge->swizzle_irq = pci_common_swizzle;
770    
771     ret = pci_scan_root_bus_bridge(bridge);
772     if (ret < 0) {
773     diff --git a/drivers/pci/host/pci-tegra.c b/drivers/pci/host/pci-tegra.c
774     index b3722b7709df..1d1d87e8bcbf 100644
775     --- a/drivers/pci/host/pci-tegra.c
776     +++ b/drivers/pci/host/pci-tegra.c
777     @@ -233,6 +233,7 @@ struct tegra_msi {
778     struct msi_controller chip;
779     DECLARE_BITMAP(used, INT_PCI_MSI_NR);
780     struct irq_domain *domain;
781     + unsigned long pages;
782     struct mutex lock;
783     u64 phys;
784     int irq;
785     @@ -1529,22 +1530,9 @@ static int tegra_pcie_enable_msi(struct tegra_pcie *pcie)
786     goto err;
787     }
788    
789     - /*
790     - * The PCI host bridge on Tegra contains some logic that intercepts
791     - * MSI writes, which means that the MSI target address doesn't have
792     - * to point to actual physical memory. Rather than allocating one 4
793     - * KiB page of system memory that's never used, we can simply pick
794     - * an arbitrary address within an area reserved for system memory
795     - * in the FPCI address map.
796     - *
797     - * However, in order to avoid confusion, we pick an address that
798     - * doesn't map to physical memory. The FPCI address map reserves a
799     - * 1012 GiB region for system memory and memory-mapped I/O. Since
800     - * none of the Tegra SoCs that contain this PCI host bridge can
801     - * address more than 16 GiB of system memory, the last 4 KiB of
802     - * these 1012 GiB is a good candidate.
803     - */
804     - msi->phys = 0xfcfffff000;
805     + /* setup AFI/FPCI range */
806     + msi->pages = __get_free_pages(GFP_KERNEL, 0);
807     + msi->phys = virt_to_phys((void *)msi->pages);
808    
809     afi_writel(pcie, msi->phys >> soc->msi_base_shift, AFI_MSI_FPCI_BAR_ST);
810     afi_writel(pcie, msi->phys, AFI_MSI_AXI_BAR_ST);
811     @@ -1596,6 +1584,8 @@ static int tegra_pcie_disable_msi(struct tegra_pcie *pcie)
812     afi_writel(pcie, 0, AFI_MSI_EN_VEC6);
813     afi_writel(pcie, 0, AFI_MSI_EN_VEC7);
814    
815     + free_pages(msi->pages, 0);
816     +
817     if (msi->irq > 0)
818     free_irq(msi->irq, pcie);
819    
820     diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
821     index e14b46c7b37f..8c054f5ccc11 100644
822     --- a/drivers/pinctrl/Kconfig
823     +++ b/drivers/pinctrl/Kconfig
824     @@ -100,6 +100,7 @@ config PINCTRL_AMD
825     tristate "AMD GPIO pin control"
826     depends on GPIOLIB
827     select GPIOLIB_IRQCHIP
828     + select PINMUX
829     select PINCONF
830     select GENERIC_PINCONF
831     help
832     diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
833     index d0e5d6ee882c..e2c1988cd7c0 100644
834     --- a/drivers/ras/cec.c
835     +++ b/drivers/ras/cec.c
836     @@ -523,7 +523,7 @@ int __init parse_cec_param(char *str)
837     if (*str == '=')
838     str++;
839    
840     - if (!strncmp(str, "cec_disable", 7))
841     + if (!strcmp(str, "cec_disable"))
842     ce_arr.disabled = 1;
843     else
844     return 0;
845     diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
846     index dd74c99d6ce1..5d061b3d8224 100644
847     --- a/drivers/usb/gadget/composite.c
848     +++ b/drivers/usb/gadget/composite.c
849     @@ -2026,6 +2026,8 @@ static DEVICE_ATTR_RO(suspended);
850     static void __composite_unbind(struct usb_gadget *gadget, bool unbind_driver)
851     {
852     struct usb_composite_dev *cdev = get_gadget_data(gadget);
853     + struct usb_gadget_strings *gstr = cdev->driver->strings[0];
854     + struct usb_string *dev_str = gstr->strings;
855    
856     /* composite_disconnect() must already have been called
857     * by the underlying peripheral controller driver!
858     @@ -2045,6 +2047,9 @@ static void __composite_unbind(struct usb_gadget *gadget, bool unbind_driver)
859    
860     composite_dev_cleanup(cdev);
861    
862     + if (dev_str[USB_GADGET_MANUFACTURER_IDX].s == cdev->def_manufacturer)
863     + dev_str[USB_GADGET_MANUFACTURER_IDX].s = "";
864     +
865     kfree(cdev->def_manufacturer);
866     kfree(cdev);
867     set_gadget_data(gadget, NULL);
868     diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
869     index a22a892de7b7..aeb9f3c40521 100644
870     --- a/drivers/usb/gadget/configfs.c
871     +++ b/drivers/usb/gadget/configfs.c
872     @@ -1143,11 +1143,12 @@ static struct configfs_attribute *interf_grp_attrs[] = {
873     NULL
874     };
875    
876     -int usb_os_desc_prepare_interf_dir(struct config_group *parent,
877     - int n_interf,
878     - struct usb_os_desc **desc,
879     - char **names,
880     - struct module *owner)
881     +struct config_group *usb_os_desc_prepare_interf_dir(
882     + struct config_group *parent,
883     + int n_interf,
884     + struct usb_os_desc **desc,
885     + char **names,
886     + struct module *owner)
887     {
888     struct config_group *os_desc_group;
889     struct config_item_type *os_desc_type, *interface_type;
890     @@ -1159,7 +1160,7 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent,
891    
892     char *vlabuf = kzalloc(vla_group_size(data_chunk), GFP_KERNEL);
893     if (!vlabuf)
894     - return -ENOMEM;
895     + return ERR_PTR(-ENOMEM);
896    
897     os_desc_group = vla_ptr(vlabuf, data_chunk, os_desc_group);
898     os_desc_type = vla_ptr(vlabuf, data_chunk, os_desc_type);
899     @@ -1184,7 +1185,7 @@ int usb_os_desc_prepare_interf_dir(struct config_group *parent,
900     configfs_add_default_group(&d->group, os_desc_group);
901     }
902    
903     - return 0;
904     + return os_desc_group;
905     }
906     EXPORT_SYMBOL(usb_os_desc_prepare_interf_dir);
907    
908     diff --git a/drivers/usb/gadget/configfs.h b/drivers/usb/gadget/configfs.h
909     index 36c468c4f5e9..540d5e92ed22 100644
910     --- a/drivers/usb/gadget/configfs.h
911     +++ b/drivers/usb/gadget/configfs.h
912     @@ -5,11 +5,12 @@
913    
914     void unregister_gadget_item(struct config_item *item);
915    
916     -int usb_os_desc_prepare_interf_dir(struct config_group *parent,
917     - int n_interf,
918     - struct usb_os_desc **desc,
919     - char **names,
920     - struct module *owner);
921     +struct config_group *usb_os_desc_prepare_interf_dir(
922     + struct config_group *parent,
923     + int n_interf,
924     + struct usb_os_desc **desc,
925     + char **names,
926     + struct module *owner);
927    
928     static inline struct usb_os_desc *to_usb_os_desc(struct config_item *item)
929     {
930     diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c
931     index 16562e461121..ba00cdb809d6 100644
932     --- a/drivers/usb/gadget/function/f_rndis.c
933     +++ b/drivers/usb/gadget/function/f_rndis.c
934     @@ -892,6 +892,7 @@ static void rndis_free_inst(struct usb_function_instance *f)
935     free_netdev(opts->net);
936     }
937    
938     + kfree(opts->rndis_interf_group); /* single VLA chunk */
939     kfree(opts);
940     }
941    
942     @@ -900,6 +901,7 @@ static struct usb_function_instance *rndis_alloc_inst(void)
943     struct f_rndis_opts *opts;
944     struct usb_os_desc *descs[1];
945     char *names[1];
946     + struct config_group *rndis_interf_group;
947    
948     opts = kzalloc(sizeof(*opts), GFP_KERNEL);
949     if (!opts)
950     @@ -920,8 +922,14 @@ static struct usb_function_instance *rndis_alloc_inst(void)
951     names[0] = "rndis";
952     config_group_init_type_name(&opts->func_inst.group, "",
953     &rndis_func_type);
954     - usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs,
955     - names, THIS_MODULE);
956     + rndis_interf_group =
957     + usb_os_desc_prepare_interf_dir(&opts->func_inst.group, 1, descs,
958     + names, THIS_MODULE);
959     + if (IS_ERR(rndis_interf_group)) {
960     + rndis_free_inst(&opts->func_inst);
961     + return ERR_CAST(rndis_interf_group);
962     + }
963     + opts->rndis_interf_group = rndis_interf_group;
964    
965     return &opts->func_inst;
966     }
967     diff --git a/drivers/usb/gadget/function/u_rndis.h b/drivers/usb/gadget/function/u_rndis.h
968     index 4eafd5050545..4e2ad04fe8d6 100644
969     --- a/drivers/usb/gadget/function/u_rndis.h
970     +++ b/drivers/usb/gadget/function/u_rndis.h
971     @@ -26,6 +26,7 @@ struct f_rndis_opts {
972     bool bound;
973     bool borrowed_net;
974    
975     + struct config_group *rndis_interf_group;
976     struct usb_os_desc rndis_os_desc;
977     char rndis_ext_compat_id[16];
978    
979     diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/udc/dummy_hcd.c
980     index 374f85f612d9..1c6cfdf0457e 100644
981     --- a/drivers/usb/gadget/udc/dummy_hcd.c
982     +++ b/drivers/usb/gadget/udc/dummy_hcd.c
983     @@ -420,6 +420,7 @@ static void set_link_state_by_speed(struct dummy_hcd *dum_hcd)
984     static void set_link_state(struct dummy_hcd *dum_hcd)
985     {
986     struct dummy *dum = dum_hcd->dum;
987     + unsigned int power_bit;
988    
989     dum_hcd->active = 0;
990     if (dum->pullup)
991     @@ -430,17 +431,19 @@ static void set_link_state(struct dummy_hcd *dum_hcd)
992     return;
993    
994     set_link_state_by_speed(dum_hcd);
995     + power_bit = (dummy_hcd_to_hcd(dum_hcd)->speed == HCD_USB3 ?
996     + USB_SS_PORT_STAT_POWER : USB_PORT_STAT_POWER);
997    
998     if ((dum_hcd->port_status & USB_PORT_STAT_ENABLE) == 0 ||
999     dum_hcd->active)
1000     dum_hcd->resuming = 0;
1001    
1002     /* Currently !connected or in reset */
1003     - if ((dum_hcd->port_status & USB_PORT_STAT_CONNECTION) == 0 ||
1004     + if ((dum_hcd->port_status & power_bit) == 0 ||
1005     (dum_hcd->port_status & USB_PORT_STAT_RESET) != 0) {
1006     - unsigned disconnect = USB_PORT_STAT_CONNECTION &
1007     + unsigned int disconnect = power_bit &
1008     dum_hcd->old_status & (~dum_hcd->port_status);
1009     - unsigned reset = USB_PORT_STAT_RESET &
1010     + unsigned int reset = USB_PORT_STAT_RESET &
1011     (~dum_hcd->old_status) & dum_hcd->port_status;
1012    
1013     /* Report reset and disconnect events to the driver */
1014     diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
1015     index 68f26904c316..50285b01da92 100644
1016     --- a/drivers/usb/renesas_usbhs/fifo.c
1017     +++ b/drivers/usb/renesas_usbhs/fifo.c
1018     @@ -857,9 +857,9 @@ static void xfer_work(struct work_struct *work)
1019     fifo->name, usbhs_pipe_number(pipe), pkt->length, pkt->zero);
1020    
1021     usbhs_pipe_running(pipe, 1);
1022     - usbhsf_dma_start(pipe, fifo);
1023     usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->trans);
1024     dma_async_issue_pending(chan);
1025     + usbhsf_dma_start(pipe, fifo);
1026     usbhs_pipe_enable(pipe);
1027    
1028     xfer_work_end:
1029     diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
1030     index fdf89800ebc3..43a862a90a77 100644
1031     --- a/drivers/usb/serial/console.c
1032     +++ b/drivers/usb/serial/console.c
1033     @@ -186,6 +186,7 @@ static int usb_console_setup(struct console *co, char *options)
1034     tty_kref_put(tty);
1035     reset_open_count:
1036     port->port.count = 0;
1037     + info->port = NULL;
1038     usb_autopm_put_interface(serial->interface);
1039     error_get_interface:
1040     usb_serial_put(serial);
1041     @@ -265,7 +266,7 @@ static struct console usbcons = {
1042    
1043     void usb_serial_console_disconnect(struct usb_serial *serial)
1044     {
1045     - if (serial->port[0] == usbcons_info.port) {
1046     + if (serial->port[0] && serial->port[0] == usbcons_info.port) {
1047     usb_serial_console_exit();
1048     usb_serial_put(serial);
1049     }
1050     diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
1051     index 2d945c9f975c..412f812522ee 100644
1052     --- a/drivers/usb/serial/cp210x.c
1053     +++ b/drivers/usb/serial/cp210x.c
1054     @@ -177,6 +177,7 @@ static const struct usb_device_id id_table[] = {
1055     { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
1056     { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
1057     { USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */
1058     + { USB_DEVICE(0x18EF, 0xE032) }, /* ELV TFD500 Data Logger */
1059     { USB_DEVICE(0x1901, 0x0190) }, /* GE B850 CP2105 Recorder interface */
1060     { USB_DEVICE(0x1901, 0x0193) }, /* GE B650 CP2104 PMC interface */
1061     { USB_DEVICE(0x1901, 0x0194) }, /* GE Healthcare Remote Alarm Box */
1062     @@ -352,6 +353,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
1063     #define CP210X_PARTNUM_CP2104 0x04
1064     #define CP210X_PARTNUM_CP2105 0x05
1065     #define CP210X_PARTNUM_CP2108 0x08
1066     +#define CP210X_PARTNUM_UNKNOWN 0xFF
1067    
1068     /* CP210X_GET_COMM_STATUS returns these 0x13 bytes */
1069     struct cp210x_comm_status {
1070     @@ -1491,8 +1493,11 @@ static int cp210x_attach(struct usb_serial *serial)
1071     result = cp210x_read_vendor_block(serial, REQTYPE_DEVICE_TO_HOST,
1072     CP210X_GET_PARTNUM, &priv->partnum,
1073     sizeof(priv->partnum));
1074     - if (result < 0)
1075     - goto err_free_priv;
1076     + if (result < 0) {
1077     + dev_warn(&serial->interface->dev,
1078     + "querying part number failed\n");
1079     + priv->partnum = CP210X_PARTNUM_UNKNOWN;
1080     + }
1081    
1082     usb_set_serial_data(serial, priv);
1083    
1084     @@ -1505,10 +1510,6 @@ static int cp210x_attach(struct usb_serial *serial)
1085     }
1086    
1087     return 0;
1088     -err_free_priv:
1089     - kfree(priv);
1090     -
1091     - return result;
1092     }
1093    
1094     static void cp210x_disconnect(struct usb_serial *serial)
1095     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1096     index 1cec03799cdf..49d1b2d4606d 100644
1097     --- a/drivers/usb/serial/ftdi_sio.c
1098     +++ b/drivers/usb/serial/ftdi_sio.c
1099     @@ -1015,6 +1015,8 @@ static const struct usb_device_id id_table_combined[] = {
1100     { USB_DEVICE(WICED_VID, WICED_USB20706V2_PID) },
1101     { USB_DEVICE(TI_VID, TI_CC3200_LAUNCHPAD_PID),
1102     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1103     + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_BT_USB_PID) },
1104     + { USB_DEVICE(CYPRESS_VID, CYPRESS_WICED_WL_USB_PID) },
1105     { } /* Terminating entry */
1106     };
1107    
1108     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1109     index 4fcf1cecb6d7..f9d15bd62785 100644
1110     --- a/drivers/usb/serial/ftdi_sio_ids.h
1111     +++ b/drivers/usb/serial/ftdi_sio_ids.h
1112     @@ -609,6 +609,13 @@
1113     #define ADI_GNICE_PID 0xF000
1114     #define ADI_GNICEPLUS_PID 0xF001
1115    
1116     +/*
1117     + * Cypress WICED USB UART
1118     + */
1119     +#define CYPRESS_VID 0x04B4
1120     +#define CYPRESS_WICED_BT_USB_PID 0x009B
1121     +#define CYPRESS_WICED_WL_USB_PID 0xF900
1122     +
1123     /*
1124     * Microchip Technology, Inc.
1125     *
1126     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1127     index 2a9944326210..db3d34c2c82e 100644
1128     --- a/drivers/usb/serial/option.c
1129     +++ b/drivers/usb/serial/option.c
1130     @@ -522,6 +522,7 @@ static void option_instat_callback(struct urb *urb);
1131    
1132     /* TP-LINK Incorporated products */
1133     #define TPLINK_VENDOR_ID 0x2357
1134     +#define TPLINK_PRODUCT_LTE 0x000D
1135     #define TPLINK_PRODUCT_MA180 0x0201
1136    
1137     /* Changhong products */
1138     @@ -2011,6 +2012,7 @@ static const struct usb_device_id option_ids[] = {
1139     { USB_DEVICE(CELLIENT_VENDOR_ID, CELLIENT_PRODUCT_MEN200) },
1140     { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600A) },
1141     { USB_DEVICE(PETATEL_VENDOR_ID, PETATEL_PRODUCT_NP10T_600E) },
1142     + { USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, TPLINK_PRODUCT_LTE, 0xff, 0x00, 0x00) }, /* TP-Link LTE Module */
1143     { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
1144     .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
1145     { USB_DEVICE(TPLINK_VENDOR_ID, 0x9000), /* TP-Link MA260 */
1146     diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1147     index ebc0beea69d6..eb9928963a53 100644
1148     --- a/drivers/usb/serial/qcserial.c
1149     +++ b/drivers/usb/serial/qcserial.c
1150     @@ -174,6 +174,10 @@ static const struct usb_device_id id_table[] = {
1151     {DEVICE_SWI(0x413c, 0x81b3)}, /* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
1152     {DEVICE_SWI(0x413c, 0x81b5)}, /* Dell Wireless 5811e QDL */
1153     {DEVICE_SWI(0x413c, 0x81b6)}, /* Dell Wireless 5811e QDL */
1154     + {DEVICE_SWI(0x413c, 0x81cf)}, /* Dell Wireless 5819 */
1155     + {DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
1156     + {DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
1157     + {DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 */
1158    
1159     /* Huawei devices */
1160     {DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
1161     diff --git a/fs/block_dev.c b/fs/block_dev.c
1162     index 9941dc8342df..3fbe75bdd257 100644
1163     --- a/fs/block_dev.c
1164     +++ b/fs/block_dev.c
1165     @@ -716,10 +716,12 @@ int bdev_write_page(struct block_device *bdev, sector_t sector,
1166    
1167     set_page_writeback(page);
1168     result = ops->rw_page(bdev, sector + get_start_sect(bdev), page, true);
1169     - if (result)
1170     + if (result) {
1171     end_page_writeback(page);
1172     - else
1173     + } else {
1174     + clean_page_buffers(page);
1175     unlock_page(page);
1176     + }
1177     blk_queue_exit(bdev->bd_queue);
1178     return result;
1179     }
1180     diff --git a/fs/direct-io.c b/fs/direct-io.c
1181     index 08cf27811e5a..ad379f082d83 100644
1182     --- a/fs/direct-io.c
1183     +++ b/fs/direct-io.c
1184     @@ -838,7 +838,8 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
1185     */
1186     if (sdio->boundary) {
1187     ret = dio_send_cur_page(dio, sdio, map_bh);
1188     - dio_bio_submit(dio, sdio);
1189     + if (sdio->bio)
1190     + dio_bio_submit(dio, sdio);
1191     put_page(sdio->cur_page);
1192     sdio->cur_page = NULL;
1193     }
1194     diff --git a/fs/mpage.c b/fs/mpage.c
1195     index 2e4c41ccb5c9..9feb169fbd5c 100644
1196     --- a/fs/mpage.c
1197     +++ b/fs/mpage.c
1198     @@ -468,6 +468,16 @@ static void clean_buffers(struct page *page, unsigned first_unmapped)
1199     try_to_free_buffers(page);
1200     }
1201    
1202     +/*
1203     + * For situations where we want to clean all buffers attached to a page.
1204     + * We don't need to calculate how many buffers are attached to the page,
1205     + * we just need to specify a number larger than the maximum number of buffers.
1206     + */
1207     +void clean_page_buffers(struct page *page)
1208     +{
1209     + clean_buffers(page, ~0U);
1210     +}
1211     +
1212     static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
1213     void *data)
1214     {
1215     @@ -605,10 +615,8 @@ static int __mpage_writepage(struct page *page, struct writeback_control *wbc,
1216     if (bio == NULL) {
1217     if (first_unmapped == blocks_per_page) {
1218     if (!bdev_write_page(bdev, blocks[0] << (blkbits - 9),
1219     - page, wbc)) {
1220     - clean_buffers(page, first_unmapped);
1221     + page, wbc))
1222     goto out;
1223     - }
1224     }
1225     bio = mpage_alloc(bdev, blocks[0] << (blkbits - 9),
1226     BIO_MAX_PAGES, GFP_NOFS|__GFP_HIGH);
1227     diff --git a/fs/nfs/client.c b/fs/nfs/client.c
1228     index efebe6cf4378..22880ef6d8dd 100644
1229     --- a/fs/nfs/client.c
1230     +++ b/fs/nfs/client.c
1231     @@ -218,7 +218,6 @@ static void nfs_cb_idr_remove_locked(struct nfs_client *clp)
1232     static void pnfs_init_server(struct nfs_server *server)
1233     {
1234     rpc_init_wait_queue(&server->roc_rpcwaitq, "pNFS ROC");
1235     - rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
1236     }
1237    
1238     #else
1239     @@ -888,6 +887,7 @@ struct nfs_server *nfs_alloc_server(void)
1240     ida_init(&server->openowner_id);
1241     ida_init(&server->lockowner_id);
1242     pnfs_init_server(server);
1243     + rpc_init_wait_queue(&server->uoc_rpcwaitq, "NFS UOC");
1244    
1245     return server;
1246     }
1247     diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
1248     index 44c638b7876c..508126eb49f9 100644
1249     --- a/fs/nfs/filelayout/filelayout.c
1250     +++ b/fs/nfs/filelayout/filelayout.c
1251     @@ -745,7 +745,8 @@ filelayout_free_lseg(struct pnfs_layout_segment *lseg)
1252     struct nfs4_filelayout_segment *fl = FILELAYOUT_LSEG(lseg);
1253    
1254     dprintk("--> %s\n", __func__);
1255     - nfs4_fl_put_deviceid(fl->dsaddr);
1256     + if (fl->dsaddr != NULL)
1257     + nfs4_fl_put_deviceid(fl->dsaddr);
1258     /* This assumes a single RW lseg */
1259     if (lseg->pls_range.iomode == IOMODE_RW) {
1260     struct nfs4_filelayout *flo;
1261     diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
1262     index c8dae555eccf..446b24cac67d 100644
1263     --- a/include/linux/buffer_head.h
1264     +++ b/include/linux/buffer_head.h
1265     @@ -232,6 +232,7 @@ int generic_write_end(struct file *, struct address_space *,
1266     loff_t, unsigned, unsigned,
1267     struct page *, void *);
1268     void page_zero_new_buffers(struct page *page, unsigned from, unsigned to);
1269     +void clean_page_buffers(struct page *page);
1270     int cont_write_begin(struct file *, struct address_space *, loff_t,
1271     unsigned, unsigned, struct page **, void **,
1272     get_block_t *, loff_t *);
1273     diff --git a/include/sound/seq_virmidi.h b/include/sound/seq_virmidi.h
1274     index a03acd0d398a..695257ae64ac 100644
1275     --- a/include/sound/seq_virmidi.h
1276     +++ b/include/sound/seq_virmidi.h
1277     @@ -60,6 +60,7 @@ struct snd_virmidi_dev {
1278     int port; /* created/attached port */
1279     unsigned int flags; /* SNDRV_VIRMIDI_* */
1280     rwlock_t filelist_lock;
1281     + struct rw_semaphore filelist_sem;
1282     struct list_head filelist;
1283     };
1284    
1285     diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
1286     index 75a70a267029..406fc428d580 100644
1287     --- a/kernel/irq/chip.c
1288     +++ b/kernel/irq/chip.c
1289     @@ -265,8 +265,8 @@ int irq_startup(struct irq_desc *desc, bool resend, bool force)
1290     irq_setup_affinity(desc);
1291     break;
1292     case IRQ_STARTUP_MANAGED:
1293     + irq_do_set_affinity(d, aff, false);
1294     ret = __irq_startup(desc);
1295     - irq_set_affinity_locked(d, aff, false);
1296     break;
1297     case IRQ_STARTUP_ABORT:
1298     return 0;
1299     diff --git a/kernel/irq/cpuhotplug.c b/kernel/irq/cpuhotplug.c
1300     index 638eb9c83d9f..9eb09aef0313 100644
1301     --- a/kernel/irq/cpuhotplug.c
1302     +++ b/kernel/irq/cpuhotplug.c
1303     @@ -18,8 +18,34 @@
1304     static inline bool irq_needs_fixup(struct irq_data *d)
1305     {
1306     const struct cpumask *m = irq_data_get_effective_affinity_mask(d);
1307     + unsigned int cpu = smp_processor_id();
1308    
1309     - return cpumask_test_cpu(smp_processor_id(), m);
1310     +#ifdef CONFIG_GENERIC_IRQ_EFFECTIVE_AFF_MASK
1311     + /*
1312     + * The cpumask_empty() check is a workaround for interrupt chips,
1313     + * which do not implement effective affinity, but the architecture has
1314     + * enabled the config switch. Use the general affinity mask instead.
1315     + */
1316     + if (cpumask_empty(m))
1317     + m = irq_data_get_affinity_mask(d);
1318     +
1319     + /*
1320     + * Sanity check. If the mask is not empty when excluding the outgoing
1321     + * CPU then it must contain at least one online CPU. The outgoing CPU
1322     + * has been removed from the online mask already.
1323     + */
1324     + if (cpumask_any_but(m, cpu) < nr_cpu_ids &&
1325     + cpumask_any_and(m, cpu_online_mask) >= nr_cpu_ids) {
1326     + /*
1327     + * If this happens then there was a missed IRQ fixup at some
1328     + * point. Warn about it and enforce fixup.
1329     + */
1330     + pr_warn("Eff. affinity %*pbl of IRQ %u contains only offline CPUs after offlining CPU %u\n",
1331     + cpumask_pr_args(m), d->irq, cpu);
1332     + return true;
1333     + }
1334     +#endif
1335     + return cpumask_test_cpu(cpu, m);
1336     }
1337    
1338     static bool migrate_one_irq(struct irq_desc *desc)
1339     diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
1340     index 1d1a5b945ab4..70dc8da8737f 100644
1341     --- a/kernel/irq/manage.c
1342     +++ b/kernel/irq/manage.c
1343     @@ -175,6 +175,9 @@ int irq_do_set_affinity(struct irq_data *data, const struct cpumask *mask,
1344     struct irq_chip *chip = irq_data_get_irq_chip(data);
1345     int ret;
1346    
1347     + if (!chip || !chip->irq_set_affinity)
1348     + return -EINVAL;
1349     +
1350     ret = chip->irq_set_affinity(data, mask, force);
1351     switch (ret) {
1352     case IRQ_SET_MASK_OK:
1353     diff --git a/mm/vmalloc.c b/mm/vmalloc.c
1354     index a47e3894c775..ceacc6e01904 100644
1355     --- a/mm/vmalloc.c
1356     +++ b/mm/vmalloc.c
1357     @@ -1697,11 +1697,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
1358     for (i = 0; i < area->nr_pages; i++) {
1359     struct page *page;
1360    
1361     - if (fatal_signal_pending(current)) {
1362     - area->nr_pages = i;
1363     - goto fail_no_warn;
1364     - }
1365     -
1366     if (node == NUMA_NO_NODE)
1367     page = alloc_page(alloc_mask|highmem_mask);
1368     else
1369     @@ -1725,7 +1720,6 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
1370     warn_alloc(gfp_mask, NULL,
1371     "vmalloc: allocation failure, allocated %ld of %ld bytes",
1372     (area->nr_pages*PAGE_SIZE), area->size);
1373     -fail_no_warn:
1374     vfree(area->addr);
1375     return NULL;
1376     }
1377     diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
1378     index ea2d0ae85bd3..6c9cba2166d9 100644
1379     --- a/sound/core/seq/seq_clientmgr.c
1380     +++ b/sound/core/seq/seq_clientmgr.c
1381     @@ -1259,6 +1259,7 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
1382     struct snd_seq_port_info *info = arg;
1383     struct snd_seq_client_port *port;
1384     struct snd_seq_port_callback *callback;
1385     + int port_idx;
1386    
1387     /* it is not allowed to create the port for an another client */
1388     if (info->addr.client != client->number)
1389     @@ -1269,7 +1270,9 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
1390     return -ENOMEM;
1391    
1392     if (client->type == USER_CLIENT && info->kernel) {
1393     - snd_seq_delete_port(client, port->addr.port);
1394     + port_idx = port->addr.port;
1395     + snd_seq_port_unlock(port);
1396     + snd_seq_delete_port(client, port_idx);
1397     return -EINVAL;
1398     }
1399     if (client->type == KERNEL_CLIENT) {
1400     @@ -1290,6 +1293,7 @@ static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void *arg)
1401    
1402     snd_seq_set_port_info(port, info);
1403     snd_seq_system_client_ev_port_start(port->addr.client, port->addr.port);
1404     + snd_seq_port_unlock(port);
1405    
1406     return 0;
1407     }
1408     diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
1409     index 0a7020c82bfc..d21ece9f8d73 100644
1410     --- a/sound/core/seq/seq_ports.c
1411     +++ b/sound/core/seq/seq_ports.c
1412     @@ -122,7 +122,9 @@ static void port_subs_info_init(struct snd_seq_port_subs_info *grp)
1413     }
1414    
1415    
1416     -/* create a port, port number is returned (-1 on failure) */
1417     +/* create a port, port number is returned (-1 on failure);
1418     + * the caller needs to unref the port via snd_seq_port_unlock() appropriately
1419     + */
1420     struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
1421     int port)
1422     {
1423     @@ -151,6 +153,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
1424     snd_use_lock_init(&new_port->use_lock);
1425     port_subs_info_init(&new_port->c_src);
1426     port_subs_info_init(&new_port->c_dest);
1427     + snd_use_lock_use(&new_port->use_lock);
1428    
1429     num = port >= 0 ? port : 0;
1430     mutex_lock(&client->ports_mutex);
1431     @@ -165,9 +168,9 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
1432     list_add_tail(&new_port->list, &p->list);
1433     client->num_ports++;
1434     new_port->addr.port = num; /* store the port number in the port */
1435     + sprintf(new_port->name, "port-%d", num);
1436     write_unlock_irqrestore(&client->ports_lock, flags);
1437     mutex_unlock(&client->ports_mutex);
1438     - sprintf(new_port->name, "port-%d", num);
1439    
1440     return new_port;
1441     }
1442     diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
1443     index 8d93a4021c78..f48a4cd24ffc 100644
1444     --- a/sound/core/seq/seq_virmidi.c
1445     +++ b/sound/core/seq/seq_virmidi.c
1446     @@ -77,13 +77,17 @@ static void snd_virmidi_init_event(struct snd_virmidi *vmidi,
1447     * decode input event and put to read buffer of each opened file
1448     */
1449     static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
1450     - struct snd_seq_event *ev)
1451     + struct snd_seq_event *ev,
1452     + bool atomic)
1453     {
1454     struct snd_virmidi *vmidi;
1455     unsigned char msg[4];
1456     int len;
1457    
1458     - read_lock(&rdev->filelist_lock);
1459     + if (atomic)
1460     + read_lock(&rdev->filelist_lock);
1461     + else
1462     + down_read(&rdev->filelist_sem);
1463     list_for_each_entry(vmidi, &rdev->filelist, list) {
1464     if (!vmidi->trigger)
1465     continue;
1466     @@ -97,7 +101,10 @@ static int snd_virmidi_dev_receive_event(struct snd_virmidi_dev *rdev,
1467     snd_rawmidi_receive(vmidi->substream, msg, len);
1468     }
1469     }
1470     - read_unlock(&rdev->filelist_lock);
1471     + if (atomic)
1472     + read_unlock(&rdev->filelist_lock);
1473     + else
1474     + up_read(&rdev->filelist_sem);
1475    
1476     return 0;
1477     }
1478     @@ -115,7 +122,7 @@ int snd_virmidi_receive(struct snd_rawmidi *rmidi, struct snd_seq_event *ev)
1479     struct snd_virmidi_dev *rdev;
1480    
1481     rdev = rmidi->private_data;
1482     - return snd_virmidi_dev_receive_event(rdev, ev);
1483     + return snd_virmidi_dev_receive_event(rdev, ev, true);
1484     }
1485     #endif /* 0 */
1486    
1487     @@ -130,7 +137,7 @@ static int snd_virmidi_event_input(struct snd_seq_event *ev, int direct,
1488     rdev = private_data;
1489     if (!(rdev->flags & SNDRV_VIRMIDI_USE))
1490     return 0; /* ignored */
1491     - return snd_virmidi_dev_receive_event(rdev, ev);
1492     + return snd_virmidi_dev_receive_event(rdev, ev, atomic);
1493     }
1494    
1495     /*
1496     @@ -209,7 +216,6 @@ static int snd_virmidi_input_open(struct snd_rawmidi_substream *substream)
1497     struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
1498     struct snd_rawmidi_runtime *runtime = substream->runtime;
1499     struct snd_virmidi *vmidi;
1500     - unsigned long flags;
1501    
1502     vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
1503     if (vmidi == NULL)
1504     @@ -223,9 +229,11 @@ static int snd_virmidi_input_open(struct snd_rawmidi_substream *substream)
1505     vmidi->client = rdev->client;
1506     vmidi->port = rdev->port;
1507     runtime->private_data = vmidi;
1508     - write_lock_irqsave(&rdev->filelist_lock, flags);
1509     + down_write(&rdev->filelist_sem);
1510     + write_lock_irq(&rdev->filelist_lock);
1511     list_add_tail(&vmidi->list, &rdev->filelist);
1512     - write_unlock_irqrestore(&rdev->filelist_lock, flags);
1513     + write_unlock_irq(&rdev->filelist_lock);
1514     + up_write(&rdev->filelist_sem);
1515     vmidi->rdev = rdev;
1516     return 0;
1517     }
1518     @@ -264,9 +272,11 @@ static int snd_virmidi_input_close(struct snd_rawmidi_substream *substream)
1519     struct snd_virmidi_dev *rdev = substream->rmidi->private_data;
1520     struct snd_virmidi *vmidi = substream->runtime->private_data;
1521    
1522     + down_write(&rdev->filelist_sem);
1523     write_lock_irq(&rdev->filelist_lock);
1524     list_del(&vmidi->list);
1525     write_unlock_irq(&rdev->filelist_lock);
1526     + up_write(&rdev->filelist_sem);
1527     snd_midi_event_free(vmidi->parser);
1528     substream->runtime->private_data = NULL;
1529     kfree(vmidi);
1530     @@ -520,6 +530,7 @@ int snd_virmidi_new(struct snd_card *card, int device, struct snd_rawmidi **rrmi
1531     rdev->rmidi = rmidi;
1532     rdev->device = device;
1533     rdev->client = -1;
1534     + init_rwsem(&rdev->filelist_sem);
1535     rwlock_init(&rdev->filelist_lock);
1536     INIT_LIST_HEAD(&rdev->filelist);
1537     rdev->seq_mode = SNDRV_VIRMIDI_SEQ_DISPATCH;
1538     diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
1539     index b871ba407e4e..4458190149d1 100644
1540     --- a/sound/usb/caiaq/device.c
1541     +++ b/sound/usb/caiaq/device.c
1542     @@ -469,10 +469,12 @@ static int init_card(struct snd_usb_caiaqdev *cdev)
1543    
1544     err = snd_usb_caiaq_send_command(cdev, EP1_CMD_GET_DEVICE_INFO, NULL, 0);
1545     if (err)
1546     - return err;
1547     + goto err_kill_urb;
1548    
1549     - if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ))
1550     - return -ENODEV;
1551     + if (!wait_event_timeout(cdev->ep1_wait_queue, cdev->spec_received, HZ)) {
1552     + err = -ENODEV;
1553     + goto err_kill_urb;
1554     + }
1555    
1556     usb_string(usb_dev, usb_dev->descriptor.iManufacturer,
1557     cdev->vendor_name, CAIAQ_USB_STR_LEN);
1558     @@ -507,6 +509,10 @@ static int init_card(struct snd_usb_caiaqdev *cdev)
1559    
1560     setup_card(cdev);
1561     return 0;
1562     +
1563     + err_kill_urb:
1564     + usb_kill_urb(&cdev->ep1_in_urb);
1565     + return err;
1566     }
1567    
1568     static int snd_probe(struct usb_interface *intf,
1569     diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
1570     index 0ff5a7d2e19f..c8f723c3a033 100644
1571     --- a/sound/usb/line6/driver.c
1572     +++ b/sound/usb/line6/driver.c
1573     @@ -779,9 +779,10 @@ int line6_probe(struct usb_interface *interface,
1574     return 0;
1575    
1576     error:
1577     - if (line6->disconnect)
1578     - line6->disconnect(line6);
1579     - snd_card_free(card);
1580     + /* we can call disconnect callback here because no close-sync is
1581     + * needed yet at this point
1582     + */
1583     + line6_disconnect(interface);
1584     return ret;
1585     }
1586     EXPORT_SYMBOL_GPL(line6_probe);
1587     diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
1588     index 956f847a96e4..451007c27743 100644
1589     --- a/sound/usb/line6/podhd.c
1590     +++ b/sound/usb/line6/podhd.c
1591     @@ -301,7 +301,8 @@ static void podhd_disconnect(struct usb_line6 *line6)
1592    
1593     intf = usb_ifnum_to_if(line6->usbdev,
1594     pod->line6.properties->ctrl_if);
1595     - usb_driver_release_interface(&podhd_driver, intf);
1596     + if (intf)
1597     + usb_driver_release_interface(&podhd_driver, intf);
1598     }
1599     }
1600    
1601     @@ -317,6 +318,9 @@ static int podhd_init(struct usb_line6 *line6,
1602    
1603     line6->disconnect = podhd_disconnect;
1604    
1605     + init_timer(&pod->startup_timer);
1606     + INIT_WORK(&pod->startup_work, podhd_startup_workqueue);
1607     +
1608     if (pod->line6.properties->capabilities & LINE6_CAP_CONTROL) {
1609     /* claim the data interface */
1610     intf = usb_ifnum_to_if(line6->usbdev,
1611     @@ -358,8 +362,6 @@ static int podhd_init(struct usb_line6 *line6,
1612     }
1613    
1614     /* init device and delay registering */
1615     - init_timer(&pod->startup_timer);
1616     - INIT_WORK(&pod->startup_work, podhd_startup_workqueue);
1617     podhd_startup(pod);
1618     return 0;
1619     }
1620     diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
1621     index e630813c5008..a08e90566edc 100644
1622     --- a/sound/usb/mixer.c
1623     +++ b/sound/usb/mixer.c
1624     @@ -2228,6 +2228,9 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)
1625    
1626     static void snd_usb_mixer_free(struct usb_mixer_interface *mixer)
1627     {
1628     + /* kill pending URBs */
1629     + snd_usb_mixer_disconnect(mixer);
1630     +
1631     kfree(mixer->id_elems);
1632     if (mixer->urb) {
1633     kfree(mixer->urb->transfer_buffer);
1634     @@ -2578,8 +2581,13 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
1635    
1636     void snd_usb_mixer_disconnect(struct usb_mixer_interface *mixer)
1637     {
1638     - usb_kill_urb(mixer->urb);
1639     - usb_kill_urb(mixer->rc_urb);
1640     + if (mixer->disconnected)
1641     + return;
1642     + if (mixer->urb)
1643     + usb_kill_urb(mixer->urb);
1644     + if (mixer->rc_urb)
1645     + usb_kill_urb(mixer->rc_urb);
1646     + mixer->disconnected = true;
1647     }
1648    
1649     #ifdef CONFIG_PM
1650     diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
1651     index 2b4b067646ab..545d99b09706 100644
1652     --- a/sound/usb/mixer.h
1653     +++ b/sound/usb/mixer.h
1654     @@ -22,6 +22,8 @@ struct usb_mixer_interface {
1655     struct urb *rc_urb;
1656     struct usb_ctrlrequest *rc_setup_packet;
1657     u8 rc_buffer[6];
1658     +
1659     + bool disconnected;
1660     };
1661    
1662     #define MAX_CHANNELS 16 /* max logical channels */
1663     diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
1664     index 83cdc0a61fd6..88a484c273e8 100644
1665     --- a/tools/perf/builtin-script.c
1666     +++ b/tools/perf/builtin-script.c
1667     @@ -578,7 +578,7 @@ static void print_sample_brstack(struct perf_sample *sample,
1668     thread__find_addr_map(thread, sample->cpumode, MAP__FUNCTION, to, &alt);
1669     }
1670    
1671     - printf("0x%"PRIx64, from);
1672     + printf(" 0x%"PRIx64, from);
1673     if (PRINT_FIELD(DSO)) {
1674     printf("(");
1675     map__fprintf_dsoname(alf.map, stdout);
1676     @@ -673,7 +673,7 @@ static void print_sample_brstackoff(struct perf_sample *sample,
1677     if (alt.map && !alt.map->dso->adjust_symbols)
1678     to = map__map_ip(alt.map, to);
1679    
1680     - printf("0x%"PRIx64, from);
1681     + printf(" 0x%"PRIx64, from);
1682     if (PRINT_FIELD(DSO)) {
1683     printf("(");
1684     map__fprintf_dsoname(alf.map, stdout);