Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0195-4.9.96-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3172 - (hide annotations) (download)
Wed Aug 8 14:17:27 2018 UTC (5 years, 9 months ago) by niro
File size: 99779 byte(s)
-linux-4.9.96
1 niro 3172 diff --git a/Makefile b/Makefile
2     index 1aeec9df709d..50ae573e8951 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 95
9     +SUBLEVEL = 96
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi
14     index a7da0dd0c98f..0898213f3bb2 100644
15     --- a/arch/arm/boot/dts/at91sam9g25.dtsi
16     +++ b/arch/arm/boot/dts/at91sam9g25.dtsi
17     @@ -21,7 +21,7 @@
18     atmel,mux-mask = <
19     /* A B C */
20     0xffffffff 0xffe0399f 0xc000001c /* pioA */
21     - 0x0007ffff 0x8000fe3f 0x00000000 /* pioB */
22     + 0x0007ffff 0x00047e3f 0x00000000 /* pioB */
23     0x80000000 0x07c0ffff 0xb83fffff /* pioC */
24     0x003fffff 0x003f8000 0x00000000 /* pioD */
25     >;
26     diff --git a/arch/arm/boot/dts/exynos5250.dtsi b/arch/arm/boot/dts/exynos5250.dtsi
27     index f7357d99b47c..64de33d067c9 100644
28     --- a/arch/arm/boot/dts/exynos5250.dtsi
29     +++ b/arch/arm/boot/dts/exynos5250.dtsi
30     @@ -640,7 +640,7 @@
31     power-domains = <&pd_gsc>;
32     clocks = <&clock CLK_GSCL0>;
33     clock-names = "gscl";
34     - iommu = <&sysmmu_gsc0>;
35     + iommus = <&sysmmu_gsc0>;
36     };
37    
38     gsc_1: gsc@13e10000 {
39     @@ -650,7 +650,7 @@
40     power-domains = <&pd_gsc>;
41     clocks = <&clock CLK_GSCL1>;
42     clock-names = "gscl";
43     - iommu = <&sysmmu_gsc1>;
44     + iommus = <&sysmmu_gsc1>;
45     };
46    
47     gsc_2: gsc@13e20000 {
48     @@ -660,7 +660,7 @@
49     power-domains = <&pd_gsc>;
50     clocks = <&clock CLK_GSCL2>;
51     clock-names = "gscl";
52     - iommu = <&sysmmu_gsc2>;
53     + iommus = <&sysmmu_gsc2>;
54     };
55    
56     gsc_3: gsc@13e30000 {
57     @@ -670,7 +670,7 @@
58     power-domains = <&pd_gsc>;
59     clocks = <&clock CLK_GSCL3>;
60     clock-names = "gscl";
61     - iommu = <&sysmmu_gsc3>;
62     + iommus = <&sysmmu_gsc3>;
63     };
64    
65     hdmi: hdmi@14530000 {
66     diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
67     index 65e725fb5679..de0e189711f6 100644
68     --- a/arch/arm/boot/dts/sama5d4.dtsi
69     +++ b/arch/arm/boot/dts/sama5d4.dtsi
70     @@ -1362,7 +1362,7 @@
71     pinctrl@fc06a000 {
72     #address-cells = <1>;
73     #size-cells = <1>;
74     - compatible = "atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
75     + compatible = "atmel,sama5d3-pinctrl", "atmel,at91sam9x5-pinctrl", "simple-bus";
76     ranges = <0xfc068000 0xfc068000 0x100
77     0xfc06a000 0xfc06a000 0x4000>;
78     /* WARNING: revisit as pin spec has changed */
79     diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
80     index 89fa5c0b1579..c92f4c28db7f 100644
81     --- a/arch/mips/include/asm/uaccess.h
82     +++ b/arch/mips/include/asm/uaccess.h
83     @@ -1257,6 +1257,13 @@ __clear_user(void __user *addr, __kernel_size_t size)
84     {
85     __kernel_size_t res;
86    
87     +#ifdef CONFIG_CPU_MICROMIPS
88     +/* micromips memset / bzero also clobbers t7 & t8 */
89     +#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$15", "$24", "$31"
90     +#else
91     +#define bzero_clobbers "$4", "$5", "$6", __UA_t0, __UA_t1, "$31"
92     +#endif /* CONFIG_CPU_MICROMIPS */
93     +
94     if (eva_kernel_access()) {
95     __asm__ __volatile__(
96     "move\t$4, %1\n\t"
97     @@ -1266,7 +1273,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
98     "move\t%0, $6"
99     : "=r" (res)
100     : "r" (addr), "r" (size)
101     - : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
102     + : bzero_clobbers);
103     } else {
104     might_fault();
105     __asm__ __volatile__(
106     @@ -1277,7 +1284,7 @@ __clear_user(void __user *addr, __kernel_size_t size)
107     "move\t%0, $6"
108     : "=r" (res)
109     : "r" (addr), "r" (size)
110     - : "$4", "$5", "$6", __UA_t0, __UA_t1, "$31");
111     + : bzero_clobbers);
112     }
113    
114     return res;
115     diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S
116     index 18a1ccd4d134..2b1bf93b5c80 100644
117     --- a/arch/mips/lib/memset.S
118     +++ b/arch/mips/lib/memset.S
119     @@ -218,7 +218,7 @@
120     1: PTR_ADDIU a0, 1 /* fill bytewise */
121     R10KCBARRIER(0(ra))
122     bne t1, a0, 1b
123     - sb a1, -1(a0)
124     + EX(sb, a1, -1(a0), .Lsmall_fixup\@)
125    
126     2: jr ra /* done */
127     move a2, zero
128     @@ -251,13 +251,18 @@
129     PTR_L t0, TI_TASK($28)
130     andi a2, STORMASK
131     LONG_L t0, THREAD_BUADDR(t0)
132     - LONG_ADDU a2, t1
133     + LONG_ADDU a2, a0
134     jr ra
135     LONG_SUBU a2, t0
136    
137     .Llast_fixup\@:
138     jr ra
139     - andi v1, a2, STORMASK
140     + nop
141     +
142     +.Lsmall_fixup\@:
143     + PTR_SUBU a2, t1, a0
144     + jr ra
145     + PTR_ADDIU a2, 1
146    
147     .endm
148    
149     diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h
150     index c0deafc212b8..798ab37c9930 100644
151     --- a/arch/powerpc/include/asm/barrier.h
152     +++ b/arch/powerpc/include/asm/barrier.h
153     @@ -34,7 +34,8 @@
154     #define rmb() __asm__ __volatile__ ("sync" : : : "memory")
155     #define wmb() __asm__ __volatile__ ("sync" : : : "memory")
156    
157     -#ifdef __SUBARCH_HAS_LWSYNC
158     +/* The sub-arch has lwsync */
159     +#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC)
160     # define SMPWMB LWSYNC
161     #else
162     # define SMPWMB eieio
163     diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
164     index e958b7096f19..9e5e0d910b91 100644
165     --- a/arch/powerpc/include/asm/opal.h
166     +++ b/arch/powerpc/include/asm/opal.h
167     @@ -21,6 +21,9 @@
168     /* We calculate number of sg entries based on PAGE_SIZE */
169     #define SG_ENTRIES_PER_NODE ((PAGE_SIZE - 16) / sizeof(struct opal_sg_entry))
170    
171     +/* Default time to sleep or delay between OPAL_BUSY/OPAL_BUSY_EVENT loops */
172     +#define OPAL_BUSY_DELAY_MS 10
173     +
174     /* /sys/firmware/opal */
175     extern struct kobject *opal_kobj;
176    
177     diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
178     index 78efe8d5d775..30f2d6d4c640 100644
179     --- a/arch/powerpc/include/asm/synch.h
180     +++ b/arch/powerpc/include/asm/synch.h
181     @@ -5,10 +5,6 @@
182     #include <linux/stringify.h>
183     #include <asm/feature-fixups.h>
184    
185     -#if defined(__powerpc64__) || defined(CONFIG_PPC_E500MC)
186     -#define __SUBARCH_HAS_LWSYNC
187     -#endif
188     -
189     #ifndef __ASSEMBLY__
190     extern unsigned int __start___lwsync_fixup, __stop___lwsync_fixup;
191     extern void do_lwsync_fixups(unsigned long value, void *fixup_start,
192     diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
193     index de7d091c4c31..1abd8dd77ec1 100644
194     --- a/arch/powerpc/kernel/eeh_pe.c
195     +++ b/arch/powerpc/kernel/eeh_pe.c
196     @@ -795,7 +795,8 @@ static void eeh_restore_bridge_bars(struct eeh_dev *edev)
197     eeh_ops->write_config(pdn, 15*4, 4, edev->config_space[15]);
198    
199     /* PCI Command: 0x4 */
200     - eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1]);
201     + eeh_ops->write_config(pdn, PCI_COMMAND, 4, edev->config_space[1] |
202     + PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
203    
204     /* Check the PCIe link is ready */
205     eeh_bridge_check_link(edev);
206     diff --git a/arch/powerpc/lib/feature-fixups.c b/arch/powerpc/lib/feature-fixups.c
207     index e86bfa111f3c..46c8338a61bc 100644
208     --- a/arch/powerpc/lib/feature-fixups.c
209     +++ b/arch/powerpc/lib/feature-fixups.c
210     @@ -55,7 +55,7 @@ static int patch_alt_instruction(unsigned int *src, unsigned int *dest,
211     unsigned int *target = (unsigned int *)branch_target(src);
212    
213     /* Branch within the section doesn't need translating */
214     - if (target < alt_start || target >= alt_end) {
215     + if (target < alt_start || target > alt_end) {
216     instr = translate_branch(dest, src);
217     if (!instr)
218     return 1;
219     diff --git a/arch/powerpc/platforms/powernv/opal-nvram.c b/arch/powerpc/platforms/powernv/opal-nvram.c
220     index 9db4398ded5d..1bceb95f422d 100644
221     --- a/arch/powerpc/platforms/powernv/opal-nvram.c
222     +++ b/arch/powerpc/platforms/powernv/opal-nvram.c
223     @@ -11,6 +11,7 @@
224    
225     #define DEBUG
226    
227     +#include <linux/delay.h>
228     #include <linux/kernel.h>
229     #include <linux/init.h>
230     #include <linux/of.h>
231     @@ -56,9 +57,17 @@ static ssize_t opal_nvram_write(char *buf, size_t count, loff_t *index)
232    
233     while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT) {
234     rc = opal_write_nvram(__pa(buf), count, off);
235     - if (rc == OPAL_BUSY_EVENT)
236     + if (rc == OPAL_BUSY_EVENT) {
237     + msleep(OPAL_BUSY_DELAY_MS);
238     opal_poll_events(NULL);
239     + } else if (rc == OPAL_BUSY) {
240     + msleep(OPAL_BUSY_DELAY_MS);
241     + }
242     }
243     +
244     + if (rc)
245     + return -EIO;
246     +
247     *index += count;
248     return count;
249     }
250     diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
251     index 09bccb224d03..2a17123130d3 100644
252     --- a/arch/s390/hypfs/inode.c
253     +++ b/arch/s390/hypfs/inode.c
254     @@ -318,7 +318,7 @@ static void hypfs_kill_super(struct super_block *sb)
255    
256     if (sb->s_root)
257     hypfs_delete_tree(sb->s_root);
258     - if (sb_info->update_file)
259     + if (sb_info && sb_info->update_file)
260     hypfs_remove(sb_info->update_file);
261     kfree(sb->s_fs_info);
262     sb->s_fs_info = NULL;
263     diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
264     index 2db18cbbb0ea..c0197097c86e 100644
265     --- a/arch/um/os-Linux/file.c
266     +++ b/arch/um/os-Linux/file.c
267     @@ -12,6 +12,7 @@
268     #include <sys/mount.h>
269     #include <sys/socket.h>
270     #include <sys/stat.h>
271     +#include <sys/sysmacros.h>
272     #include <sys/un.h>
273     #include <sys/types.h>
274     #include <os.h>
275     diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
276     index a86d7cc2c2d8..bf0acb8aad8b 100644
277     --- a/arch/um/os-Linux/signal.c
278     +++ b/arch/um/os-Linux/signal.c
279     @@ -16,6 +16,7 @@
280     #include <os.h>
281     #include <sysdep/mcontext.h>
282     #include <um_malloc.h>
283     +#include <sys/ucontext.h>
284    
285     void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
286     [SIGTRAP] = relay_signal,
287     @@ -159,7 +160,7 @@ static void (*handlers[_NSIG])(int sig, struct siginfo *si, mcontext_t *mc) = {
288    
289     static void hard_handler(int sig, siginfo_t *si, void *p)
290     {
291     - struct ucontext *uc = p;
292     + ucontext_t *uc = p;
293     mcontext_t *mc = &uc->uc_mcontext;
294     unsigned long pending = 1UL << sig;
295    
296     diff --git a/arch/x86/um/stub_segv.c b/arch/x86/um/stub_segv.c
297     index 1518d2805ae8..27361cbb7ca9 100644
298     --- a/arch/x86/um/stub_segv.c
299     +++ b/arch/x86/um/stub_segv.c
300     @@ -6,11 +6,12 @@
301     #include <sysdep/stub.h>
302     #include <sysdep/faultinfo.h>
303     #include <sysdep/mcontext.h>
304     +#include <sys/ucontext.h>
305    
306     void __attribute__ ((__section__ (".__syscall_stub")))
307     stub_segv_handler(int sig, siginfo_t *info, void *p)
308     {
309     - struct ucontext *uc = p;
310     + ucontext_t *uc = p;
311    
312     GET_FAULTINFO_FROM_MC(*((struct faultinfo *) STUB_DATA),
313     &uc->uc_mcontext);
314     diff --git a/block/blk-mq.c b/block/blk-mq.c
315     index 5ca4e4cd8cba..24fc09cf7f17 100644
316     --- a/block/blk-mq.c
317     +++ b/block/blk-mq.c
318     @@ -2019,15 +2019,15 @@ struct request_queue *blk_mq_init_allocated_queue(struct blk_mq_tag_set *set,
319    
320     blk_mq_init_cpu_queues(q, set->nr_hw_queues);
321    
322     - mutex_lock(&all_q_mutex);
323     get_online_cpus();
324     + mutex_lock(&all_q_mutex);
325    
326     list_add_tail(&q->all_q_node, &all_q_list);
327     blk_mq_add_queue_tag_set(set, q);
328     blk_mq_map_swqueue(q, cpu_online_mask);
329    
330     - put_online_cpus();
331     mutex_unlock(&all_q_mutex);
332     + put_online_cpus();
333    
334     return q;
335    
336     diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c
337     index 37032545c58e..3874eec972cd 100644
338     --- a/drivers/acpi/nfit/core.c
339     +++ b/drivers/acpi/nfit/core.c
340     @@ -967,8 +967,11 @@ static ssize_t scrub_show(struct device *dev,
341     if (nd_desc) {
342     struct acpi_nfit_desc *acpi_desc = to_acpi_desc(nd_desc);
343    
344     + mutex_lock(&acpi_desc->init_mutex);
345     rc = sprintf(buf, "%d%s", acpi_desc->scrub_count,
346     - (work_busy(&acpi_desc->work)) ? "+\n" : "\n");
347     + work_busy(&acpi_desc->work)
348     + && !acpi_desc->cancel ? "+\n" : "\n");
349     + mutex_unlock(&acpi_desc->init_mutex);
350     }
351     device_unlock(dev);
352     return rc;
353     diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
354     index 02ded25c82e4..cdc47375178e 100644
355     --- a/drivers/acpi/video_detect.c
356     +++ b/drivers/acpi/video_detect.c
357     @@ -213,6 +213,15 @@ static const struct dmi_system_id video_detect_dmi_table[] = {
358     "3570R/370R/470R/450R/510R/4450RV"),
359     },
360     },
361     + {
362     + /* https://bugzilla.redhat.com/show_bug.cgi?id=1557060 */
363     + .callback = video_detect_force_video,
364     + .ident = "SAMSUNG 670Z5E",
365     + .matches = {
366     + DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
367     + DMI_MATCH(DMI_PRODUCT_NAME, "670Z5E"),
368     + },
369     + },
370     {
371     /* https://bugzilla.redhat.com/show_bug.cgi?id=1094948 */
372     .callback = video_detect_force_video,
373     diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
374     index ae63bb0875ea..a7b0fc7cb468 100644
375     --- a/drivers/base/regmap/regmap.c
376     +++ b/drivers/base/regmap/regmap.c
377     @@ -1736,7 +1736,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
378     return -EINVAL;
379     if (val_len % map->format.val_bytes)
380     return -EINVAL;
381     - if (map->max_raw_write && map->max_raw_write > val_len)
382     + if (map->max_raw_write && map->max_raw_write < val_len)
383     return -E2BIG;
384    
385     map->lock(map->lock_arg);
386     diff --git a/drivers/char/random.c b/drivers/char/random.c
387     index 0c23ced255cb..8d08a8062904 100644
388     --- a/drivers/char/random.c
389     +++ b/drivers/char/random.c
390     @@ -434,8 +434,9 @@ struct crng_state primary_crng = {
391     * its value (from 0->1->2).
392     */
393     static int crng_init = 0;
394     -#define crng_ready() (likely(crng_init > 0))
395     +#define crng_ready() (likely(crng_init > 1))
396     static int crng_init_cnt = 0;
397     +static unsigned long crng_global_init_time = 0;
398     #define CRNG_INIT_CNT_THRESH (2*CHACHA20_KEY_SIZE)
399     static void _extract_crng(struct crng_state *crng,
400     __u8 out[CHACHA20_BLOCK_SIZE]);
401     @@ -741,7 +742,7 @@ static void credit_entropy_bits(struct entropy_store *r, int nbits)
402    
403     static int credit_entropy_bits_safe(struct entropy_store *r, int nbits)
404     {
405     - const int nbits_max = (int)(~0U >> (ENTROPY_SHIFT + 1));
406     + const int nbits_max = r->poolinfo->poolwords * 32;
407    
408     if (nbits < 0)
409     return -EINVAL;
410     @@ -800,7 +801,7 @@ static int crng_fast_load(const char *cp, size_t len)
411    
412     if (!spin_trylock_irqsave(&primary_crng.lock, flags))
413     return 0;
414     - if (crng_ready()) {
415     + if (crng_init != 0) {
416     spin_unlock_irqrestore(&primary_crng.lock, flags);
417     return 0;
418     }
419     @@ -836,7 +837,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
420     _crng_backtrack_protect(&primary_crng, buf.block,
421     CHACHA20_KEY_SIZE);
422     }
423     - spin_lock_irqsave(&primary_crng.lock, flags);
424     + spin_lock_irqsave(&crng->lock, flags);
425     for (i = 0; i < 8; i++) {
426     unsigned long rv;
427     if (!arch_get_random_seed_long(&rv) &&
428     @@ -852,7 +853,7 @@ static void crng_reseed(struct crng_state *crng, struct entropy_store *r)
429     wake_up_interruptible(&crng_init_wait);
430     pr_notice("random: crng init done\n");
431     }
432     - spin_unlock_irqrestore(&primary_crng.lock, flags);
433     + spin_unlock_irqrestore(&crng->lock, flags);
434     }
435    
436     static inline void maybe_reseed_primary_crng(void)
437     @@ -872,8 +873,9 @@ static void _extract_crng(struct crng_state *crng,
438     {
439     unsigned long v, flags;
440    
441     - if (crng_init > 1 &&
442     - time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL))
443     + if (crng_ready() &&
444     + (time_after(crng_global_init_time, crng->init_time) ||
445     + time_after(jiffies, crng->init_time + CRNG_RESEED_INTERVAL)))
446     crng_reseed(crng, crng == &primary_crng ? &input_pool : NULL);
447     spin_lock_irqsave(&crng->lock, flags);
448     if (arch_get_random_long(&v))
449     @@ -1153,7 +1155,7 @@ void add_interrupt_randomness(int irq, int irq_flags)
450     fast_mix(fast_pool);
451     add_interrupt_bench(cycles);
452    
453     - if (!crng_ready()) {
454     + if (unlikely(crng_init == 0)) {
455     if ((fast_pool->count >= 64) &&
456     crng_fast_load((char *) fast_pool->pool,
457     sizeof(fast_pool->pool))) {
458     @@ -1668,6 +1670,7 @@ static int rand_initialize(void)
459     init_std_data(&input_pool);
460     init_std_data(&blocking_pool);
461     crng_initialize(&primary_crng);
462     + crng_global_init_time = jiffies;
463    
464     #ifdef CONFIG_NUMA
465     pool = kcalloc(nr_node_ids, sizeof(*pool), GFP_KERNEL|__GFP_NOFAIL);
466     @@ -1854,6 +1857,14 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
467     input_pool.entropy_count = 0;
468     blocking_pool.entropy_count = 0;
469     return 0;
470     + case RNDRESEEDCRNG:
471     + if (!capable(CAP_SYS_ADMIN))
472     + return -EPERM;
473     + if (crng_init < 2)
474     + return -ENODATA;
475     + crng_reseed(&primary_crng, NULL);
476     + crng_global_init_time = jiffies - 1;
477     + return 0;
478     default:
479     return -EINVAL;
480     }
481     @@ -2148,7 +2159,7 @@ void add_hwgenerator_randomness(const char *buffer, size_t count,
482     {
483     struct entropy_store *poolp = &input_pool;
484    
485     - if (!crng_ready()) {
486     + if (unlikely(crng_init == 0)) {
487     crng_fast_load(buffer, count);
488     return;
489     }
490     diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
491     index abdc149941e2..73aab6e984cd 100644
492     --- a/drivers/clk/bcm/clk-bcm2835.c
493     +++ b/drivers/clk/bcm/clk-bcm2835.c
494     @@ -545,9 +545,7 @@ static void bcm2835_pll_off(struct clk_hw *hw)
495     const struct bcm2835_pll_data *data = pll->data;
496    
497     spin_lock(&cprman->regs_lock);
498     - cprman_write(cprman, data->cm_ctrl_reg,
499     - cprman_read(cprman, data->cm_ctrl_reg) |
500     - CM_PLL_ANARST);
501     + cprman_write(cprman, data->cm_ctrl_reg, CM_PLL_ANARST);
502     cprman_write(cprman, data->a2w_ctrl_reg,
503     cprman_read(cprman, data->a2w_ctrl_reg) |
504     A2W_PLL_CTRL_PWRDN);
505     @@ -583,6 +581,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
506     cpu_relax();
507     }
508    
509     + cprman_write(cprman, data->a2w_ctrl_reg,
510     + cprman_read(cprman, data->a2w_ctrl_reg) |
511     + A2W_PLL_CTRL_PRST_DISABLE);
512     +
513     return 0;
514     }
515    
516     diff --git a/drivers/clk/mvebu/armada-38x.c b/drivers/clk/mvebu/armada-38x.c
517     index 8bccf4ecdab6..9ff4ea63932d 100644
518     --- a/drivers/clk/mvebu/armada-38x.c
519     +++ b/drivers/clk/mvebu/armada-38x.c
520     @@ -46,10 +46,11 @@ static u32 __init armada_38x_get_tclk_freq(void __iomem *sar)
521     }
522    
523     static const u32 armada_38x_cpu_frequencies[] __initconst = {
524     - 0, 0, 0, 0,
525     - 1066 * 1000 * 1000, 0, 0, 0,
526     + 666 * 1000 * 1000, 0, 800 * 1000 * 1000, 0,
527     + 1066 * 1000 * 1000, 0, 1200 * 1000 * 1000, 0,
528     1332 * 1000 * 1000, 0, 0, 0,
529     - 1600 * 1000 * 1000,
530     + 1600 * 1000 * 1000, 0, 0, 0,
531     + 1866 * 1000 * 1000, 0, 0, 2000 * 1000 * 1000,
532     };
533    
534     static u32 __init armada_38x_get_cpu_freq(void __iomem *sar)
535     @@ -75,11 +76,11 @@ static const struct coreclk_ratio armada_38x_coreclk_ratios[] __initconst = {
536     };
537    
538     static const int armada_38x_cpu_l2_ratios[32][2] __initconst = {
539     - {0, 1}, {0, 1}, {0, 1}, {0, 1},
540     - {1, 2}, {0, 1}, {0, 1}, {0, 1},
541     + {1, 2}, {0, 1}, {1, 2}, {0, 1},
542     + {1, 2}, {0, 1}, {1, 2}, {0, 1},
543     {1, 2}, {0, 1}, {0, 1}, {0, 1},
544     {1, 2}, {0, 1}, {0, 1}, {0, 1},
545     - {0, 1}, {0, 1}, {0, 1}, {0, 1},
546     + {1, 2}, {0, 1}, {0, 1}, {1, 2},
547     {0, 1}, {0, 1}, {0, 1}, {0, 1},
548     {0, 1}, {0, 1}, {0, 1}, {0, 1},
549     {0, 1}, {0, 1}, {0, 1}, {0, 1},
550     @@ -90,7 +91,7 @@ static const int armada_38x_cpu_ddr_ratios[32][2] __initconst = {
551     {1, 2}, {0, 1}, {0, 1}, {0, 1},
552     {1, 2}, {0, 1}, {0, 1}, {0, 1},
553     {1, 2}, {0, 1}, {0, 1}, {0, 1},
554     - {0, 1}, {0, 1}, {0, 1}, {0, 1},
555     + {1, 2}, {0, 1}, {0, 1}, {7, 15},
556     {0, 1}, {0, 1}, {0, 1}, {0, 1},
557     {0, 1}, {0, 1}, {0, 1}, {0, 1},
558     {0, 1}, {0, 1}, {0, 1}, {0, 1},
559     diff --git a/drivers/clk/renesas/clk-sh73a0.c b/drivers/clk/renesas/clk-sh73a0.c
560     index eea38f6ea77e..3892346c4fcc 100644
561     --- a/drivers/clk/renesas/clk-sh73a0.c
562     +++ b/drivers/clk/renesas/clk-sh73a0.c
563     @@ -46,7 +46,7 @@ struct div4_clk {
564     unsigned int shift;
565     };
566    
567     -static struct div4_clk div4_clks[] = {
568     +static const struct div4_clk div4_clks[] = {
569     { "zg", "pll0", CPG_FRQCRA, 16 },
570     { "m3", "pll1", CPG_FRQCRA, 12 },
571     { "b", "pll1", CPG_FRQCRA, 8 },
572     @@ -79,7 +79,7 @@ sh73a0_cpg_register_clock(struct device_node *np, struct sh73a0_cpg *cpg,
573     {
574     const struct clk_div_table *table = NULL;
575     unsigned int shift, reg, width;
576     - const char *parent_name;
577     + const char *parent_name = NULL;
578     unsigned int mult = 1;
579     unsigned int div = 1;
580    
581     @@ -135,7 +135,7 @@ sh73a0_cpg_register_clock(struct device_node *np, struct sh73a0_cpg *cpg,
582     shift = 24;
583     width = 5;
584     } else {
585     - struct div4_clk *c;
586     + const struct div4_clk *c;
587    
588     for (c = div4_clks; c->name; c++) {
589     if (!strcmp(name, c->name)) {
590     diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
591     index b7d7f2d443a1..ee7b48d5243c 100644
592     --- a/drivers/dma/at_xdmac.c
593     +++ b/drivers/dma/at_xdmac.c
594     @@ -1473,10 +1473,10 @@ at_xdmac_tx_status(struct dma_chan *chan, dma_cookie_t cookie,
595     for (retry = 0; retry < AT_XDMAC_RESIDUE_MAX_RETRIES; retry++) {
596     check_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
597     rmb();
598     - initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);
599     - rmb();
600     cur_ubc = at_xdmac_chan_read(atchan, AT_XDMAC_CUBC);
601     rmb();
602     + initd = !!(at_xdmac_chan_read(atchan, AT_XDMAC_CC) & AT_XDMAC_CC_INITD);
603     + rmb();
604     cur_nda = at_xdmac_chan_read(atchan, AT_XDMAC_CNDA) & 0xfffffffc;
605     rmb();
606    
607     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
608     index 0e8f8972a160..0217f5d6ecb9 100644
609     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
610     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c
611     @@ -569,6 +569,7 @@ static const struct amdgpu_px_quirk amdgpu_px_quirk_list[] = {
612     { 0x1002, 0x6900, 0x1002, 0x0124, AMDGPU_PX_QUIRK_FORCE_ATPX },
613     { 0x1002, 0x6900, 0x1028, 0x0812, AMDGPU_PX_QUIRK_FORCE_ATPX },
614     { 0x1002, 0x6900, 0x1028, 0x0813, AMDGPU_PX_QUIRK_FORCE_ATPX },
615     + { 0x1002, 0x67DF, 0x1028, 0x0774, AMDGPU_PX_QUIRK_FORCE_ATPX },
616     { 0, 0, 0, 0, 0 },
617     };
618    
619     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
620     index c02db01f6583..fe011c7ec70a 100644
621     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
622     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bo_list.c
623     @@ -201,8 +201,10 @@ void amdgpu_bo_list_get_list(struct amdgpu_bo_list *list,
624     for (i = 0; i < list->num_entries; i++) {
625     unsigned priority = list->array[i].priority;
626    
627     - list_add_tail(&list->array[i].tv.head,
628     - &bucket[priority]);
629     + if (!list->array[i].robj->parent)
630     + list_add_tail(&list->array[i].tv.head,
631     + &bucket[priority]);
632     +
633     list->array[i].user_pages = NULL;
634     }
635    
636     diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
637     index cb505f66d3aa..c801624f33bd 100644
638     --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
639     +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
640     @@ -519,7 +519,7 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
641     INIT_LIST_HEAD(&duplicates);
642     amdgpu_vm_get_pd_bo(&fpriv->vm, &p->validated, &p->vm_pd);
643    
644     - if (p->uf_entry.robj)
645     + if (p->uf_entry.robj && !p->uf_entry.robj->parent)
646     list_add(&p->uf_entry.tv.head, &p->validated);
647    
648     if (need_mmap_lock)
649     diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
650     index 002862be2df6..3fa8320e49c1 100644
651     --- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
652     +++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
653     @@ -6449,9 +6449,9 @@ static void si_set_pcie_lane_width_in_smc(struct amdgpu_device *adev,
654     {
655     u32 lane_width;
656     u32 new_lane_width =
657     - (amdgpu_new_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT;
658     + ((amdgpu_new_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1;
659     u32 current_lane_width =
660     - (amdgpu_current_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT;
661     + ((amdgpu_current_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1;
662    
663     if (new_lane_width != current_lane_width) {
664     amdgpu_set_pcie_lanes(adev, new_lane_width);
665     diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
666     index 574ab0016a57..b82ef5ed727c 100644
667     --- a/drivers/gpu/drm/radeon/si_dpm.c
668     +++ b/drivers/gpu/drm/radeon/si_dpm.c
669     @@ -5969,9 +5969,9 @@ static void si_set_pcie_lane_width_in_smc(struct radeon_device *rdev,
670     {
671     u32 lane_width;
672     u32 new_lane_width =
673     - (radeon_new_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT;
674     + ((radeon_new_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1;
675     u32 current_lane_width =
676     - (radeon_current_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT;
677     + ((radeon_current_state->caps & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1;
678    
679     if (new_lane_width != current_lane_width) {
680     radeon_set_pcie_lanes(rdev, new_lane_width);
681     diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
682     index 6e3c4acb16ac..32d87c6035c9 100644
683     --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
684     +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
685     @@ -1386,6 +1386,9 @@ static int vop_initial(struct vop *vop)
686     usleep_range(10, 20);
687     reset_control_deassert(ahb_rst);
688    
689     + VOP_INTR_SET_TYPE(vop, clear, INTR_MASK, 1);
690     + VOP_INTR_SET_TYPE(vop, enable, INTR_MASK, 0);
691     +
692     memcpy(vop->regsbak, vop->regs, vop->len);
693    
694     for (i = 0; i < vop_data->table_size; i++)
695     @@ -1541,17 +1544,9 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
696    
697     mutex_init(&vop->vsync_mutex);
698    
699     - ret = devm_request_irq(dev, vop->irq, vop_isr,
700     - IRQF_SHARED, dev_name(dev), vop);
701     - if (ret)
702     - return ret;
703     -
704     - /* IRQ is initially disabled; it gets enabled in power_on */
705     - disable_irq(vop->irq);
706     -
707     ret = vop_create_crtc(vop);
708     if (ret)
709     - goto err_enable_irq;
710     + return ret;
711    
712     pm_runtime_enable(&pdev->dev);
713    
714     @@ -1561,13 +1556,19 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
715     goto err_disable_pm_runtime;
716     }
717    
718     + ret = devm_request_irq(dev, vop->irq, vop_isr,
719     + IRQF_SHARED, dev_name(dev), vop);
720     + if (ret)
721     + goto err_disable_pm_runtime;
722     +
723     + /* IRQ is initially disabled; it gets enabled in power_on */
724     + disable_irq(vop->irq);
725     +
726     return 0;
727    
728     err_disable_pm_runtime:
729     pm_runtime_disable(&pdev->dev);
730     vop_destroy_crtc(vop);
731     -err_enable_irq:
732     - enable_irq(vop->irq); /* To balance out the disable_irq above */
733     return ret;
734     }
735    
736     diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
737     index 49406e106cee..7944a1f589eb 100644
738     --- a/drivers/hid/hid-core.c
739     +++ b/drivers/hid/hid-core.c
740     @@ -1370,7 +1370,7 @@ u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags)
741     * of implement() working on 8 byte chunks
742     */
743    
744     - int len = hid_report_len(report) + 7;
745     + u32 len = hid_report_len(report) + 7;
746    
747     return kmalloc(len, flags);
748     }
749     @@ -1435,7 +1435,7 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
750     {
751     char *buf;
752     int ret;
753     - int len;
754     + u32 len;
755    
756     buf = hid_alloc_report_buf(report, GFP_KERNEL);
757     if (!buf)
758     @@ -1461,14 +1461,14 @@ void __hid_request(struct hid_device *hid, struct hid_report *report,
759     }
760     EXPORT_SYMBOL_GPL(__hid_request);
761    
762     -int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
763     +int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
764     int interrupt)
765     {
766     struct hid_report_enum *report_enum = hid->report_enum + type;
767     struct hid_report *report;
768     struct hid_driver *hdrv;
769     unsigned int a;
770     - int rsize, csize = size;
771     + u32 rsize, csize = size;
772     u8 *cdata = data;
773     int ret = 0;
774    
775     @@ -1526,7 +1526,7 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
776     *
777     * This is data entry for lower layers.
778     */
779     -int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
780     +int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
781     {
782     struct hid_report_enum *report_enum;
783     struct hid_driver *hdrv;
784     diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
785     index 40233315d5f5..5ff6dd8147b6 100644
786     --- a/drivers/hid/hid-input.c
787     +++ b/drivers/hid/hid-input.c
788     @@ -1279,7 +1279,8 @@ static void hidinput_led_worker(struct work_struct *work)
789     led_work);
790     struct hid_field *field;
791     struct hid_report *report;
792     - int len, ret;
793     + int ret;
794     + u32 len;
795     __u8 *buf;
796    
797     field = hidinput_get_led_field(hid);
798     diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c
799     index 89e9032ab1e7..fba655d639af 100644
800     --- a/drivers/hid/hid-multitouch.c
801     +++ b/drivers/hid/hid-multitouch.c
802     @@ -315,7 +315,8 @@ static struct attribute_group mt_attribute_group = {
803     static void mt_get_feature(struct hid_device *hdev, struct hid_report *report)
804     {
805     struct mt_device *td = hid_get_drvdata(hdev);
806     - int ret, size = hid_report_len(report);
807     + int ret;
808     + u32 size = hid_report_len(report);
809     u8 *buf;
810    
811     /*
812     @@ -919,7 +920,7 @@ static void mt_set_input_mode(struct hid_device *hdev)
813     struct hid_report_enum *re;
814     struct mt_class *cls = &td->mtclass;
815     char *buf;
816     - int report_len;
817     + u32 report_len;
818    
819     if (td->inputmode < 0)
820     return;
821     diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c
822     index be89bcbf6a71..276d12d4b576 100644
823     --- a/drivers/hid/hid-rmi.c
824     +++ b/drivers/hid/hid-rmi.c
825     @@ -110,8 +110,8 @@ struct rmi_data {
826     u8 *writeReport;
827     u8 *readReport;
828    
829     - int input_report_size;
830     - int output_report_size;
831     + u32 input_report_size;
832     + u32 output_report_size;
833    
834     unsigned long flags;
835    
836     diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
837     index f0e2757cb909..216f0338a1f7 100644
838     --- a/drivers/hid/hidraw.c
839     +++ b/drivers/hid/hidraw.c
840     @@ -192,6 +192,11 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t
841     int ret = 0, len;
842     unsigned char report_number;
843    
844     + if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
845     + ret = -ENODEV;
846     + goto out;
847     + }
848     +
849     dev = hidraw_table[minor]->hid;
850    
851     if (!dev->ll_driver->raw_request) {
852     diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
853     index 7d6da9b43dab..2548c5dbdc75 100644
854     --- a/drivers/hid/i2c-hid/i2c-hid.c
855     +++ b/drivers/hid/i2c-hid/i2c-hid.c
856     @@ -142,10 +142,10 @@ struct i2c_hid {
857     * register of the HID
858     * descriptor. */
859     unsigned int bufsize; /* i2c buffer size */
860     - char *inbuf; /* Input buffer */
861     - char *rawbuf; /* Raw Input buffer */
862     - char *cmdbuf; /* Command buffer */
863     - char *argsbuf; /* Command arguments buffer */
864     + u8 *inbuf; /* Input buffer */
865     + u8 *rawbuf; /* Raw Input buffer */
866     + u8 *cmdbuf; /* Command buffer */
867     + u8 *argsbuf; /* Command arguments buffer */
868    
869     unsigned long flags; /* device flags */
870     unsigned long quirks; /* Various quirks */
871     @@ -451,7 +451,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
872    
873     static void i2c_hid_get_input(struct i2c_hid *ihid)
874     {
875     - int ret, ret_size;
876     + int ret;
877     + u32 ret_size;
878     int size = le16_to_cpu(ihid->hdesc.wMaxInputLength);
879    
880     if (size > ihid->bufsize)
881     @@ -476,7 +477,7 @@ static void i2c_hid_get_input(struct i2c_hid *ihid)
882     return;
883     }
884    
885     - if (ret_size > size) {
886     + if ((ret_size > size) || (ret_size <= 2)) {
887     dev_err(&ihid->client->dev, "%s: incomplete report (%d/%d)\n",
888     __func__, size, ret_size);
889     return;
890     diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
891     index 7a4d39ce51d9..e8b90b534f08 100644
892     --- a/drivers/hid/wacom_sys.c
893     +++ b/drivers/hid/wacom_sys.c
894     @@ -351,7 +351,7 @@ static int wacom_set_device_mode(struct hid_device *hdev,
895     u8 *rep_data;
896     struct hid_report *r;
897     struct hid_report_enum *re;
898     - int length;
899     + u32 length;
900     int error = -ENOMEM, limit = 0;
901    
902     if (wacom_wac->mode_report < 0)
903     diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
904     index 4d732810f6fc..cb79d171d1e4 100644
905     --- a/drivers/infiniband/core/ucma.c
906     +++ b/drivers/infiniband/core/ucma.c
907     @@ -1231,6 +1231,9 @@ static int ucma_set_ib_path(struct ucma_context *ctx,
908     if (!optlen)
909     return -EINVAL;
910    
911     + if (!ctx->cm_id->device)
912     + return -EINVAL;
913     +
914     memset(&sa_path, 0, sizeof(sa_path));
915    
916     ib_sa_unpack_path(path_data->path_rec, &sa_path);
917     diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
918     index 59f37f412a7f..ced416f5dffb 100644
919     --- a/drivers/infiniband/sw/rxe/rxe_verbs.c
920     +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
921     @@ -747,9 +747,8 @@ static int init_send_wqe(struct rxe_qp *qp, struct ib_send_wr *ibwr,
922     memcpy(wqe->dma.sge, ibwr->sg_list,
923     num_sge * sizeof(struct ib_sge));
924    
925     - wqe->iova = (mask & WR_ATOMIC_MASK) ?
926     - atomic_wr(ibwr)->remote_addr :
927     - rdma_wr(ibwr)->remote_addr;
928     + wqe->iova = mask & WR_ATOMIC_MASK ? atomic_wr(ibwr)->remote_addr :
929     + mask & WR_READ_OR_WRITE_MASK ? rdma_wr(ibwr)->remote_addr : 0;
930     wqe->mask = mask;
931     wqe->dma.length = length;
932     wqe->dma.resid = length;
933     diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
934     index 84f91858b5e6..463ea592a42a 100644
935     --- a/drivers/infiniband/ulp/srp/ib_srp.c
936     +++ b/drivers/infiniband/ulp/srp/ib_srp.c
937     @@ -2626,9 +2626,11 @@ static int srp_abort(struct scsi_cmnd *scmnd)
938     ret = FAST_IO_FAIL;
939     else
940     ret = FAILED;
941     - srp_free_req(ch, req, scmnd, 0);
942     - scmnd->result = DID_ABORT << 16;
943     - scmnd->scsi_done(scmnd);
944     + if (ret == SUCCESS) {
945     + srp_free_req(ch, req, scmnd, 0);
946     + scmnd->result = DID_ABORT << 16;
947     + scmnd->scsi_done(scmnd);
948     + }
949    
950     return ret;
951     }
952     @@ -3395,12 +3397,10 @@ static ssize_t srp_create_target(struct device *dev,
953     num_online_nodes());
954     const int ch_end = ((node_idx + 1) * target->ch_count /
955     num_online_nodes());
956     - const int cv_start = (node_idx * ibdev->num_comp_vectors /
957     - num_online_nodes() + target->comp_vector)
958     - % ibdev->num_comp_vectors;
959     - const int cv_end = ((node_idx + 1) * ibdev->num_comp_vectors /
960     - num_online_nodes() + target->comp_vector)
961     - % ibdev->num_comp_vectors;
962     + const int cv_start = node_idx * ibdev->num_comp_vectors /
963     + num_online_nodes();
964     + const int cv_end = (node_idx + 1) * ibdev->num_comp_vectors /
965     + num_online_nodes();
966     int cpu_idx = 0;
967    
968     for_each_online_cpu(cpu) {
969     diff --git a/drivers/iommu/intel-svm.c b/drivers/iommu/intel-svm.c
970     index 3a1c40684213..f846f0140a9d 100644
971     --- a/drivers/iommu/intel-svm.c
972     +++ b/drivers/iommu/intel-svm.c
973     @@ -389,6 +389,7 @@ int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_
974     pasid_max - 1, GFP_KERNEL);
975     if (ret < 0) {
976     kfree(svm);
977     + kfree(sdev);
978     goto out;
979     }
980     svm->pasid = ret;
981     diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c
982     index 9ae71804b5dd..1c2ca8d51a70 100644
983     --- a/drivers/irqchip/irq-gic-common.c
984     +++ b/drivers/irqchip/irq-gic-common.c
985     @@ -21,6 +21,8 @@
986    
987     #include "irq-gic-common.h"
988    
989     +static DEFINE_RAW_SPINLOCK(irq_controller_lock);
990     +
991     static const struct gic_kvm_info *gic_kvm_info;
992    
993     const struct gic_kvm_info *gic_get_kvm_info(void)
994     @@ -52,11 +54,13 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
995     u32 confoff = (irq / 16) * 4;
996     u32 val, oldval;
997     int ret = 0;
998     + unsigned long flags;
999    
1000     /*
1001     * Read current configuration register, and insert the config
1002     * for "irq", depending on "type".
1003     */
1004     + raw_spin_lock_irqsave(&irq_controller_lock, flags);
1005     val = oldval = readl_relaxed(base + GIC_DIST_CONFIG + confoff);
1006     if (type & IRQ_TYPE_LEVEL_MASK)
1007     val &= ~confmask;
1008     @@ -64,8 +68,10 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
1009     val |= confmask;
1010    
1011     /* If the current configuration is the same, then we are done */
1012     - if (val == oldval)
1013     + if (val == oldval) {
1014     + raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
1015     return 0;
1016     + }
1017    
1018     /*
1019     * Write back the new configuration, and possibly re-enable
1020     @@ -83,6 +89,7 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
1021     pr_warn("GIC: PPI%d is secure or misconfigured\n",
1022     irq - 16);
1023     }
1024     + raw_spin_unlock_irqrestore(&irq_controller_lock, flags);
1025    
1026     if (sync_access)
1027     sync_access();
1028     diff --git a/drivers/mmc/host/jz4740_mmc.c b/drivers/mmc/host/jz4740_mmc.c
1029     index 684087db170b..1752007397f9 100644
1030     --- a/drivers/mmc/host/jz4740_mmc.c
1031     +++ b/drivers/mmc/host/jz4740_mmc.c
1032     @@ -368,9 +368,9 @@ static void jz4740_mmc_set_irq_enabled(struct jz4740_mmc_host *host,
1033     host->irq_mask &= ~irq;
1034     else
1035     host->irq_mask |= irq;
1036     - spin_unlock_irqrestore(&host->lock, flags);
1037    
1038     writew(host->irq_mask, host->base + JZ_REG_MMC_IMASK);
1039     + spin_unlock_irqrestore(&host->lock, flags);
1040     }
1041    
1042     static void jz4740_mmc_clock_enable(struct jz4740_mmc_host *host,
1043     diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
1044     index 46913ef25bc0..479a5f02d10b 100644
1045     --- a/drivers/mtd/ubi/block.c
1046     +++ b/drivers/mtd/ubi/block.c
1047     @@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
1048     * in any case.
1049     */
1050     if (mode & FMODE_WRITE) {
1051     - ret = -EPERM;
1052     + ret = -EROFS;
1053     goto out_unlock;
1054     }
1055    
1056     diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
1057     index 85d54f37e28f..6cb5ca52cb5a 100644
1058     --- a/drivers/mtd/ubi/build.c
1059     +++ b/drivers/mtd/ubi/build.c
1060     @@ -894,6 +894,17 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
1061     return -EINVAL;
1062     }
1063    
1064     + /*
1065     + * Both UBI and UBIFS have been designed for SLC NAND and NOR flashes.
1066     + * MLC NAND is different and needs special care, otherwise UBI or UBIFS
1067     + * will die soon and you will lose all your data.
1068     + */
1069     + if (mtd->type == MTD_MLCNANDFLASH) {
1070     + pr_err("ubi: refuse attaching mtd%d - MLC NAND is not supported\n",
1071     + mtd->index);
1072     + return -EINVAL;
1073     + }
1074     +
1075     if (ubi_num == UBI_DEV_NUM_AUTO) {
1076     /* Search for an empty slot in the @ubi_devices array */
1077     for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
1078     diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c
1079     index 4f0bd6b4422a..69dd21679a30 100644
1080     --- a/drivers/mtd/ubi/fastmap-wl.c
1081     +++ b/drivers/mtd/ubi/fastmap-wl.c
1082     @@ -362,7 +362,6 @@ static void ubi_fastmap_close(struct ubi_device *ubi)
1083     {
1084     int i;
1085    
1086     - flush_work(&ubi->fm_work);
1087     return_unused_pool_pebs(ubi, &ubi->fm_pool);
1088     return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
1089    
1090     diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
1091     index b09c81e882b4..1b287861e34f 100644
1092     --- a/drivers/net/xen-netfront.c
1093     +++ b/drivers/net/xen-netfront.c
1094     @@ -2038,7 +2038,10 @@ static void netback_changed(struct xenbus_device *dev,
1095     case XenbusStateInitialised:
1096     case XenbusStateReconfiguring:
1097     case XenbusStateReconfigured:
1098     + break;
1099     +
1100     case XenbusStateUnknown:
1101     + wake_up_all(&module_unload_q);
1102     break;
1103    
1104     case XenbusStateInitWait:
1105     @@ -2169,7 +2172,9 @@ static int xennet_remove(struct xenbus_device *dev)
1106     xenbus_switch_state(dev, XenbusStateClosing);
1107     wait_event(module_unload_q,
1108     xenbus_read_driver_state(dev->otherend) ==
1109     - XenbusStateClosing);
1110     + XenbusStateClosing ||
1111     + xenbus_read_driver_state(dev->otherend) ==
1112     + XenbusStateUnknown);
1113    
1114     xenbus_switch_state(dev, XenbusStateClosed);
1115     wait_event(module_unload_q,
1116     diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c
1117     index b8fb1ef1fc15..74257ac92490 100644
1118     --- a/drivers/nvdimm/namespace_devs.c
1119     +++ b/drivers/nvdimm/namespace_devs.c
1120     @@ -1747,7 +1747,7 @@ struct device *create_namespace_pmem(struct nd_region *nd_region,
1121     }
1122    
1123     if (i < nd_region->ndr_mappings) {
1124     - struct nvdimm_drvdata *ndd = to_ndd(&nd_region->mapping[i]);
1125     + struct nvdimm *nvdimm = nd_region->mapping[i].nvdimm;
1126    
1127     /*
1128     * Give up if we don't find an instance of a uuid at each
1129     @@ -1755,7 +1755,7 @@ struct device *create_namespace_pmem(struct nd_region *nd_region,
1130     * find a dimm with two instances of the same uuid.
1131     */
1132     dev_err(&nd_region->dev, "%s missing label for %pUb\n",
1133     - dev_name(ndd->dev), nd_label->uuid);
1134     + nvdimm_name(nvdimm), nd_label->uuid);
1135     rc = -EINVAL;
1136     goto err;
1137     }
1138     diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
1139     index a46b585fae31..d44b55879c67 100644
1140     --- a/drivers/pci/hotplug/acpiphp_glue.c
1141     +++ b/drivers/pci/hotplug/acpiphp_glue.c
1142     @@ -587,6 +587,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1143     {
1144     unsigned long long sta = 0;
1145     struct acpiphp_func *func;
1146     + u32 dvid;
1147    
1148     list_for_each_entry(func, &slot->funcs, sibling) {
1149     if (func->flags & FUNC_HAS_STA) {
1150     @@ -597,19 +598,27 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot)
1151     if (ACPI_SUCCESS(status) && sta)
1152     break;
1153     } else {
1154     - u32 dvid;
1155     -
1156     - pci_bus_read_config_dword(slot->bus,
1157     - PCI_DEVFN(slot->device,
1158     - func->function),
1159     - PCI_VENDOR_ID, &dvid);
1160     - if (dvid != 0xffffffff) {
1161     + if (pci_bus_read_dev_vendor_id(slot->bus,
1162     + PCI_DEVFN(slot->device, func->function),
1163     + &dvid, 0)) {
1164     sta = ACPI_STA_ALL;
1165     break;
1166     }
1167     }
1168     }
1169    
1170     + if (!sta) {
1171     + /*
1172     + * Check for the slot itself since it may be that the
1173     + * ACPI slot is a device below PCIe upstream port so in
1174     + * that case it may not even be reachable yet.
1175     + */
1176     + if (pci_bus_read_dev_vendor_id(slot->bus,
1177     + PCI_DEVFN(slot->device, 0), &dvid, 0)) {
1178     + sta = ACPI_STA_ALL;
1179     + }
1180     + }
1181     +
1182     return (unsigned int)sta;
1183     }
1184    
1185     diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c
1186     index 1c85ecc9e7ac..0fcf94ffad32 100644
1187     --- a/drivers/pwm/pwm-rcar.c
1188     +++ b/drivers/pwm/pwm-rcar.c
1189     @@ -156,8 +156,12 @@ static int rcar_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
1190     if (div < 0)
1191     return div;
1192    
1193     - /* Let the core driver set pwm->period if disabled and duty_ns == 0 */
1194     - if (!pwm_is_enabled(pwm) && !duty_ns)
1195     + /*
1196     + * Let the core driver set pwm->period if disabled and duty_ns == 0.
1197     + * But, this driver should prevent to set the new duty_ns if current
1198     + * duty_cycle is not set
1199     + */
1200     + if (!pwm_is_enabled(pwm) && !duty_ns && !pwm->state.duty_cycle)
1201     return 0;
1202    
1203     rcar_pwm_update(rp, RCAR_PWMCR_SYNC, RCAR_PWMCR_SYNC, RCAR_PWMCR);
1204     diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
1205     index 6db80635ace8..c2e85e23d538 100644
1206     --- a/drivers/spi/spi.c
1207     +++ b/drivers/spi/spi.c
1208     @@ -743,8 +743,14 @@ static int spi_map_buf(struct spi_master *master, struct device *dev,
1209     for (i = 0; i < sgs; i++) {
1210    
1211     if (vmalloced_buf || kmap_buf) {
1212     - min = min_t(size_t,
1213     - len, desc_len - offset_in_page(buf));
1214     + /*
1215     + * Next scatterlist entry size is the minimum between
1216     + * the desc_len and the remaining buffer length that
1217     + * fits in a page.
1218     + */
1219     + min = min_t(size_t, desc_len,
1220     + min_t(size_t, len,
1221     + PAGE_SIZE - offset_in_page(buf)));
1222     if (vmalloced_buf)
1223     vm_page = vmalloc_to_page(buf);
1224     else
1225     diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
1226     index 06912f0602b7..b7cb49afa056 100644
1227     --- a/drivers/thermal/imx_thermal.c
1228     +++ b/drivers/thermal/imx_thermal.c
1229     @@ -587,6 +587,9 @@ static int imx_thermal_probe(struct platform_device *pdev)
1230     regmap_write(map, TEMPSENSE0 + REG_CLR, TEMPSENSE0_POWER_DOWN);
1231     regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_MEASURE_TEMP);
1232    
1233     + data->irq_enabled = true;
1234     + data->mode = THERMAL_DEVICE_ENABLED;
1235     +
1236     ret = devm_request_threaded_irq(&pdev->dev, data->irq,
1237     imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread,
1238     0, "imx_thermal", data);
1239     @@ -598,9 +601,6 @@ static int imx_thermal_probe(struct platform_device *pdev)
1240     return ret;
1241     }
1242    
1243     - data->irq_enabled = true;
1244     - data->mode = THERMAL_DEVICE_ENABLED;
1245     -
1246     return 0;
1247     }
1248    
1249     diff --git a/drivers/thunderbolt/nhi.c b/drivers/thunderbolt/nhi.c
1250     index a8c20413dbda..cba6bc6ab9ed 100644
1251     --- a/drivers/thunderbolt/nhi.c
1252     +++ b/drivers/thunderbolt/nhi.c
1253     @@ -628,6 +628,7 @@ static const struct dev_pm_ops nhi_pm_ops = {
1254     * we just disable hotplug, the
1255     * pci-tunnels stay alive.
1256     */
1257     + .thaw_noirq = nhi_resume_noirq,
1258     .restore_noirq = nhi_resume_noirq,
1259     };
1260    
1261     diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
1262     index faf50df81622..1c70541a1467 100644
1263     --- a/drivers/tty/n_tty.c
1264     +++ b/drivers/tty/n_tty.c
1265     @@ -2182,6 +2182,12 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
1266     }
1267     if (tty_hung_up_p(file))
1268     break;
1269     + /*
1270     + * Abort readers for ttys which never actually
1271     + * get hung up. See __tty_hangup().
1272     + */
1273     + if (test_bit(TTY_HUPPING, &tty->flags))
1274     + break;
1275     if (!timeout)
1276     break;
1277     if (file->f_flags & O_NONBLOCK) {
1278     diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
1279     index fb9bada5f1d5..4ee0a9de7556 100644
1280     --- a/drivers/tty/tty_io.c
1281     +++ b/drivers/tty/tty_io.c
1282     @@ -709,6 +709,14 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session)
1283     return;
1284     }
1285    
1286     + /*
1287     + * Some console devices aren't actually hung up for technical and
1288     + * historical reasons, which can lead to indefinite interruptible
1289     + * sleep in n_tty_read(). The following explicitly tells
1290     + * n_tty_read() to abort readers.
1291     + */
1292     + set_bit(TTY_HUPPING, &tty->flags);
1293     +
1294     /* inuse_filps is protected by the single tty lock,
1295     this really needs to change if we want to flush the
1296     workqueue with the lock held */
1297     @@ -763,6 +771,7 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session)
1298     * from the ldisc side, which is now guaranteed.
1299     */
1300     set_bit(TTY_HUPPED, &tty->flags);
1301     + clear_bit(TTY_HUPPING, &tty->flags);
1302     tty_unlock(tty);
1303    
1304     if (f)
1305     diff --git a/drivers/usb/core/generic.c b/drivers/usb/core/generic.c
1306     index 358ca8dd784f..a5240b4d7ab9 100644
1307     --- a/drivers/usb/core/generic.c
1308     +++ b/drivers/usb/core/generic.c
1309     @@ -208,8 +208,13 @@ static int generic_suspend(struct usb_device *udev, pm_message_t msg)
1310     if (!udev->parent)
1311     rc = hcd_bus_suspend(udev, msg);
1312    
1313     - /* Non-root devices don't need to do anything for FREEZE or PRETHAW */
1314     - else if (msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
1315     + /*
1316     + * Non-root USB2 devices don't need to do anything for FREEZE
1317     + * or PRETHAW. USB3 devices don't support global suspend and
1318     + * needs to be selectively suspended.
1319     + */
1320     + else if ((msg.event == PM_EVENT_FREEZE || msg.event == PM_EVENT_PRETHAW)
1321     + && (udev->speed < USB_SPEED_SUPER))
1322     rc = 0;
1323     else
1324     rc = usb_port_suspend(udev, msg);
1325     diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c
1326     index 427291a19e6d..d6493abcf6bc 100644
1327     --- a/drivers/usb/dwc3/dwc3-pci.c
1328     +++ b/drivers/usb/dwc3/dwc3-pci.c
1329     @@ -173,7 +173,7 @@ static int dwc3_pci_probe(struct pci_dev *pci,
1330     ret = platform_device_add_resources(dwc3, res, ARRAY_SIZE(res));
1331     if (ret) {
1332     dev_err(dev, "couldn't add resources to dwc3 device\n");
1333     - return ret;
1334     + goto err;
1335     }
1336    
1337     dwc3->dev.parent = dev;
1338     diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
1339     index a5719f271bf0..70ac1963b598 100644
1340     --- a/drivers/usb/gadget/function/f_midi.c
1341     +++ b/drivers/usb/gadget/function/f_midi.c
1342     @@ -389,7 +389,8 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
1343     if (err) {
1344     ERROR(midi, "%s: couldn't enqueue request: %d\n",
1345     midi->out_ep->name, err);
1346     - free_ep_req(midi->out_ep, req);
1347     + if (req->buf != NULL)
1348     + free_ep_req(midi->out_ep, req);
1349     return err;
1350     }
1351     }
1352     diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h
1353     index 7d53a4773d1a..2f03334c6874 100644
1354     --- a/drivers/usb/gadget/u_f.h
1355     +++ b/drivers/usb/gadget/u_f.h
1356     @@ -64,7 +64,9 @@ struct usb_request *alloc_ep_req(struct usb_ep *ep, size_t len);
1357     /* Frees a usb_request previously allocated by alloc_ep_req() */
1358     static inline void free_ep_req(struct usb_ep *ep, struct usb_request *req)
1359     {
1360     + WARN_ON(req->buf == NULL);
1361     kfree(req->buf);
1362     + req->buf = NULL;
1363     usb_ep_free_request(ep, req);
1364     }
1365    
1366     diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
1367     index 7d658565b20f..188961780b8a 100644
1368     --- a/drivers/usb/gadget/udc/core.c
1369     +++ b/drivers/usb/gadget/udc/core.c
1370     @@ -248,6 +248,9 @@ EXPORT_SYMBOL_GPL(usb_ep_free_request);
1371     * arranges to poll once per interval, and the gadget driver usually will
1372     * have queued some data to transfer at that time.
1373     *
1374     + * Note that @req's ->complete() callback must never be called from
1375     + * within usb_ep_queue() as that can create deadlock situations.
1376     + *
1377     * Returns zero, or a negative error code. Endpoints that are not enabled
1378     * report errors; errors will also be
1379     * reported when the usb peripheral is disconnected.
1380     diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
1381     index 844a309fe895..e85b9c2a4910 100644
1382     --- a/drivers/usb/musb/musb_gadget_ep0.c
1383     +++ b/drivers/usb/musb/musb_gadget_ep0.c
1384     @@ -114,15 +114,19 @@ static int service_tx_status_request(
1385     }
1386    
1387     is_in = epnum & USB_DIR_IN;
1388     - if (is_in) {
1389     - epnum &= 0x0f;
1390     + epnum &= 0x0f;
1391     + if (epnum >= MUSB_C_NUM_EPS) {
1392     + handled = -EINVAL;
1393     + break;
1394     + }
1395     +
1396     + if (is_in)
1397     ep = &musb->endpoints[epnum].ep_in;
1398     - } else {
1399     + else
1400     ep = &musb->endpoints[epnum].ep_out;
1401     - }
1402     regs = musb->endpoints[epnum].regs;
1403    
1404     - if (epnum >= MUSB_C_NUM_EPS || !ep->desc) {
1405     + if (!ep->desc) {
1406     handled = -EINVAL;
1407     break;
1408     }
1409     diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
1410     index 9f1ec4392209..7b8a957b008d 100644
1411     --- a/drivers/vfio/pci/vfio_pci_config.c
1412     +++ b/drivers/vfio/pci/vfio_pci_config.c
1413     @@ -810,6 +810,7 @@ static int vfio_exp_config_write(struct vfio_pci_device *vdev, int pos,
1414     {
1415     __le16 *ctrl = (__le16 *)(vdev->vconfig + pos -
1416     offset + PCI_EXP_DEVCTL);
1417     + int readrq = le16_to_cpu(*ctrl) & PCI_EXP_DEVCTL_READRQ;
1418    
1419     count = vfio_default_config_write(vdev, pos, count, perm, offset, val);
1420     if (count < 0)
1421     @@ -835,6 +836,27 @@ static int vfio_exp_config_write(struct vfio_pci_device *vdev, int pos,
1422     pci_try_reset_function(vdev->pdev);
1423     }
1424    
1425     + /*
1426     + * MPS is virtualized to the user, writes do not change the physical
1427     + * register since determining a proper MPS value requires a system wide
1428     + * device view. The MRRS is largely independent of MPS, but since the
1429     + * user does not have that system-wide view, they might set a safe, but
1430     + * inefficiently low value. Here we allow writes through to hardware,
1431     + * but we set the floor to the physical device MPS setting, so that
1432     + * we can at least use full TLPs, as defined by the MPS value.
1433     + *
1434     + * NB, if any devices actually depend on an artificially low MRRS
1435     + * setting, this will need to be revisited, perhaps with a quirk
1436     + * though pcie_set_readrq().
1437     + */
1438     + if (readrq != (le16_to_cpu(*ctrl) & PCI_EXP_DEVCTL_READRQ)) {
1439     + readrq = 128 <<
1440     + ((le16_to_cpu(*ctrl) & PCI_EXP_DEVCTL_READRQ) >> 12);
1441     + readrq = max(readrq, pcie_get_mps(vdev->pdev));
1442     +
1443     + pcie_set_readrq(vdev->pdev, readrq);
1444     + }
1445     +
1446     return count;
1447     }
1448    
1449     @@ -853,11 +875,12 @@ static int __init init_pci_cap_exp_perm(struct perm_bits *perm)
1450     * Allow writes to device control fields, except devctl_phantom,
1451     * which could confuse IOMMU, MPS, which can break communication
1452     * with other physical devices, and the ARI bit in devctl2, which
1453     - * is set at probe time. FLR gets virtualized via our writefn.
1454     + * is set at probe time. FLR and MRRS get virtualized via our
1455     + * writefn.
1456     */
1457     p_setw(perm, PCI_EXP_DEVCTL,
1458     - PCI_EXP_DEVCTL_BCR_FLR | PCI_EXP_DEVCTL_PAYLOAD,
1459     - ~PCI_EXP_DEVCTL_PHANTOM);
1460     + PCI_EXP_DEVCTL_BCR_FLR | PCI_EXP_DEVCTL_PAYLOAD |
1461     + PCI_EXP_DEVCTL_READRQ, ~PCI_EXP_DEVCTL_PHANTOM);
1462     p_setw(perm, PCI_EXP_DEVCTL2, NO_VIRT, ~PCI_EXP_DEVCTL2_ARI);
1463     return 0;
1464     }
1465     diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c
1466     index 8658dba21768..e682bf046e50 100644
1467     --- a/drivers/watchdog/f71808e_wdt.c
1468     +++ b/drivers/watchdog/f71808e_wdt.c
1469     @@ -496,7 +496,7 @@ static bool watchdog_is_running(void)
1470    
1471     is_running = (superio_inb(watchdog.sioaddr, SIO_REG_ENABLE) & BIT(0))
1472     && (superio_inb(watchdog.sioaddr, F71808FG_REG_WDT_CONF)
1473     - & F71808FG_FLAG_WD_EN);
1474     + & BIT(F71808FG_FLAG_WD_EN));
1475    
1476     superio_exit(watchdog.sioaddr);
1477    
1478     diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
1479     index a11f73174877..6182d693cf43 100644
1480     --- a/fs/autofs4/root.c
1481     +++ b/fs/autofs4/root.c
1482     @@ -746,7 +746,7 @@ static int autofs4_dir_mkdir(struct inode *dir,
1483    
1484     autofs4_del_active(dentry);
1485    
1486     - inode = autofs4_get_inode(dir->i_sb, S_IFDIR | 0555);
1487     + inode = autofs4_get_inode(dir->i_sb, S_IFDIR | mode);
1488     if (!inode)
1489     return -ENOMEM;
1490     d_add(dentry, inode);
1491     diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
1492     index 7b496a4e650e..4ed4736b5bc6 100644
1493     --- a/fs/cifs/cifsglob.h
1494     +++ b/fs/cifs/cifsglob.h
1495     @@ -1412,6 +1412,7 @@ struct dfs_info3_param {
1496     #define CIFS_FATTR_NEED_REVAL 0x4
1497     #define CIFS_FATTR_INO_COLLISION 0x8
1498     #define CIFS_FATTR_UNKNOWN_NLINK 0x10
1499     +#define CIFS_FATTR_FAKE_ROOT_INO 0x20
1500    
1501     struct cifs_fattr {
1502     u32 cf_flags;
1503     diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
1504     index 7ab5be7944aa..24c19eb94fa3 100644
1505     --- a/fs/cifs/inode.c
1506     +++ b/fs/cifs/inode.c
1507     @@ -701,6 +701,18 @@ cifs_get_file_info(struct file *filp)
1508     return rc;
1509     }
1510    
1511     +/* Simple function to return a 64 bit hash of string. Rarely called */
1512     +static __u64 simple_hashstr(const char *str)
1513     +{
1514     + const __u64 hash_mult = 1125899906842597L; /* a big enough prime */
1515     + __u64 hash = 0;
1516     +
1517     + while (*str)
1518     + hash = (hash + (__u64) *str++) * hash_mult;
1519     +
1520     + return hash;
1521     +}
1522     +
1523     int
1524     cifs_get_inode_info(struct inode **inode, const char *full_path,
1525     FILE_ALL_INFO *data, struct super_block *sb, int xid,
1526     @@ -810,6 +822,14 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
1527     tmprc);
1528     fattr.cf_uniqueid = iunique(sb, ROOT_I);
1529     cifs_autodisable_serverino(cifs_sb);
1530     + } else if ((fattr.cf_uniqueid == 0) &&
1531     + strlen(full_path) == 0) {
1532     + /* some servers ret bad root ino ie 0 */
1533     + cifs_dbg(FYI, "Invalid (0) inodenum\n");
1534     + fattr.cf_flags |=
1535     + CIFS_FATTR_FAKE_ROOT_INO;
1536     + fattr.cf_uniqueid =
1537     + simple_hashstr(tcon->treeName);
1538     }
1539     }
1540     } else
1541     @@ -826,6 +846,16 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
1542     &fattr.cf_uniqueid, data);
1543     if (tmprc)
1544     fattr.cf_uniqueid = CIFS_I(*inode)->uniqueid;
1545     + else if ((fattr.cf_uniqueid == 0) &&
1546     + strlen(full_path) == 0) {
1547     + /*
1548     + * Reuse existing root inode num since
1549     + * inum zero for root causes ls of . and .. to
1550     + * not be returned
1551     + */
1552     + cifs_dbg(FYI, "Srv ret 0 inode num for root\n");
1553     + fattr.cf_uniqueid = CIFS_I(*inode)->uniqueid;
1554     + }
1555     } else
1556     fattr.cf_uniqueid = CIFS_I(*inode)->uniqueid;
1557     }
1558     @@ -887,6 +917,9 @@ cifs_get_inode_info(struct inode **inode, const char *full_path,
1559     }
1560    
1561     cgii_exit:
1562     + if ((*inode) && ((*inode)->i_ino == 0))
1563     + cifs_dbg(FYI, "inode number of zero returned\n");
1564     +
1565     kfree(buf);
1566     cifs_put_tlink(tlink);
1567     return rc;
1568     diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
1569     index e04ec868e37e..176b4b27a27a 100644
1570     --- a/fs/ext4/balloc.c
1571     +++ b/fs/ext4/balloc.c
1572     @@ -242,8 +242,6 @@ static int ext4_init_block_bitmap(struct super_block *sb,
1573     */
1574     ext4_mark_bitmap_end(num_clusters_in_group(sb, block_group),
1575     sb->s_blocksize * 8, bh->b_data);
1576     - ext4_block_bitmap_csum_set(sb, block_group, gdp, bh);
1577     - ext4_group_desc_csum_set(sb, block_group, gdp);
1578     return 0;
1579     }
1580    
1581     @@ -447,6 +445,7 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
1582     err = ext4_init_block_bitmap(sb, bh, block_group, desc);
1583     set_bitmap_uptodate(bh);
1584     set_buffer_uptodate(bh);
1585     + set_buffer_verified(bh);
1586     ext4_unlock_group(sb, block_group);
1587     unlock_buffer(bh);
1588     if (err) {
1589     diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
1590     index 2d94e8524839..79a9a1bddafc 100644
1591     --- a/fs/ext4/ialloc.c
1592     +++ b/fs/ext4/ialloc.c
1593     @@ -63,44 +63,6 @@ void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap)
1594     memset(bitmap + (i >> 3), 0xff, (end_bit - i) >> 3);
1595     }
1596    
1597     -/* Initializes an uninitialized inode bitmap */
1598     -static int ext4_init_inode_bitmap(struct super_block *sb,
1599     - struct buffer_head *bh,
1600     - ext4_group_t block_group,
1601     - struct ext4_group_desc *gdp)
1602     -{
1603     - struct ext4_group_info *grp;
1604     - struct ext4_sb_info *sbi = EXT4_SB(sb);
1605     - J_ASSERT_BH(bh, buffer_locked(bh));
1606     -
1607     - /* If checksum is bad mark all blocks and inodes use to prevent
1608     - * allocation, essentially implementing a per-group read-only flag. */
1609     - if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) {
1610     - grp = ext4_get_group_info(sb, block_group);
1611     - if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp))
1612     - percpu_counter_sub(&sbi->s_freeclusters_counter,
1613     - grp->bb_free);
1614     - set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state);
1615     - if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) {
1616     - int count;
1617     - count = ext4_free_inodes_count(sb, gdp);
1618     - percpu_counter_sub(&sbi->s_freeinodes_counter,
1619     - count);
1620     - }
1621     - set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state);
1622     - return -EFSBADCRC;
1623     - }
1624     -
1625     - memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8);
1626     - ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8,
1627     - bh->b_data);
1628     - ext4_inode_bitmap_csum_set(sb, block_group, gdp, bh,
1629     - EXT4_INODES_PER_GROUP(sb) / 8);
1630     - ext4_group_desc_csum_set(sb, block_group, gdp);
1631     -
1632     - return 0;
1633     -}
1634     -
1635     void ext4_end_bitmap_read(struct buffer_head *bh, int uptodate)
1636     {
1637     if (uptodate) {
1638     @@ -184,17 +146,14 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
1639    
1640     ext4_lock_group(sb, block_group);
1641     if (desc->bg_flags & cpu_to_le16(EXT4_BG_INODE_UNINIT)) {
1642     - err = ext4_init_inode_bitmap(sb, bh, block_group, desc);
1643     + memset(bh->b_data, 0, (EXT4_INODES_PER_GROUP(sb) + 7) / 8);
1644     + ext4_mark_bitmap_end(EXT4_INODES_PER_GROUP(sb),
1645     + sb->s_blocksize * 8, bh->b_data);
1646     set_bitmap_uptodate(bh);
1647     set_buffer_uptodate(bh);
1648     set_buffer_verified(bh);
1649     ext4_unlock_group(sb, block_group);
1650     unlock_buffer(bh);
1651     - if (err) {
1652     - ext4_error(sb, "Failed to init inode bitmap for group "
1653     - "%u: %d", block_group, err);
1654     - goto out;
1655     - }
1656     return bh;
1657     }
1658     ext4_unlock_group(sb, block_group);
1659     diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
1660     index 5cccec68a0a5..340428274532 100644
1661     --- a/fs/ext4/inode.c
1662     +++ b/fs/ext4/inode.c
1663     @@ -3396,7 +3396,6 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
1664     {
1665     struct file *file = iocb->ki_filp;
1666     struct inode *inode = file->f_mapping->host;
1667     - struct ext4_inode_info *ei = EXT4_I(inode);
1668     ssize_t ret;
1669     loff_t offset = iocb->ki_pos;
1670     size_t count = iov_iter_count(iter);
1671     @@ -3420,7 +3419,7 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
1672     goto out;
1673     }
1674     orphan = 1;
1675     - ei->i_disksize = inode->i_size;
1676     + ext4_update_i_disksize(inode, inode->i_size);
1677     ext4_journal_stop(handle);
1678     }
1679    
1680     @@ -3548,7 +3547,7 @@ static ssize_t ext4_direct_IO_write(struct kiocb *iocb, struct iov_iter *iter)
1681     if (ret > 0) {
1682     loff_t end = offset + ret;
1683     if (end > inode->i_size) {
1684     - ei->i_disksize = end;
1685     + ext4_update_i_disksize(inode, end);
1686     i_size_write(inode, end);
1687     /*
1688     * We're going to return a positive `ret'
1689     @@ -4494,6 +4493,12 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
1690     goto bad_inode;
1691     raw_inode = ext4_raw_inode(&iloc);
1692    
1693     + if ((ino == EXT4_ROOT_INO) && (raw_inode->i_links_count == 0)) {
1694     + EXT4_ERROR_INODE(inode, "root inode unallocated");
1695     + ret = -EFSCORRUPTED;
1696     + goto bad_inode;
1697     + }
1698     +
1699     if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
1700     ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
1701     if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
1702     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
1703     index 1ec4b6e34747..bfb83d76d128 100644
1704     --- a/fs/ext4/super.c
1705     +++ b/fs/ext4/super.c
1706     @@ -2260,6 +2260,8 @@ static int ext4_check_descriptors(struct super_block *sb,
1707     ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1708     "Block bitmap for group %u overlaps "
1709     "superblock", i);
1710     + if (!(sb->s_flags & MS_RDONLY))
1711     + return 0;
1712     }
1713     if (block_bitmap < first_block || block_bitmap > last_block) {
1714     ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1715     @@ -2272,6 +2274,8 @@ static int ext4_check_descriptors(struct super_block *sb,
1716     ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1717     "Inode bitmap for group %u overlaps "
1718     "superblock", i);
1719     + if (!(sb->s_flags & MS_RDONLY))
1720     + return 0;
1721     }
1722     if (inode_bitmap < first_block || inode_bitmap > last_block) {
1723     ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1724     @@ -2284,6 +2288,8 @@ static int ext4_check_descriptors(struct super_block *sb,
1725     ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: "
1726     "Inode table for group %u overlaps "
1727     "superblock", i);
1728     + if (!(sb->s_flags & MS_RDONLY))
1729     + return 0;
1730     }
1731     if (inode_table < first_block ||
1732     inode_table + sbi->s_itb_per_group - 1 > last_block) {
1733     diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
1734     index 0703a1179847..3d8b35f28a9b 100644
1735     --- a/fs/fs-writeback.c
1736     +++ b/fs/fs-writeback.c
1737     @@ -745,11 +745,12 @@ int inode_congested(struct inode *inode, int cong_bits)
1738     */
1739     if (inode && inode_to_wb_is_valid(inode)) {
1740     struct bdi_writeback *wb;
1741     - bool locked, congested;
1742     + struct wb_lock_cookie lock_cookie = {};
1743     + bool congested;
1744    
1745     - wb = unlocked_inode_to_wb_begin(inode, &locked);
1746     + wb = unlocked_inode_to_wb_begin(inode, &lock_cookie);
1747     congested = wb_congested(wb, cong_bits);
1748     - unlocked_inode_to_wb_end(inode, locked);
1749     + unlocked_inode_to_wb_end(inode, &lock_cookie);
1750     return congested;
1751     }
1752    
1753     diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
1754     index 047c8ef620fe..542e33d29088 100644
1755     --- a/fs/jbd2/journal.c
1756     +++ b/fs/jbd2/journal.c
1757     @@ -951,7 +951,7 @@ int __jbd2_update_log_tail(journal_t *journal, tid_t tid, unsigned long block)
1758     }
1759    
1760     /*
1761     - * This is a variaon of __jbd2_update_log_tail which checks for validity of
1762     + * This is a variation of __jbd2_update_log_tail which checks for validity of
1763     * provided log tail and locks j_checkpoint_mutex. So it is safe against races
1764     * with other threads updating log tail.
1765     */
1766     @@ -1394,6 +1394,9 @@ int jbd2_journal_update_sb_log_tail(journal_t *journal, tid_t tail_tid,
1767     journal_superblock_t *sb = journal->j_superblock;
1768     int ret;
1769    
1770     + if (is_journal_aborted(journal))
1771     + return -EIO;
1772     +
1773     BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex));
1774     jbd_debug(1, "JBD2: updating superblock (start %lu, seq %u)\n",
1775     tail_block, tail_tid);
1776     diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c
1777     index 5ef21f4c4c77..59c019a148f6 100644
1778     --- a/fs/jffs2/super.c
1779     +++ b/fs/jffs2/super.c
1780     @@ -342,7 +342,7 @@ static void jffs2_put_super (struct super_block *sb)
1781     static void jffs2_kill_sb(struct super_block *sb)
1782     {
1783     struct jffs2_sb_info *c = JFFS2_SB_INFO(sb);
1784     - if (!(sb->s_flags & MS_RDONLY))
1785     + if (c && !(sb->s_flags & MS_RDONLY))
1786     jffs2_stop_garbage_collect_thread(c);
1787     kill_mtd_super(sb);
1788     kfree(c);
1789     diff --git a/fs/namespace.c b/fs/namespace.c
1790     index d7360f9897b4..6c873b330a93 100644
1791     --- a/fs/namespace.c
1792     +++ b/fs/namespace.c
1793     @@ -1033,7 +1033,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
1794     goto out_free;
1795     }
1796    
1797     - mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED);
1798     + mnt->mnt.mnt_flags = old->mnt.mnt_flags;
1799     + mnt->mnt.mnt_flags &= ~(MNT_WRITE_HOLD|MNT_MARKED|MNT_INTERNAL);
1800     /* Don't allow unprivileged users to change mount flags */
1801     if (flag & CL_UNPRIVILEGED) {
1802     mnt->mnt.mnt_flags |= MNT_LOCK_ATIME;
1803     diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c
1804     index e0e5f7c3c99f..8a459b179183 100644
1805     --- a/fs/notify/fanotify/fanotify.c
1806     +++ b/fs/notify/fanotify/fanotify.c
1807     @@ -92,7 +92,7 @@ static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
1808     u32 event_mask,
1809     void *data, int data_type)
1810     {
1811     - __u32 marks_mask, marks_ignored_mask;
1812     + __u32 marks_mask = 0, marks_ignored_mask = 0;
1813     struct path *path = data;
1814    
1815     pr_debug("%s: inode_mark=%p vfsmnt_mark=%p mask=%x data=%p"
1816     @@ -108,24 +108,20 @@ static bool fanotify_should_send_event(struct fsnotify_mark *inode_mark,
1817     !d_can_lookup(path->dentry))
1818     return false;
1819    
1820     - if (inode_mark && vfsmnt_mark) {
1821     - marks_mask = (vfsmnt_mark->mask | inode_mark->mask);
1822     - marks_ignored_mask = (vfsmnt_mark->ignored_mask | inode_mark->ignored_mask);
1823     - } else if (inode_mark) {
1824     - /*
1825     - * if the event is for a child and this inode doesn't care about
1826     - * events on the child, don't send it!
1827     - */
1828     - if ((event_mask & FS_EVENT_ON_CHILD) &&
1829     - !(inode_mark->mask & FS_EVENT_ON_CHILD))
1830     - return false;
1831     - marks_mask = inode_mark->mask;
1832     - marks_ignored_mask = inode_mark->ignored_mask;
1833     - } else if (vfsmnt_mark) {
1834     - marks_mask = vfsmnt_mark->mask;
1835     - marks_ignored_mask = vfsmnt_mark->ignored_mask;
1836     - } else {
1837     - BUG();
1838     + /*
1839     + * if the event is for a child and this inode doesn't care about
1840     + * events on the child, don't send it!
1841     + */
1842     + if (inode_mark &&
1843     + (!(event_mask & FS_EVENT_ON_CHILD) ||
1844     + (inode_mark->mask & FS_EVENT_ON_CHILD))) {
1845     + marks_mask |= inode_mark->mask;
1846     + marks_ignored_mask |= inode_mark->ignored_mask;
1847     + }
1848     +
1849     + if (vfsmnt_mark) {
1850     + marks_mask |= vfsmnt_mark->mask;
1851     + marks_ignored_mask |= vfsmnt_mark->ignored_mask;
1852     }
1853    
1854     if (d_is_dir(path->dentry) &&
1855     diff --git a/fs/orangefs/super.c b/fs/orangefs/super.c
1856     index 629d8c917fa6..6e35ef6521b4 100644
1857     --- a/fs/orangefs/super.c
1858     +++ b/fs/orangefs/super.c
1859     @@ -559,6 +559,11 @@ void orangefs_kill_sb(struct super_block *sb)
1860     /* provided sb cleanup */
1861     kill_anon_super(sb);
1862    
1863     + if (!ORANGEFS_SB(sb)) {
1864     + mutex_lock(&orangefs_request_mutex);
1865     + mutex_unlock(&orangefs_request_mutex);
1866     + return;
1867     + }
1868     /*
1869     * issue the unmount to userspace to tell it to remove the
1870     * dynamic mount info it has for this superblock
1871     diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
1872     index 76108185854e..2a5c4813c47d 100644
1873     --- a/fs/reiserfs/journal.c
1874     +++ b/fs/reiserfs/journal.c
1875     @@ -2640,7 +2640,7 @@ static int journal_init_dev(struct super_block *super,
1876     if (IS_ERR(journal->j_dev_bd)) {
1877     result = PTR_ERR(journal->j_dev_bd);
1878     journal->j_dev_bd = NULL;
1879     - reiserfs_warning(super,
1880     + reiserfs_warning(super, "sh-457",
1881     "journal_init_dev: Cannot open '%s': %i",
1882     jdev_name, result);
1883     return result;
1884     diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
1885     index 4ec051089186..03dda1cbe485 100644
1886     --- a/fs/ubifs/super.c
1887     +++ b/fs/ubifs/super.c
1888     @@ -1728,8 +1728,11 @@ static void ubifs_remount_ro(struct ubifs_info *c)
1889    
1890     dbg_save_space_info(c);
1891    
1892     - for (i = 0; i < c->jhead_cnt; i++)
1893     - ubifs_wbuf_sync(&c->jheads[i].wbuf);
1894     + for (i = 0; i < c->jhead_cnt; i++) {
1895     + err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
1896     + if (err)
1897     + ubifs_ro_mode(c, err);
1898     + }
1899    
1900     c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
1901     c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
1902     @@ -1795,8 +1798,11 @@ static void ubifs_put_super(struct super_block *sb)
1903     int err;
1904    
1905     /* Synchronize write-buffers */
1906     - for (i = 0; i < c->jhead_cnt; i++)
1907     - ubifs_wbuf_sync(&c->jheads[i].wbuf);
1908     + for (i = 0; i < c->jhead_cnt; i++) {
1909     + err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
1910     + if (err)
1911     + ubifs_ro_mode(c, err);
1912     + }
1913    
1914     /*
1915     * We are being cleanly unmounted which means the
1916     diff --git a/fs/udf/unicode.c b/fs/udf/unicode.c
1917     index 695389a4fc23..3a3be23689b3 100644
1918     --- a/fs/udf/unicode.c
1919     +++ b/fs/udf/unicode.c
1920     @@ -28,6 +28,9 @@
1921    
1922     #include "udf_sb.h"
1923    
1924     +#define SURROGATE_MASK 0xfffff800
1925     +#define SURROGATE_PAIR 0x0000d800
1926     +
1927     static int udf_uni2char_utf8(wchar_t uni,
1928     unsigned char *out,
1929     int boundlen)
1930     @@ -37,6 +40,9 @@ static int udf_uni2char_utf8(wchar_t uni,
1931     if (boundlen <= 0)
1932     return -ENAMETOOLONG;
1933    
1934     + if ((uni & SURROGATE_MASK) == SURROGATE_PAIR)
1935     + return -EINVAL;
1936     +
1937     if (uni < 0x80) {
1938     out[u_len++] = (unsigned char)uni;
1939     } else if (uni < 0x800) {
1940     diff --git a/include/dt-bindings/clock/mt2701-clk.h b/include/dt-bindings/clock/mt2701-clk.h
1941     index 2062c67e2e51..a72db8d23ed6 100644
1942     --- a/include/dt-bindings/clock/mt2701-clk.h
1943     +++ b/include/dt-bindings/clock/mt2701-clk.h
1944     @@ -176,7 +176,8 @@
1945     #define CLK_TOP_AUD_EXT1 156
1946     #define CLK_TOP_AUD_EXT2 157
1947     #define CLK_TOP_NFI1X_PAD 158
1948     -#define CLK_TOP_NR 159
1949     +#define CLK_TOP_AXISEL_D4 159
1950     +#define CLK_TOP_NR 160
1951    
1952     /* APMIXEDSYS */
1953    
1954     diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h
1955     index c357f27d5483..32728ff8095c 100644
1956     --- a/include/linux/backing-dev-defs.h
1957     +++ b/include/linux/backing-dev-defs.h
1958     @@ -191,6 +191,11 @@ static inline void set_bdi_congested(struct backing_dev_info *bdi, int sync)
1959     set_wb_congested(bdi->wb.congested, sync);
1960     }
1961    
1962     +struct wb_lock_cookie {
1963     + bool locked;
1964     + unsigned long flags;
1965     +};
1966     +
1967     #ifdef CONFIG_CGROUP_WRITEBACK
1968    
1969     /**
1970     diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
1971     index 43b93a947e61..63f17b106a4a 100644
1972     --- a/include/linux/backing-dev.h
1973     +++ b/include/linux/backing-dev.h
1974     @@ -366,7 +366,7 @@ static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
1975     /**
1976     * unlocked_inode_to_wb_begin - begin unlocked inode wb access transaction
1977     * @inode: target inode
1978     - * @lockedp: temp bool output param, to be passed to the end function
1979     + * @cookie: output param, to be passed to the end function
1980     *
1981     * The caller wants to access the wb associated with @inode but isn't
1982     * holding inode->i_lock, mapping->tree_lock or wb->list_lock. This
1983     @@ -374,12 +374,12 @@ static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
1984     * association doesn't change until the transaction is finished with
1985     * unlocked_inode_to_wb_end().
1986     *
1987     - * The caller must call unlocked_inode_to_wb_end() with *@lockdep
1988     - * afterwards and can't sleep during transaction. IRQ may or may not be
1989     - * disabled on return.
1990     + * The caller must call unlocked_inode_to_wb_end() with *@cookie afterwards and
1991     + * can't sleep during the transaction. IRQs may or may not be disabled on
1992     + * return.
1993     */
1994     static inline struct bdi_writeback *
1995     -unlocked_inode_to_wb_begin(struct inode *inode, bool *lockedp)
1996     +unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
1997     {
1998     rcu_read_lock();
1999    
2000     @@ -387,10 +387,10 @@ unlocked_inode_to_wb_begin(struct inode *inode, bool *lockedp)
2001     * Paired with store_release in inode_switch_wb_work_fn() and
2002     * ensures that we see the new wb if we see cleared I_WB_SWITCH.
2003     */
2004     - *lockedp = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
2005     + cookie->locked = smp_load_acquire(&inode->i_state) & I_WB_SWITCH;
2006    
2007     - if (unlikely(*lockedp))
2008     - spin_lock_irq(&inode->i_mapping->tree_lock);
2009     + if (unlikely(cookie->locked))
2010     + spin_lock_irqsave(&inode->i_mapping->tree_lock, cookie->flags);
2011    
2012     /*
2013     * Protected by either !I_WB_SWITCH + rcu_read_lock() or tree_lock.
2014     @@ -402,12 +402,13 @@ unlocked_inode_to_wb_begin(struct inode *inode, bool *lockedp)
2015     /**
2016     * unlocked_inode_to_wb_end - end inode wb access transaction
2017     * @inode: target inode
2018     - * @locked: *@lockedp from unlocked_inode_to_wb_begin()
2019     + * @cookie: @cookie from unlocked_inode_to_wb_begin()
2020     */
2021     -static inline void unlocked_inode_to_wb_end(struct inode *inode, bool locked)
2022     +static inline void unlocked_inode_to_wb_end(struct inode *inode,
2023     + struct wb_lock_cookie *cookie)
2024     {
2025     - if (unlikely(locked))
2026     - spin_unlock_irq(&inode->i_mapping->tree_lock);
2027     + if (unlikely(cookie->locked))
2028     + spin_unlock_irqrestore(&inode->i_mapping->tree_lock, cookie->flags);
2029    
2030     rcu_read_unlock();
2031     }
2032     @@ -454,12 +455,13 @@ static inline struct bdi_writeback *inode_to_wb(struct inode *inode)
2033     }
2034    
2035     static inline struct bdi_writeback *
2036     -unlocked_inode_to_wb_begin(struct inode *inode, bool *lockedp)
2037     +unlocked_inode_to_wb_begin(struct inode *inode, struct wb_lock_cookie *cookie)
2038     {
2039     return inode_to_wb(inode);
2040     }
2041    
2042     -static inline void unlocked_inode_to_wb_end(struct inode *inode, bool locked)
2043     +static inline void unlocked_inode_to_wb_end(struct inode *inode,
2044     + struct wb_lock_cookie *cookie)
2045     {
2046     }
2047    
2048     diff --git a/include/linux/hid.h b/include/linux/hid.h
2049     index b2ec82712baa..fab65b61d6d4 100644
2050     --- a/include/linux/hid.h
2051     +++ b/include/linux/hid.h
2052     @@ -801,7 +801,7 @@ extern int hidinput_connect(struct hid_device *hid, unsigned int force);
2053     extern void hidinput_disconnect(struct hid_device *);
2054    
2055     int hid_set_field(struct hid_field *, unsigned, __s32);
2056     -int hid_input_report(struct hid_device *, int type, u8 *, int, int);
2057     +int hid_input_report(struct hid_device *, int type, u8 *, u32, int);
2058     int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
2059     struct hid_field *hidinput_get_led_field(struct hid_device *hid);
2060     unsigned int hidinput_count_leds(struct hid_device *hid);
2061     @@ -1106,13 +1106,13 @@ static inline void hid_hw_wait(struct hid_device *hdev)
2062     *
2063     * @report: the report we want to know the length
2064     */
2065     -static inline int hid_report_len(struct hid_report *report)
2066     +static inline u32 hid_report_len(struct hid_report *report)
2067     {
2068     /* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
2069     return ((report->size - 1) >> 3) + 1 + (report->id > 0);
2070     }
2071    
2072     -int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
2073     +int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
2074     int interrupt);
2075    
2076     /* HID quirks API */
2077     diff --git a/include/linux/tty.h b/include/linux/tty.h
2078     index a41244fe58d0..6f1ee8528210 100644
2079     --- a/include/linux/tty.h
2080     +++ b/include/linux/tty.h
2081     @@ -355,6 +355,7 @@ struct tty_file_private {
2082     #define TTY_PTY_LOCK 16 /* pty private */
2083     #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
2084     #define TTY_HUPPED 18 /* Post driver->hangup() */
2085     +#define TTY_HUPPING 19 /* Hangup in progress */
2086     #define TTY_LDISC_HALTED 22 /* Line discipline is halted */
2087    
2088     /* Values for tty->flow_change */
2089     diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
2090     index 760c969d885d..12bbf8c81112 100644
2091     --- a/include/sound/pcm_oss.h
2092     +++ b/include/sound/pcm_oss.h
2093     @@ -57,6 +57,7 @@ struct snd_pcm_oss_runtime {
2094     char *buffer; /* vmallocated period */
2095     size_t buffer_used; /* used length from period buffer */
2096     struct mutex params_lock;
2097     + atomic_t rw_ref; /* concurrent read/write accesses */
2098     #ifdef CONFIG_SND_PCM_OSS_PLUGINS
2099     struct snd_pcm_plugin *plugin_first;
2100     struct snd_pcm_plugin *plugin_last;
2101     diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h
2102     index 3f93d1695e7f..b455b0d86f26 100644
2103     --- a/include/uapi/linux/random.h
2104     +++ b/include/uapi/linux/random.h
2105     @@ -34,6 +34,9 @@
2106     /* Clear the entropy pool and associated counters. (Superuser only.) */
2107     #define RNDCLEARPOOL _IO( 'R', 0x06 )
2108    
2109     +/* Reseed CRNG. (Superuser only.) */
2110     +#define RNDRESEEDCRNG _IO( 'R', 0x07 )
2111     +
2112     struct rand_pool_info {
2113     int entropy_count;
2114     int buf_size;
2115     diff --git a/ipc/shm.c b/ipc/shm.c
2116     index de93d01bfce2..b626745e771c 100644
2117     --- a/ipc/shm.c
2118     +++ b/ipc/shm.c
2119     @@ -198,6 +198,12 @@ static int __shm_open(struct vm_area_struct *vma)
2120     if (IS_ERR(shp))
2121     return PTR_ERR(shp);
2122    
2123     + if (shp->shm_file != sfd->file) {
2124     + /* ID was reused */
2125     + shm_unlock(shp);
2126     + return -EINVAL;
2127     + }
2128     +
2129     shp->shm_atim = get_seconds();
2130     shp->shm_lprid = task_tgid_vnr(current);
2131     shp->shm_nattch++;
2132     @@ -425,8 +431,9 @@ static int shm_mmap(struct file *file, struct vm_area_struct *vma)
2133     int ret;
2134    
2135     /*
2136     - * In case of remap_file_pages() emulation, the file can represent
2137     - * removed IPC ID: propogate shm_lock() error to caller.
2138     + * In case of remap_file_pages() emulation, the file can represent an
2139     + * IPC ID that was removed, and possibly even reused by another shm
2140     + * segment already. Propagate this case as an error to caller.
2141     */
2142     ret =__shm_open(vma);
2143     if (ret)
2144     @@ -450,6 +457,7 @@ static int shm_release(struct inode *ino, struct file *file)
2145     struct shm_file_data *sfd = shm_file_data(file);
2146    
2147     put_ipc_ns(sfd->ns);
2148     + fput(sfd->file);
2149     shm_file_data(file) = NULL;
2150     kfree(sfd);
2151     return 0;
2152     @@ -1212,7 +1220,16 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg,
2153     file->f_mapping = shp->shm_file->f_mapping;
2154     sfd->id = shp->shm_perm.id;
2155     sfd->ns = get_ipc_ns(ns);
2156     - sfd->file = shp->shm_file;
2157     + /*
2158     + * We need to take a reference to the real shm file to prevent the
2159     + * pointer from becoming stale in cases where the lifetime of the outer
2160     + * file extends beyond that of the shm segment. It's not usually
2161     + * possible, but it can happen during remap_file_pages() emulation as
2162     + * that unmaps the memory, then does ->mmap() via file reference only.
2163     + * We'll deny the ->mmap() if the shm segment was since removed, but to
2164     + * detect shm ID reuse we need to compare the file pointers.
2165     + */
2166     + sfd->file = get_file(shp->shm_file);
2167     sfd->vm_ops = NULL;
2168    
2169     err = security_mmap_file(file, prot, flags);
2170     diff --git a/kernel/resource.c b/kernel/resource.c
2171     index 9b5f04404152..7ee3dd1ad2af 100644
2172     --- a/kernel/resource.c
2173     +++ b/kernel/resource.c
2174     @@ -633,7 +633,8 @@ static int __find_resource(struct resource *root, struct resource *old,
2175     alloc.start = constraint->alignf(constraint->alignf_data, &avail,
2176     size, constraint->align);
2177     alloc.end = alloc.start + size - 1;
2178     - if (resource_contains(&avail, &alloc)) {
2179     + if (alloc.start <= alloc.end &&
2180     + resource_contains(&avail, &alloc)) {
2181     new->start = alloc.start;
2182     new->end = alloc.end;
2183     return 0;
2184     diff --git a/mm/filemap.c b/mm/filemap.c
2185     index edfb90e3830c..6d2f561d517c 100644
2186     --- a/mm/filemap.c
2187     +++ b/mm/filemap.c
2188     @@ -616,7 +616,7 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
2189     VM_BUG_ON_PAGE(!PageLocked(new), new);
2190     VM_BUG_ON_PAGE(new->mapping, new);
2191    
2192     - error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
2193     + error = radix_tree_preload(gfp_mask & GFP_RECLAIM_MASK);
2194     if (!error) {
2195     struct address_space *mapping = old->mapping;
2196     void (*freepage)(struct page *);
2197     @@ -672,7 +672,7 @@ static int __add_to_page_cache_locked(struct page *page,
2198     return error;
2199     }
2200    
2201     - error = radix_tree_maybe_preload(gfp_mask & ~__GFP_HIGHMEM);
2202     + error = radix_tree_maybe_preload(gfp_mask & GFP_RECLAIM_MASK);
2203     if (error) {
2204     if (!huge)
2205     mem_cgroup_cancel_charge(page, memcg, false);
2206     @@ -1247,8 +1247,7 @@ struct page *pagecache_get_page(struct address_space *mapping, pgoff_t offset,
2207     if (fgp_flags & FGP_ACCESSED)
2208     __SetPageReferenced(page);
2209    
2210     - err = add_to_page_cache_lru(page, mapping, offset,
2211     - gfp_mask & GFP_RECLAIM_MASK);
2212     + err = add_to_page_cache_lru(page, mapping, offset, gfp_mask);
2213     if (unlikely(err)) {
2214     put_page(page);
2215     page = NULL;
2216     @@ -1996,7 +1995,7 @@ static int page_cache_read(struct file *file, pgoff_t offset, gfp_t gfp_mask)
2217     if (!page)
2218     return -ENOMEM;
2219    
2220     - ret = add_to_page_cache_lru(page, mapping, offset, gfp_mask & GFP_KERNEL);
2221     + ret = add_to_page_cache_lru(page, mapping, offset, gfp_mask);
2222     if (ret == 0)
2223     ret = mapping->a_ops->readpage(file, page);
2224     else if (ret == -EEXIST)
2225     diff --git a/mm/page-writeback.c b/mm/page-writeback.c
2226     index 439cc63ad903..807236aed275 100644
2227     --- a/mm/page-writeback.c
2228     +++ b/mm/page-writeback.c
2229     @@ -2506,13 +2506,13 @@ void account_page_redirty(struct page *page)
2230     if (mapping && mapping_cap_account_dirty(mapping)) {
2231     struct inode *inode = mapping->host;
2232     struct bdi_writeback *wb;
2233     - bool locked;
2234     + struct wb_lock_cookie cookie = {};
2235    
2236     - wb = unlocked_inode_to_wb_begin(inode, &locked);
2237     + wb = unlocked_inode_to_wb_begin(inode, &cookie);
2238     current->nr_dirtied--;
2239     dec_node_page_state(page, NR_DIRTIED);
2240     dec_wb_stat(wb, WB_DIRTIED);
2241     - unlocked_inode_to_wb_end(inode, locked);
2242     + unlocked_inode_to_wb_end(inode, &cookie);
2243     }
2244     }
2245     EXPORT_SYMBOL(account_page_redirty);
2246     @@ -2618,15 +2618,15 @@ void cancel_dirty_page(struct page *page)
2247     if (mapping_cap_account_dirty(mapping)) {
2248     struct inode *inode = mapping->host;
2249     struct bdi_writeback *wb;
2250     - bool locked;
2251     + struct wb_lock_cookie cookie = {};
2252    
2253     lock_page_memcg(page);
2254     - wb = unlocked_inode_to_wb_begin(inode, &locked);
2255     + wb = unlocked_inode_to_wb_begin(inode, &cookie);
2256    
2257     if (TestClearPageDirty(page))
2258     account_page_cleaned(page, mapping, wb);
2259    
2260     - unlocked_inode_to_wb_end(inode, locked);
2261     + unlocked_inode_to_wb_end(inode, &cookie);
2262     unlock_page_memcg(page);
2263     } else {
2264     ClearPageDirty(page);
2265     @@ -2658,7 +2658,7 @@ int clear_page_dirty_for_io(struct page *page)
2266     if (mapping && mapping_cap_account_dirty(mapping)) {
2267     struct inode *inode = mapping->host;
2268     struct bdi_writeback *wb;
2269     - bool locked;
2270     + struct wb_lock_cookie cookie = {};
2271    
2272     /*
2273     * Yes, Virginia, this is indeed insane.
2274     @@ -2695,7 +2695,7 @@ int clear_page_dirty_for_io(struct page *page)
2275     * always locked coming in here, so we get the desired
2276     * exclusion.
2277     */
2278     - wb = unlocked_inode_to_wb_begin(inode, &locked);
2279     + wb = unlocked_inode_to_wb_begin(inode, &cookie);
2280     if (TestClearPageDirty(page)) {
2281     mem_cgroup_dec_page_stat(page, MEM_CGROUP_STAT_DIRTY);
2282     dec_node_page_state(page, NR_FILE_DIRTY);
2283     @@ -2703,7 +2703,7 @@ int clear_page_dirty_for_io(struct page *page)
2284     dec_wb_stat(wb, WB_RECLAIMABLE);
2285     ret = 1;
2286     }
2287     - unlocked_inode_to_wb_end(inode, locked);
2288     + unlocked_inode_to_wb_end(inode, &cookie);
2289     return ret;
2290     }
2291     return TestClearPageDirty(page);
2292     diff --git a/mm/slab.c b/mm/slab.c
2293     index 1f82d16a0518..c59844dbd034 100644
2294     --- a/mm/slab.c
2295     +++ b/mm/slab.c
2296     @@ -4096,7 +4096,8 @@ static void cache_reap(struct work_struct *w)
2297     next_reap_node();
2298     out:
2299     /* Set up the next iteration */
2300     - schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_AC));
2301     + schedule_delayed_work_on(smp_processor_id(), work,
2302     + round_jiffies_relative(REAPTIMEOUT_AC));
2303     }
2304    
2305     #ifdef CONFIG_SLABINFO
2306     diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
2307     index 61a504fb1ae2..34f94052c519 100644
2308     --- a/net/sunrpc/rpc_pipe.c
2309     +++ b/net/sunrpc/rpc_pipe.c
2310     @@ -1375,6 +1375,7 @@ rpc_gssd_dummy_depopulate(struct dentry *pipe_dentry)
2311     struct dentry *clnt_dir = pipe_dentry->d_parent;
2312     struct dentry *gssd_dir = clnt_dir->d_parent;
2313    
2314     + dget(pipe_dentry);
2315     __rpc_rmpipe(d_inode(clnt_dir), pipe_dentry);
2316     __rpc_depopulate(clnt_dir, gssd_dummy_info_file, 0, 1);
2317     __rpc_depopulate(gssd_dir, gssd_dummy_clnt_dir, 0, 1);
2318     diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
2319     index fa8741afadf5..cfb8f5896787 100644
2320     --- a/sound/core/oss/pcm_oss.c
2321     +++ b/sound/core/oss/pcm_oss.c
2322     @@ -834,8 +834,25 @@ static int choose_rate(struct snd_pcm_substream *substream,
2323     return snd_pcm_hw_param_near(substream, params, SNDRV_PCM_HW_PARAM_RATE, best_rate, NULL);
2324     }
2325    
2326     -static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream,
2327     - bool trylock)
2328     +/* parameter locking: returns immediately if tried during streaming */
2329     +static int lock_params(struct snd_pcm_runtime *runtime)
2330     +{
2331     + if (mutex_lock_interruptible(&runtime->oss.params_lock))
2332     + return -ERESTARTSYS;
2333     + if (atomic_read(&runtime->oss.rw_ref)) {
2334     + mutex_unlock(&runtime->oss.params_lock);
2335     + return -EBUSY;
2336     + }
2337     + return 0;
2338     +}
2339     +
2340     +static void unlock_params(struct snd_pcm_runtime *runtime)
2341     +{
2342     + mutex_unlock(&runtime->oss.params_lock);
2343     +}
2344     +
2345     +/* call with params_lock held */
2346     +static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
2347     {
2348     struct snd_pcm_runtime *runtime = substream->runtime;
2349     struct snd_pcm_hw_params *params, *sparams;
2350     @@ -849,11 +866,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream,
2351     struct snd_mask sformat_mask;
2352     struct snd_mask mask;
2353    
2354     - if (trylock) {
2355     - if (!(mutex_trylock(&runtime->oss.params_lock)))
2356     - return -EAGAIN;
2357     - } else if (mutex_lock_interruptible(&runtime->oss.params_lock))
2358     - return -EINTR;
2359     + if (!runtime->oss.params)
2360     + return 0;
2361     sw_params = kzalloc(sizeof(*sw_params), GFP_KERNEL);
2362     params = kmalloc(sizeof(*params), GFP_KERNEL);
2363     sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
2364     @@ -1079,6 +1093,23 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream,
2365     kfree(sw_params);
2366     kfree(params);
2367     kfree(sparams);
2368     + return err;
2369     +}
2370     +
2371     +/* this one takes the lock by itself */
2372     +static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream,
2373     + bool trylock)
2374     +{
2375     + struct snd_pcm_runtime *runtime = substream->runtime;
2376     + int err;
2377     +
2378     + if (trylock) {
2379     + if (!(mutex_trylock(&runtime->oss.params_lock)))
2380     + return -EAGAIN;
2381     + } else if (mutex_lock_interruptible(&runtime->oss.params_lock))
2382     + return -ERESTARTSYS;
2383     +
2384     + err = snd_pcm_oss_change_params_locked(substream);
2385     mutex_unlock(&runtime->oss.params_lock);
2386     return err;
2387     }
2388     @@ -1107,6 +1138,10 @@ static int snd_pcm_oss_get_active_substream(struct snd_pcm_oss_file *pcm_oss_fil
2389     return 0;
2390     }
2391    
2392     +/* call with params_lock held */
2393     +/* NOTE: this always call PREPARE unconditionally no matter whether
2394     + * runtime->oss.prepare is set or not
2395     + */
2396     static int snd_pcm_oss_prepare(struct snd_pcm_substream *substream)
2397     {
2398     int err;
2399     @@ -1131,14 +1166,35 @@ static int snd_pcm_oss_make_ready(struct snd_pcm_substream *substream)
2400     struct snd_pcm_runtime *runtime;
2401     int err;
2402    
2403     - if (substream == NULL)
2404     - return 0;
2405     runtime = substream->runtime;
2406     if (runtime->oss.params) {
2407     err = snd_pcm_oss_change_params(substream, false);
2408     if (err < 0)
2409     return err;
2410     }
2411     + if (runtime->oss.prepare) {
2412     + if (mutex_lock_interruptible(&runtime->oss.params_lock))
2413     + return -ERESTARTSYS;
2414     + err = snd_pcm_oss_prepare(substream);
2415     + mutex_unlock(&runtime->oss.params_lock);
2416     + if (err < 0)
2417     + return err;
2418     + }
2419     + return 0;
2420     +}
2421     +
2422     +/* call with params_lock held */
2423     +static int snd_pcm_oss_make_ready_locked(struct snd_pcm_substream *substream)
2424     +{
2425     + struct snd_pcm_runtime *runtime;
2426     + int err;
2427     +
2428     + runtime = substream->runtime;
2429     + if (runtime->oss.params) {
2430     + err = snd_pcm_oss_change_params_locked(substream);
2431     + if (err < 0)
2432     + return err;
2433     + }
2434     if (runtime->oss.prepare) {
2435     err = snd_pcm_oss_prepare(substream);
2436     if (err < 0)
2437     @@ -1367,13 +1423,15 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
2438     if (atomic_read(&substream->mmap_count))
2439     return -ENXIO;
2440    
2441     - if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
2442     - return tmp;
2443     + atomic_inc(&runtime->oss.rw_ref);
2444     while (bytes > 0) {
2445     if (mutex_lock_interruptible(&runtime->oss.params_lock)) {
2446     tmp = -ERESTARTSYS;
2447     break;
2448     }
2449     + tmp = snd_pcm_oss_make_ready_locked(substream);
2450     + if (tmp < 0)
2451     + goto err;
2452     if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
2453     tmp = bytes;
2454     if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes)
2455     @@ -1429,6 +1487,7 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
2456     }
2457     tmp = 0;
2458     }
2459     + atomic_dec(&runtime->oss.rw_ref);
2460     return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
2461     }
2462    
2463     @@ -1474,13 +1533,15 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
2464     if (atomic_read(&substream->mmap_count))
2465     return -ENXIO;
2466    
2467     - if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
2468     - return tmp;
2469     + atomic_inc(&runtime->oss.rw_ref);
2470     while (bytes > 0) {
2471     if (mutex_lock_interruptible(&runtime->oss.params_lock)) {
2472     tmp = -ERESTARTSYS;
2473     break;
2474     }
2475     + tmp = snd_pcm_oss_make_ready_locked(substream);
2476     + if (tmp < 0)
2477     + goto err;
2478     if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
2479     if (runtime->oss.buffer_used == 0) {
2480     tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
2481     @@ -1521,6 +1582,7 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
2482     }
2483     tmp = 0;
2484     }
2485     + atomic_dec(&runtime->oss.rw_ref);
2486     return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
2487     }
2488    
2489     @@ -1536,10 +1598,12 @@ static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
2490     continue;
2491     runtime = substream->runtime;
2492     snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
2493     + mutex_lock(&runtime->oss.params_lock);
2494     runtime->oss.prepare = 1;
2495     runtime->oss.buffer_used = 0;
2496     runtime->oss.prev_hw_ptr_period = 0;
2497     runtime->oss.period_ptr = 0;
2498     + mutex_unlock(&runtime->oss.params_lock);
2499     }
2500     return 0;
2501     }
2502     @@ -1625,9 +1689,13 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2503     goto __direct;
2504     if ((err = snd_pcm_oss_make_ready(substream)) < 0)
2505     return err;
2506     + atomic_inc(&runtime->oss.rw_ref);
2507     + if (mutex_lock_interruptible(&runtime->oss.params_lock)) {
2508     + atomic_dec(&runtime->oss.rw_ref);
2509     + return -ERESTARTSYS;
2510     + }
2511     format = snd_pcm_oss_format_from(runtime->oss.format);
2512     width = snd_pcm_format_physical_width(format);
2513     - mutex_lock(&runtime->oss.params_lock);
2514     if (runtime->oss.buffer_used > 0) {
2515     #ifdef OSS_DEBUG
2516     pcm_dbg(substream->pcm, "sync: buffer_used\n");
2517     @@ -1637,10 +1705,8 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2518     runtime->oss.buffer + runtime->oss.buffer_used,
2519     size);
2520     err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
2521     - if (err < 0) {
2522     - mutex_unlock(&runtime->oss.params_lock);
2523     - return err;
2524     - }
2525     + if (err < 0)
2526     + goto unlock;
2527     } else if (runtime->oss.period_ptr > 0) {
2528     #ifdef OSS_DEBUG
2529     pcm_dbg(substream->pcm, "sync: period_ptr\n");
2530     @@ -1650,10 +1716,8 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2531     runtime->oss.buffer,
2532     size * 8 / width);
2533     err = snd_pcm_oss_sync1(substream, size);
2534     - if (err < 0) {
2535     - mutex_unlock(&runtime->oss.params_lock);
2536     - return err;
2537     - }
2538     + if (err < 0)
2539     + goto unlock;
2540     }
2541     /*
2542     * The ALSA's period might be a bit large than OSS one.
2543     @@ -1684,7 +1748,11 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2544     snd_pcm_lib_writev(substream, buffers, size);
2545     }
2546     }
2547     +unlock:
2548     mutex_unlock(&runtime->oss.params_lock);
2549     + atomic_dec(&runtime->oss.rw_ref);
2550     + if (err < 0)
2551     + return err;
2552     /*
2553     * finish sync: drain the buffer
2554     */
2555     @@ -1695,7 +1763,9 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2556     substream->f_flags = saved_f_flags;
2557     if (err < 0)
2558     return err;
2559     + mutex_lock(&runtime->oss.params_lock);
2560     runtime->oss.prepare = 1;
2561     + mutex_unlock(&runtime->oss.params_lock);
2562     }
2563    
2564     substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
2565     @@ -1706,8 +1776,10 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
2566     err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DROP, NULL);
2567     if (err < 0)
2568     return err;
2569     + mutex_lock(&runtime->oss.params_lock);
2570     runtime->oss.buffer_used = 0;
2571     runtime->oss.prepare = 1;
2572     + mutex_unlock(&runtime->oss.params_lock);
2573     }
2574     return 0;
2575     }
2576     @@ -1719,6 +1791,8 @@ static int snd_pcm_oss_set_rate(struct snd_pcm_oss_file *pcm_oss_file, int rate)
2577     for (idx = 1; idx >= 0; --idx) {
2578     struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
2579     struct snd_pcm_runtime *runtime;
2580     + int err;
2581     +
2582     if (substream == NULL)
2583     continue;
2584     runtime = substream->runtime;
2585     @@ -1726,10 +1800,14 @@ static int snd_pcm_oss_set_rate(struct snd_pcm_oss_file *pcm_oss_file, int rate)
2586     rate = 1000;
2587     else if (rate > 192000)
2588     rate = 192000;
2589     + err = lock_params(runtime);
2590     + if (err < 0)
2591     + return err;
2592     if (runtime->oss.rate != rate) {
2593     runtime->oss.params = 1;
2594     runtime->oss.rate = rate;
2595     }
2596     + unlock_params(runtime);
2597     }
2598     return snd_pcm_oss_get_rate(pcm_oss_file);
2599     }
2600     @@ -1754,13 +1832,19 @@ static int snd_pcm_oss_set_channels(struct snd_pcm_oss_file *pcm_oss_file, unsig
2601     for (idx = 1; idx >= 0; --idx) {
2602     struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
2603     struct snd_pcm_runtime *runtime;
2604     + int err;
2605     +
2606     if (substream == NULL)
2607     continue;
2608     runtime = substream->runtime;
2609     + err = lock_params(runtime);
2610     + if (err < 0)
2611     + return err;
2612     if (runtime->oss.channels != channels) {
2613     runtime->oss.params = 1;
2614     runtime->oss.channels = channels;
2615     }
2616     + unlock_params(runtime);
2617     }
2618     return snd_pcm_oss_get_channels(pcm_oss_file);
2619     }
2620     @@ -1833,6 +1917,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
2621     static int snd_pcm_oss_set_format(struct snd_pcm_oss_file *pcm_oss_file, int format)
2622     {
2623     int formats, idx;
2624     + int err;
2625    
2626     if (format != AFMT_QUERY) {
2627     formats = snd_pcm_oss_get_formats(pcm_oss_file);
2628     @@ -1846,10 +1931,14 @@ static int snd_pcm_oss_set_format(struct snd_pcm_oss_file *pcm_oss_file, int for
2629     if (substream == NULL)
2630     continue;
2631     runtime = substream->runtime;
2632     + err = lock_params(runtime);
2633     + if (err < 0)
2634     + return err;
2635     if (runtime->oss.format != format) {
2636     runtime->oss.params = 1;
2637     runtime->oss.format = format;
2638     }
2639     + unlock_params(runtime);
2640     }
2641     }
2642     return snd_pcm_oss_get_format(pcm_oss_file);
2643     @@ -1869,8 +1958,6 @@ static int snd_pcm_oss_set_subdivide1(struct snd_pcm_substream *substream, int s
2644     {
2645     struct snd_pcm_runtime *runtime;
2646    
2647     - if (substream == NULL)
2648     - return 0;
2649     runtime = substream->runtime;
2650     if (subdivide == 0) {
2651     subdivide = runtime->oss.subdivision;
2652     @@ -1894,9 +1981,17 @@ static int snd_pcm_oss_set_subdivide(struct snd_pcm_oss_file *pcm_oss_file, int
2653    
2654     for (idx = 1; idx >= 0; --idx) {
2655     struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
2656     + struct snd_pcm_runtime *runtime;
2657     +
2658     if (substream == NULL)
2659     continue;
2660     - if ((err = snd_pcm_oss_set_subdivide1(substream, subdivide)) < 0)
2661     + runtime = substream->runtime;
2662     + err = lock_params(runtime);
2663     + if (err < 0)
2664     + return err;
2665     + err = snd_pcm_oss_set_subdivide1(substream, subdivide);
2666     + unlock_params(runtime);
2667     + if (err < 0)
2668     return err;
2669     }
2670     return err;
2671     @@ -1906,8 +2001,6 @@ static int snd_pcm_oss_set_fragment1(struct snd_pcm_substream *substream, unsign
2672     {
2673     struct snd_pcm_runtime *runtime;
2674    
2675     - if (substream == NULL)
2676     - return 0;
2677     runtime = substream->runtime;
2678     if (runtime->oss.subdivision || runtime->oss.fragshift)
2679     return -EINVAL;
2680     @@ -1927,9 +2020,17 @@ static int snd_pcm_oss_set_fragment(struct snd_pcm_oss_file *pcm_oss_file, unsig
2681    
2682     for (idx = 1; idx >= 0; --idx) {
2683     struct snd_pcm_substream *substream = pcm_oss_file->streams[idx];
2684     + struct snd_pcm_runtime *runtime;
2685     +
2686     if (substream == NULL)
2687     continue;
2688     - if ((err = snd_pcm_oss_set_fragment1(substream, val)) < 0)
2689     + runtime = substream->runtime;
2690     + err = lock_params(runtime);
2691     + if (err < 0)
2692     + return err;
2693     + err = snd_pcm_oss_set_fragment1(substream, val);
2694     + unlock_params(runtime);
2695     + if (err < 0)
2696     return err;
2697     }
2698     return err;
2699     @@ -2013,6 +2114,9 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
2700     }
2701     if (psubstream) {
2702     runtime = psubstream->runtime;
2703     + cmd = 0;
2704     + if (mutex_lock_interruptible(&runtime->oss.params_lock))
2705     + return -ERESTARTSYS;
2706     if (trigger & PCM_ENABLE_OUTPUT) {
2707     if (runtime->oss.trigger)
2708     goto _skip1;
2709     @@ -2030,13 +2134,19 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
2710     cmd = SNDRV_PCM_IOCTL_DROP;
2711     runtime->oss.prepare = 1;
2712     }
2713     - err = snd_pcm_kernel_ioctl(psubstream, cmd, NULL);
2714     - if (err < 0)
2715     - return err;
2716     - }
2717     _skip1:
2718     + mutex_unlock(&runtime->oss.params_lock);
2719     + if (cmd) {
2720     + err = snd_pcm_kernel_ioctl(psubstream, cmd, NULL);
2721     + if (err < 0)
2722     + return err;
2723     + }
2724     + }
2725     if (csubstream) {
2726     runtime = csubstream->runtime;
2727     + cmd = 0;
2728     + if (mutex_lock_interruptible(&runtime->oss.params_lock))
2729     + return -ERESTARTSYS;
2730     if (trigger & PCM_ENABLE_INPUT) {
2731     if (runtime->oss.trigger)
2732     goto _skip2;
2733     @@ -2051,11 +2161,14 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int tr
2734     cmd = SNDRV_PCM_IOCTL_DROP;
2735     runtime->oss.prepare = 1;
2736     }
2737     - err = snd_pcm_kernel_ioctl(csubstream, cmd, NULL);
2738     - if (err < 0)
2739     - return err;
2740     - }
2741     _skip2:
2742     + mutex_unlock(&runtime->oss.params_lock);
2743     + if (cmd) {
2744     + err = snd_pcm_kernel_ioctl(csubstream, cmd, NULL);
2745     + if (err < 0)
2746     + return err;
2747     + }
2748     + }
2749     return 0;
2750     }
2751    
2752     @@ -2307,6 +2420,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
2753     runtime->oss.maxfrags = 0;
2754     runtime->oss.subdivision = 0;
2755     substream->pcm_release = snd_pcm_oss_release_substream;
2756     + atomic_set(&runtime->oss.rw_ref, 0);
2757     }
2758    
2759     static int snd_pcm_oss_release_file(struct snd_pcm_oss_file *pcm_oss_file)
2760     diff --git a/sound/core/pcm.c b/sound/core/pcm.c
2761     index 074363b63cc4..6bda8f6c5f84 100644
2762     --- a/sound/core/pcm.c
2763     +++ b/sound/core/pcm.c
2764     @@ -28,6 +28,7 @@
2765     #include <sound/core.h>
2766     #include <sound/minors.h>
2767     #include <sound/pcm.h>
2768     +#include <sound/timer.h>
2769     #include <sound/control.h>
2770     #include <sound/info.h>
2771    
2772     @@ -1025,8 +1026,13 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
2773     snd_free_pages((void*)runtime->control,
2774     PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
2775     kfree(runtime->hw_constraints.rules);
2776     - kfree(runtime);
2777     + /* Avoid concurrent access to runtime via PCM timer interface */
2778     + if (substream->timer)
2779     + spin_lock_irq(&substream->timer->lock);
2780     substream->runtime = NULL;
2781     + if (substream->timer)
2782     + spin_unlock_irq(&substream->timer->lock);
2783     + kfree(runtime);
2784     put_pid(substream->pid);
2785     substream->pid = NULL;
2786     substream->pstr->substream_opened--;
2787     diff --git a/sound/core/rawmidi_compat.c b/sound/core/rawmidi_compat.c
2788     index f69764d7cdd7..e30e30ba6e39 100644
2789     --- a/sound/core/rawmidi_compat.c
2790     +++ b/sound/core/rawmidi_compat.c
2791     @@ -36,8 +36,6 @@ static int snd_rawmidi_ioctl_params_compat(struct snd_rawmidi_file *rfile,
2792     struct snd_rawmidi_params params;
2793     unsigned int val;
2794    
2795     - if (rfile->output == NULL)
2796     - return -EINVAL;
2797     if (get_user(params.stream, &src->stream) ||
2798     get_user(params.buffer_size, &src->buffer_size) ||
2799     get_user(params.avail_min, &src->avail_min) ||
2800     @@ -46,8 +44,12 @@ static int snd_rawmidi_ioctl_params_compat(struct snd_rawmidi_file *rfile,
2801     params.no_active_sensing = val;
2802     switch (params.stream) {
2803     case SNDRV_RAWMIDI_STREAM_OUTPUT:
2804     + if (!rfile->output)
2805     + return -EINVAL;
2806     return snd_rawmidi_output_params(rfile->output, &params);
2807     case SNDRV_RAWMIDI_STREAM_INPUT:
2808     + if (!rfile->input)
2809     + return -EINVAL;
2810     return snd_rawmidi_input_params(rfile->input, &params);
2811     }
2812     return -EINVAL;
2813     @@ -67,16 +69,18 @@ static int snd_rawmidi_ioctl_status_compat(struct snd_rawmidi_file *rfile,
2814     int err;
2815     struct snd_rawmidi_status status;
2816    
2817     - if (rfile->output == NULL)
2818     - return -EINVAL;
2819     if (get_user(status.stream, &src->stream))
2820     return -EFAULT;
2821    
2822     switch (status.stream) {
2823     case SNDRV_RAWMIDI_STREAM_OUTPUT:
2824     + if (!rfile->output)
2825     + return -EINVAL;
2826     err = snd_rawmidi_output_status(rfile->output, &status);
2827     break;
2828     case SNDRV_RAWMIDI_STREAM_INPUT:
2829     + if (!rfile->input)
2830     + return -EINVAL;
2831     err = snd_rawmidi_input_status(rfile->input, &status);
2832     break;
2833     default:
2834     @@ -112,16 +116,18 @@ static int snd_rawmidi_ioctl_status_x32(struct snd_rawmidi_file *rfile,
2835     int err;
2836     struct snd_rawmidi_status status;
2837    
2838     - if (rfile->output == NULL)
2839     - return -EINVAL;
2840     if (get_user(status.stream, &src->stream))
2841     return -EFAULT;
2842    
2843     switch (status.stream) {
2844     case SNDRV_RAWMIDI_STREAM_OUTPUT:
2845     + if (!rfile->output)
2846     + return -EINVAL;
2847     err = snd_rawmidi_output_status(rfile->output, &status);
2848     break;
2849     case SNDRV_RAWMIDI_STREAM_INPUT:
2850     + if (!rfile->input)
2851     + return -EINVAL;
2852     err = snd_rawmidi_input_status(rfile->input, &status);
2853     break;
2854     default:
2855     diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
2856     index 733b3423baa2..7d3f88d90eec 100644
2857     --- a/sound/pci/hda/hda_intel.c
2858     +++ b/sound/pci/hda/hda_intel.c
2859     @@ -1514,7 +1514,8 @@ static void azx_check_snoop_available(struct azx *chip)
2860     */
2861     u8 val;
2862     pci_read_config_byte(chip->pci, 0x42, &val);
2863     - if (!(val & 0x80) && chip->pci->revision == 0x30)
2864     + if (!(val & 0x80) && (chip->pci->revision == 0x30 ||
2865     + chip->pci->revision == 0x20))
2866     snoop = false;
2867     }
2868    
2869     diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
2870     index 993bde29ca1b..7693e63078b1 100644
2871     --- a/sound/soc/codecs/ssm2602.c
2872     +++ b/sound/soc/codecs/ssm2602.c
2873     @@ -54,10 +54,17 @@ struct ssm2602_priv {
2874     * using 2 wire for device control, so we cache them instead.
2875     * There is no point in caching the reset register
2876     */
2877     -static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = {
2878     - 0x0097, 0x0097, 0x0079, 0x0079,
2879     - 0x000a, 0x0008, 0x009f, 0x000a,
2880     - 0x0000, 0x0000
2881     +static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = {
2882     + { .reg = 0x00, .def = 0x0097 },
2883     + { .reg = 0x01, .def = 0x0097 },
2884     + { .reg = 0x02, .def = 0x0079 },
2885     + { .reg = 0x03, .def = 0x0079 },
2886     + { .reg = 0x04, .def = 0x000a },
2887     + { .reg = 0x05, .def = 0x0008 },
2888     + { .reg = 0x06, .def = 0x009f },
2889     + { .reg = 0x07, .def = 0x000a },
2890     + { .reg = 0x08, .def = 0x0000 },
2891     + { .reg = 0x09, .def = 0x0000 }
2892     };
2893    
2894    
2895     @@ -620,8 +627,8 @@ const struct regmap_config ssm2602_regmap_config = {
2896     .volatile_reg = ssm2602_register_volatile,
2897    
2898     .cache_type = REGCACHE_RBTREE,
2899     - .reg_defaults_raw = ssm2602_reg,
2900     - .num_reg_defaults_raw = ARRAY_SIZE(ssm2602_reg),
2901     + .reg_defaults = ssm2602_reg,
2902     + .num_reg_defaults = ARRAY_SIZE(ssm2602_reg),
2903     };
2904     EXPORT_SYMBOL_GPL(ssm2602_regmap_config);
2905    
2906     diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
2907     index d0fb2f205bd9..4f4ebe90f1a8 100644
2908     --- a/sound/usb/line6/midi.c
2909     +++ b/sound/usb/line6/midi.c
2910     @@ -125,7 +125,7 @@ static int send_midi_async(struct usb_line6 *line6, unsigned char *data,
2911     }
2912    
2913     usb_fill_int_urb(urb, line6->usbdev,
2914     - usb_sndbulkpipe(line6->usbdev,
2915     + usb_sndintpipe(line6->usbdev,
2916     line6->properties->ep_ctrl_w),
2917     transfer_buffer, length, midi_sent, line6,
2918     line6->interval);