Magellan Linux

Annotation of /trunk/kernel-alx/patches-4.9/0261-4.9.162-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3314 - (hide annotations) (download)
Tue Mar 12 10:43:18 2019 UTC (5 years, 2 months ago) by niro
File size: 28454 byte(s)
-linux-4.9.162
1 niro 3314 diff --git a/Makefile b/Makefile
2     index 239b74a7147b5..fce163d091393 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 4
7     PATCHLEVEL = 9
8     -SUBLEVEL = 161
9     +SUBLEVEL = 162
10     EXTRAVERSION =
11     NAME = Roaring Lionus
12    
13     diff --git a/arch/arc/include/asm/bitops.h b/arch/arc/include/asm/bitops.h
14     index 8da87feec59aa..99e6d8948f4ac 100644
15     --- a/arch/arc/include/asm/bitops.h
16     +++ b/arch/arc/include/asm/bitops.h
17     @@ -340,7 +340,7 @@ static inline __attribute__ ((const)) int __fls(unsigned long x)
18     /*
19     * __ffs: Similar to ffs, but zero based (0-31)
20     */
21     -static inline __attribute__ ((const)) int __ffs(unsigned long word)
22     +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long word)
23     {
24     if (!word)
25     return word;
26     @@ -400,9 +400,9 @@ static inline __attribute__ ((const)) int ffs(unsigned long x)
27     /*
28     * __ffs: Similar to ffs, but zero based (0-31)
29     */
30     -static inline __attribute__ ((const)) int __ffs(unsigned long x)
31     +static inline __attribute__ ((const)) unsigned long __ffs(unsigned long x)
32     {
33     - int n;
34     + unsigned long n;
35    
36     asm volatile(
37     " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */
38     diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
39     index 334459ad145b4..90863245df53b 100644
40     --- a/arch/powerpc/include/asm/epapr_hcalls.h
41     +++ b/arch/powerpc/include/asm/epapr_hcalls.h
42     @@ -508,7 +508,7 @@ static unsigned long epapr_hypercall(unsigned long *in,
43    
44     static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
45     {
46     - unsigned long in[8];
47     + unsigned long in[8] = {0};
48     unsigned long out[8];
49     unsigned long r;
50    
51     @@ -520,7 +520,7 @@ static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
52    
53     static inline long epapr_hypercall0(unsigned int nr)
54     {
55     - unsigned long in[8];
56     + unsigned long in[8] = {0};
57     unsigned long out[8];
58    
59     return epapr_hypercall(in, out, nr);
60     @@ -528,7 +528,7 @@ static inline long epapr_hypercall0(unsigned int nr)
61    
62     static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
63     {
64     - unsigned long in[8];
65     + unsigned long in[8] = {0};
66     unsigned long out[8];
67    
68     in[0] = p1;
69     @@ -538,7 +538,7 @@ static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
70     static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
71     unsigned long p2)
72     {
73     - unsigned long in[8];
74     + unsigned long in[8] = {0};
75     unsigned long out[8];
76    
77     in[0] = p1;
78     @@ -549,7 +549,7 @@ static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
79     static inline long epapr_hypercall3(unsigned int nr, unsigned long p1,
80     unsigned long p2, unsigned long p3)
81     {
82     - unsigned long in[8];
83     + unsigned long in[8] = {0};
84     unsigned long out[8];
85    
86     in[0] = p1;
87     @@ -562,7 +562,7 @@ static inline long epapr_hypercall4(unsigned int nr, unsigned long p1,
88     unsigned long p2, unsigned long p3,
89     unsigned long p4)
90     {
91     - unsigned long in[8];
92     + unsigned long in[8] = {0};
93     unsigned long out[8];
94    
95     in[0] = p1;
96     diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h
97     index a8d85a687cf46..2177c7551ff77 100644
98     --- a/arch/x86/include/asm/uaccess.h
99     +++ b/arch/x86/include/asm/uaccess.h
100     @@ -292,8 +292,7 @@ do { \
101     __put_user_asm(x, ptr, retval, "l", "k", "ir", errret); \
102     break; \
103     case 8: \
104     - __put_user_asm_u64((__typeof__(*ptr))(x), ptr, retval, \
105     - errret); \
106     + __put_user_asm_u64(x, ptr, retval, errret); \
107     break; \
108     default: \
109     __put_user_bad(); \
110     @@ -427,8 +426,10 @@ do { \
111     #define __put_user_nocheck(x, ptr, size) \
112     ({ \
113     int __pu_err; \
114     + __typeof__(*(ptr)) __pu_val; \
115     + __pu_val = x; \
116     __uaccess_begin(); \
117     - __put_user_size((x), (ptr), (size), __pu_err, -EFAULT); \
118     + __put_user_size(__pu_val, (ptr), (size), __pu_err, -EFAULT);\
119     __uaccess_end(); \
120     __builtin_expect(__pu_err, 0); \
121     })
122     diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
123     index c8efacf2e65f1..01eb0451b96d3 100644
124     --- a/arch/x86/kvm/svm.c
125     +++ b/arch/x86/kvm/svm.c
126     @@ -2862,6 +2862,14 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
127     kvm_mmu_reset_context(&svm->vcpu);
128     kvm_mmu_load(&svm->vcpu);
129    
130     + /*
131     + * Drop what we picked up for L2 via svm_complete_interrupts() so it
132     + * doesn't end up in L1.
133     + */
134     + svm->vcpu.arch.nmi_injected = false;
135     + kvm_clear_exception_queue(&svm->vcpu);
136     + kvm_clear_interrupt_queue(&svm->vcpu);
137     +
138     return 0;
139     }
140    
141     @@ -3932,25 +3940,14 @@ static int avic_incomplete_ipi_interception(struct vcpu_svm *svm)
142     kvm_lapic_reg_write(apic, APIC_ICR, icrl);
143     break;
144     case AVIC_IPI_FAILURE_TARGET_NOT_RUNNING: {
145     - int i;
146     - struct kvm_vcpu *vcpu;
147     - struct kvm *kvm = svm->vcpu.kvm;
148     struct kvm_lapic *apic = svm->vcpu.arch.apic;
149    
150     /*
151     - * At this point, we expect that the AVIC HW has already
152     - * set the appropriate IRR bits on the valid target
153     - * vcpus. So, we just need to kick the appropriate vcpu.
154     + * Update ICR high and low, then emulate sending IPI,
155     + * which is handled when writing APIC_ICR.
156     */
157     - kvm_for_each_vcpu(i, vcpu, kvm) {
158     - bool m = kvm_apic_match_dest(vcpu, apic,
159     - icrl & KVM_APIC_SHORT_MASK,
160     - GET_APIC_DEST_FIELD(icrh),
161     - icrl & KVM_APIC_DEST_MASK);
162     -
163     - if (m && !avic_vcpu_is_running(vcpu))
164     - kvm_vcpu_wake_up(vcpu);
165     - }
166     + kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
167     + kvm_lapic_reg_write(apic, APIC_ICR, icrl);
168     break;
169     }
170     case AVIC_IPI_FAILURE_INVALID_TARGET:
171     diff --git a/drivers/block/loop.c b/drivers/block/loop.c
172     index 344f34746c103..28ce17405aab4 100644
173     --- a/drivers/block/loop.c
174     +++ b/drivers/block/loop.c
175     @@ -81,6 +81,7 @@
176     #include <asm/uaccess.h>
177    
178     static DEFINE_IDR(loop_index_idr);
179     +static DEFINE_MUTEX(loop_index_mutex);
180     static DEFINE_MUTEX(loop_ctl_mutex);
181    
182     static int max_part;
183     @@ -1559,11 +1560,9 @@ static int lo_compat_ioctl(struct block_device *bdev, fmode_t mode,
184     static int lo_open(struct block_device *bdev, fmode_t mode)
185     {
186     struct loop_device *lo;
187     - int err;
188     + int err = 0;
189    
190     - err = mutex_lock_killable(&loop_ctl_mutex);
191     - if (err)
192     - return err;
193     + mutex_lock(&loop_index_mutex);
194     lo = bdev->bd_disk->private_data;
195     if (!lo) {
196     err = -ENXIO;
197     @@ -1572,20 +1571,18 @@ static int lo_open(struct block_device *bdev, fmode_t mode)
198    
199     atomic_inc(&lo->lo_refcnt);
200     out:
201     - mutex_unlock(&loop_ctl_mutex);
202     + mutex_unlock(&loop_index_mutex);
203     return err;
204     }
205    
206     -static void lo_release(struct gendisk *disk, fmode_t mode)
207     +static void __lo_release(struct loop_device *lo)
208     {
209     - struct loop_device *lo;
210     int err;
211    
212     - mutex_lock(&loop_ctl_mutex);
213     - lo = disk->private_data;
214     if (atomic_dec_return(&lo->lo_refcnt))
215     - goto out_unlock;
216     + return;
217    
218     + mutex_lock(&loop_ctl_mutex);
219     if (lo->lo_flags & LO_FLAGS_AUTOCLEAR) {
220     /*
221     * In autoclear mode, stop the loop thread
222     @@ -1602,10 +1599,16 @@ static void lo_release(struct gendisk *disk, fmode_t mode)
223     loop_flush(lo);
224     }
225    
226     -out_unlock:
227     mutex_unlock(&loop_ctl_mutex);
228     }
229    
230     +static void lo_release(struct gendisk *disk, fmode_t mode)
231     +{
232     + mutex_lock(&loop_index_mutex);
233     + __lo_release(disk->private_data);
234     + mutex_unlock(&loop_index_mutex);
235     +}
236     +
237     static const struct block_device_operations lo_fops = {
238     .owner = THIS_MODULE,
239     .open = lo_open,
240     @@ -1889,7 +1892,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
241     struct kobject *kobj;
242     int err;
243    
244     - mutex_lock(&loop_ctl_mutex);
245     + mutex_lock(&loop_index_mutex);
246     err = loop_lookup(&lo, MINOR(dev) >> part_shift);
247     if (err < 0)
248     err = loop_add(&lo, MINOR(dev) >> part_shift);
249     @@ -1897,7 +1900,7 @@ static struct kobject *loop_probe(dev_t dev, int *part, void *data)
250     kobj = NULL;
251     else
252     kobj = get_disk(lo->lo_disk);
253     - mutex_unlock(&loop_ctl_mutex);
254     + mutex_unlock(&loop_index_mutex);
255    
256     *part = 0;
257     return kobj;
258     @@ -1907,13 +1910,9 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
259     unsigned long parm)
260     {
261     struct loop_device *lo;
262     - int ret;
263     -
264     - ret = mutex_lock_killable(&loop_ctl_mutex);
265     - if (ret)
266     - return ret;
267     + int ret = -ENOSYS;
268    
269     - ret = -ENOSYS;
270     + mutex_lock(&loop_index_mutex);
271     switch (cmd) {
272     case LOOP_CTL_ADD:
273     ret = loop_lookup(&lo, parm);
274     @@ -1927,15 +1926,19 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
275     ret = loop_lookup(&lo, parm);
276     if (ret < 0)
277     break;
278     + mutex_lock(&loop_ctl_mutex);
279     if (lo->lo_state != Lo_unbound) {
280     ret = -EBUSY;
281     + mutex_unlock(&loop_ctl_mutex);
282     break;
283     }
284     if (atomic_read(&lo->lo_refcnt) > 0) {
285     ret = -EBUSY;
286     + mutex_unlock(&loop_ctl_mutex);
287     break;
288     }
289     lo->lo_disk->private_data = NULL;
290     + mutex_unlock(&loop_ctl_mutex);
291     idr_remove(&loop_index_idr, lo->lo_number);
292     loop_remove(lo);
293     break;
294     @@ -1945,7 +1948,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
295     break;
296     ret = loop_add(&lo, -1);
297     }
298     - mutex_unlock(&loop_ctl_mutex);
299     + mutex_unlock(&loop_index_mutex);
300    
301     return ret;
302     }
303     @@ -2028,10 +2031,10 @@ static int __init loop_init(void)
304     THIS_MODULE, loop_probe, NULL, NULL);
305    
306     /* pre-create number of devices given by config or max_loop */
307     - mutex_lock(&loop_ctl_mutex);
308     + mutex_lock(&loop_index_mutex);
309     for (i = 0; i < nr; i++)
310     loop_add(&lo, i);
311     - mutex_unlock(&loop_ctl_mutex);
312     + mutex_unlock(&loop_index_mutex);
313    
314     printk(KERN_INFO "loop: module loaded\n");
315     return 0;
316     diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c
317     index 8487f461f05f3..4823019eb422b 100644
318     --- a/drivers/gpu/drm/msm/msm_rd.c
319     +++ b/drivers/gpu/drm/msm/msm_rd.c
320     @@ -112,7 +112,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz)
321     char *fptr = &fifo->buf[fifo->head];
322     int n;
323    
324     - wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0);
325     + wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open);
326     + if (!rd->open)
327     + return;
328    
329     n = min(sz, circ_space_to_end(&rd->fifo));
330     memcpy(fptr, ptr, n);
331     @@ -202,7 +204,10 @@ out:
332     static int rd_release(struct inode *inode, struct file *file)
333     {
334     struct msm_rd_state *rd = inode->i_private;
335     +
336     rd->open = false;
337     + wake_up_all(&rd->fifo_event);
338     +
339     return 0;
340     }
341    
342     diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
343     index e77d79c8cd9f2..6224ad37fd80b 100644
344     --- a/drivers/mmc/host/mmc_spi.c
345     +++ b/drivers/mmc/host/mmc_spi.c
346     @@ -1450,6 +1450,7 @@ static int mmc_spi_probe(struct spi_device *spi)
347     mmc->caps &= ~MMC_CAP_NEEDS_POLL;
348     mmc_gpiod_request_cd_irq(mmc);
349     }
350     + mmc_detect_change(mmc, 0);
351    
352     if (host->pdata && host->pdata->flags & MMC_SPI_USE_RO_GPIO) {
353     has_ro = true;
354     diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
355     index a0eee72186957..e306342506f1f 100644
356     --- a/drivers/net/ethernet/altera/altera_tse_main.c
357     +++ b/drivers/net/ethernet/altera/altera_tse_main.c
358     @@ -692,8 +692,10 @@ static struct phy_device *connect_local_phy(struct net_device *dev)
359    
360     phydev = phy_connect(dev, phy_id_fmt, &altera_tse_adjust_link,
361     priv->phy_iface);
362     - if (IS_ERR(phydev))
363     + if (IS_ERR(phydev)) {
364     netdev_err(dev, "Could not attach to PHY\n");
365     + phydev = NULL;
366     + }
367    
368     } else {
369     int ret;
370     diff --git a/drivers/net/ethernet/ibm/ibmveth.c b/drivers/net/ethernet/ibm/ibmveth.c
371     index 4996228fd7e61..955f658f3b65f 100644
372     --- a/drivers/net/ethernet/ibm/ibmveth.c
373     +++ b/drivers/net/ethernet/ibm/ibmveth.c
374     @@ -1240,7 +1240,6 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
375     struct iphdr *iph;
376     u16 mss = 0;
377    
378     -restart_poll:
379     while (frames_processed < budget) {
380     if (!ibmveth_rxq_pending_buffer(adapter))
381     break;
382     @@ -1338,7 +1337,6 @@ restart_poll:
383     napi_reschedule(napi)) {
384     lpar_rc = h_vio_signal(adapter->vdev->unit_address,
385     VIO_IRQ_DISABLE);
386     - goto restart_poll;
387     }
388     }
389    
390     diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c
391     index 5be6b67492d52..393fd3ed6b94c 100644
392     --- a/drivers/net/usb/asix_devices.c
393     +++ b/drivers/net/usb/asix_devices.c
394     @@ -729,8 +729,13 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf)
395     asix_read_cmd(dev, AX_CMD_STATMNGSTS_REG, 0, 0, 1, &chipcode, 0);
396     chipcode &= AX_CHIPCODE_MASK;
397    
398     - (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
399     - ax88772a_hw_reset(dev, 0);
400     + ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
401     + ax88772a_hw_reset(dev, 0);
402     +
403     + if (ret < 0) {
404     + netdev_dbg(dev->net, "Failed to reset AX88772: %d\n", ret);
405     + return ret;
406     + }
407    
408     /* Read PHYID register *AFTER* the PHY was reset properly */
409     phyid = asix_get_phyid(dev);
410     diff --git a/drivers/scsi/csiostor/csio_attr.c b/drivers/scsi/csiostor/csio_attr.c
411     index 2d1c4ebd40f91..6587f20cff1a1 100644
412     --- a/drivers/scsi/csiostor/csio_attr.c
413     +++ b/drivers/scsi/csiostor/csio_attr.c
414     @@ -582,12 +582,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable)
415     }
416    
417     fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING);
418     + ln->fc_vport = fc_vport;
419    
420     if (csio_fcoe_alloc_vnp(hw, ln))
421     goto error;
422    
423     *(struct csio_lnode **)fc_vport->dd_data = ln;
424     - ln->fc_vport = fc_vport;
425     if (!fc_vport->node_name)
426     fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln));
427     if (!fc_vport->port_name)
428     diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c
429     index 12886f96b2860..7be581f7c35d1 100644
430     --- a/drivers/scsi/libsas/sas_expander.c
431     +++ b/drivers/scsi/libsas/sas_expander.c
432     @@ -818,6 +818,7 @@ static struct domain_device *sas_ex_discover_end_dev(
433     rphy = sas_end_device_alloc(phy->port);
434     if (!rphy)
435     goto out_free;
436     + rphy->identify.phy_identifier = phy_id;
437    
438     child->rphy = rphy;
439     get_device(&rphy->dev);
440     @@ -845,6 +846,7 @@ static struct domain_device *sas_ex_discover_end_dev(
441    
442     child->rphy = rphy;
443     get_device(&rphy->dev);
444     + rphy->identify.phy_identifier = phy_id;
445     sas_fill_in_rphy(child, rphy);
446    
447     list_add_tail(&child->disco_list_node, &parent->port->disco_list);
448     diff --git a/drivers/thermal/int340x_thermal/processor_thermal_device.c b/drivers/thermal/int340x_thermal/processor_thermal_device.c
449     index ff3b36f339e34..1fdf6fd24cdff 100644
450     --- a/drivers/thermal/int340x_thermal/processor_thermal_device.c
451     +++ b/drivers/thermal/int340x_thermal/processor_thermal_device.c
452     @@ -77,7 +77,12 @@ static ssize_t power_limit_##index##_##suffix##_show(struct device *dev, \
453     struct pci_dev *pci_dev; \
454     struct platform_device *pdev; \
455     struct proc_thermal_device *proc_dev; \
456     -\
457     + \
458     + if (proc_thermal_emum_mode == PROC_THERMAL_NONE) { \
459     + dev_warn(dev, "Attempted to get power limit before device was initialized!\n"); \
460     + return 0; \
461     + } \
462     + \
463     if (proc_thermal_emum_mode == PROC_THERMAL_PLATFORM_DEV) { \
464     pdev = to_platform_device(dev); \
465     proc_dev = platform_get_drvdata(pdev); \
466     @@ -291,11 +296,6 @@ static int proc_thermal_add(struct device *dev,
467     *priv = proc_priv;
468    
469     ret = proc_thermal_read_ppcc(proc_priv);
470     - if (!ret) {
471     - ret = sysfs_create_group(&dev->kobj,
472     - &power_limit_attribute_group);
473     -
474     - }
475     if (ret)
476     return ret;
477    
478     @@ -309,8 +309,7 @@ static int proc_thermal_add(struct device *dev,
479    
480     proc_priv->int340x_zone = int340x_thermal_zone_add(adev, ops);
481     if (IS_ERR(proc_priv->int340x_zone)) {
482     - ret = PTR_ERR(proc_priv->int340x_zone);
483     - goto remove_group;
484     + return PTR_ERR(proc_priv->int340x_zone);
485     } else
486     ret = 0;
487    
488     @@ -324,9 +323,6 @@ static int proc_thermal_add(struct device *dev,
489    
490     remove_zone:
491     int340x_thermal_zone_remove(proc_priv->int340x_zone);
492     -remove_group:
493     - sysfs_remove_group(&proc_priv->dev->kobj,
494     - &power_limit_attribute_group);
495    
496     return ret;
497     }
498     @@ -357,7 +353,10 @@ static int int3401_add(struct platform_device *pdev)
499     platform_set_drvdata(pdev, proc_priv);
500     proc_thermal_emum_mode = PROC_THERMAL_PLATFORM_DEV;
501    
502     - return 0;
503     + dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PLATFORM_DEV\n");
504     +
505     + return sysfs_create_group(&pdev->dev.kobj,
506     + &power_limit_attribute_group);
507     }
508    
509     static int int3401_remove(struct platform_device *pdev)
510     @@ -416,7 +415,7 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev,
511     proc_priv->soc_dts = intel_soc_dts_iosf_init(
512     INTEL_SOC_DTS_INTERRUPT_MSI, 2, 0);
513    
514     - if (proc_priv->soc_dts && pdev->irq) {
515     + if (!IS_ERR(proc_priv->soc_dts) && pdev->irq) {
516     ret = pci_enable_msi(pdev);
517     if (!ret) {
518     ret = request_threaded_irq(pdev->irq, NULL,
519     @@ -434,7 +433,10 @@ static int proc_thermal_pci_probe(struct pci_dev *pdev,
520     dev_err(&pdev->dev, "No auxiliary DTSs enabled\n");
521     }
522    
523     - return 0;
524     + dev_info(&pdev->dev, "Creating sysfs group for PROC_THERMAL_PCI\n");
525     +
526     + return sysfs_create_group(&pdev->dev.kobj,
527     + &power_limit_attribute_group);
528     }
529    
530     static void proc_thermal_pci_remove(struct pci_dev *pdev)
531     diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
532     index 5c471c3481bdf..800996522fdc2 100644
533     --- a/drivers/tty/serial/fsl_lpuart.c
534     +++ b/drivers/tty/serial/fsl_lpuart.c
535     @@ -1494,7 +1494,7 @@ lpuart32_set_termios(struct uart_port *port, struct ktermios *termios,
536     }
537    
538     /* ask the core to calculate the divisor */
539     - baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16);
540     + baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 4);
541    
542     spin_lock_irqsave(&sport->port.lock, flags);
543    
544     diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
545     index ed6b9bfe37595..712bd450f8573 100644
546     --- a/drivers/usb/dwc3/gadget.c
547     +++ b/drivers/usb/dwc3/gadget.c
548     @@ -1705,6 +1705,7 @@ static int __dwc3_gadget_start(struct dwc3 *dwc)
549    
550     /* begin to receive SETUP packets */
551     dwc->ep0state = EP0_SETUP_PHASE;
552     + dwc->link_state = DWC3_LINK_STATE_SS_DIS;
553     dwc3_ep0_out_start(dwc);
554    
555     dwc3_gadget_enable_irq(dwc);
556     @@ -3096,6 +3097,8 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)
557     dwc3_disconnect_gadget(dwc);
558     __dwc3_gadget_stop(dwc);
559    
560     + synchronize_irq(dwc->irq_gadget);
561     +
562     return 0;
563     }
564    
565     diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
566     index 8784fa12ea2c6..6e9d958004a0d 100644
567     --- a/drivers/usb/gadget/function/f_sourcesink.c
568     +++ b/drivers/usb/gadget/function/f_sourcesink.c
569     @@ -842,7 +842,7 @@ static struct usb_function *source_sink_alloc_func(
570    
571     ss = kzalloc(sizeof(*ss), GFP_KERNEL);
572     if (!ss)
573     - return NULL;
574     + return ERR_PTR(-ENOMEM);
575    
576     ss_opts = container_of(fi, struct f_ss_opts, func_inst);
577    
578     diff --git a/fs/direct-io.c b/fs/direct-io.c
579     index 07cc38ec66ca6..fc90f0c33cbe4 100644
580     --- a/fs/direct-io.c
581     +++ b/fs/direct-io.c
582     @@ -616,6 +616,7 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio,
583     unsigned long fs_count; /* Number of filesystem-sized blocks */
584     int create;
585     unsigned int i_blkbits = sdio->blkbits + sdio->blkfactor;
586     + loff_t i_size;
587    
588     /*
589     * If there was a memory error and we've overwritten all the
590     @@ -645,8 +646,8 @@ static int get_more_blocks(struct dio *dio, struct dio_submit *sdio,
591     */
592     create = dio->op == REQ_OP_WRITE;
593     if (dio->flags & DIO_SKIP_HOLES) {
594     - if (fs_startblk <= ((i_size_read(dio->inode) - 1) >>
595     - i_blkbits))
596     + i_size = i_size_read(dio->inode);
597     + if (i_size && fs_startblk <= (i_size - 1) >> i_blkbits)
598     create = 0;
599     }
600    
601     diff --git a/kernel/locking/rwsem-xadd.c b/kernel/locking/rwsem-xadd.c
602     index a4112dfcd0fb1..be06c45cbe4f9 100644
603     --- a/kernel/locking/rwsem-xadd.c
604     +++ b/kernel/locking/rwsem-xadd.c
605     @@ -195,15 +195,22 @@ static void __rwsem_mark_wake(struct rw_semaphore *sem,
606     woken++;
607     tsk = waiter->task;
608    
609     - wake_q_add(wake_q, tsk);
610     + get_task_struct(tsk);
611     list_del(&waiter->list);
612     /*
613     - * Ensure that the last operation is setting the reader
614     + * Ensure calling get_task_struct() before setting the reader
615     * waiter to nil such that rwsem_down_read_failed() cannot
616     * race with do_exit() by always holding a reference count
617     * to the task to wakeup.
618     */
619     smp_store_release(&waiter->task, NULL);
620     + /*
621     + * Ensure issuing the wakeup (either by us or someone else)
622     + * after setting the reader waiter to nil.
623     + */
624     + wake_q_add(wake_q, tsk);
625     + /* wake_q_add() already take the task ref */
626     + put_task_struct(tsk);
627     }
628    
629     adjustment = woken * RWSEM_ACTIVE_READ_BIAS - adjustment;
630     diff --git a/mm/mmap.c b/mm/mmap.c
631     index 283755645d17e..3f2314ad6acd8 100644
632     --- a/mm/mmap.c
633     +++ b/mm/mmap.c
634     @@ -2345,12 +2345,11 @@ int expand_downwards(struct vm_area_struct *vma,
635     struct mm_struct *mm = vma->vm_mm;
636     struct vm_area_struct *prev;
637     unsigned long gap_addr;
638     - int error;
639     + int error = 0;
640    
641     address &= PAGE_MASK;
642     - error = security_mmap_addr(address);
643     - if (error)
644     - return error;
645     + if (address < mmap_min_addr)
646     + return -EPERM;
647    
648     /* Enforce stack_guard_gap */
649     gap_addr = address - stack_guard_gap;
650     diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
651     index 6ef9d32c34f1e..954315e1661df 100644
652     --- a/net/mac80211/cfg.c
653     +++ b/net/mac80211/cfg.c
654     @@ -1425,6 +1425,10 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev,
655     if (params->sta_flags_set & BIT(NL80211_STA_FLAG_TDLS_PEER))
656     sta->sta.tdls = true;
657    
658     + if (sta->sta.tdls && sdata->vif.type == NL80211_IFTYPE_STATION &&
659     + !sdata->u.mgd.associated)
660     + return -EINVAL;
661     +
662     err = sta_apply_parameters(local, sta, params);
663     if (err) {
664     sta_info_free(local, sta);
665     diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
666     index af02d2136a066..23f6c8baae951 100644
667     --- a/net/mac80211/rx.c
668     +++ b/net/mac80211/rx.c
669     @@ -217,7 +217,7 @@ static void ieee80211_handle_mu_mimo_mon(struct ieee80211_sub_if_data *sdata,
670     struct ieee80211_hdr_3addr hdr;
671     u8 category;
672     u8 action_code;
673     - } __packed action;
674     + } __packed __aligned(2) action;
675    
676     if (!sdata)
677     return;
678     @@ -2510,7 +2510,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
679     skb_set_queue_mapping(skb, q);
680    
681     if (!--mesh_hdr->ttl) {
682     - IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
683     + if (!is_multicast_ether_addr(hdr->addr1))
684     + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh,
685     + dropped_frames_ttl);
686     goto out;
687     }
688    
689     diff --git a/net/wireless/reg.c b/net/wireless/reg.c
690     index 36d1d25082e32..7c19d0d2549b1 100644
691     --- a/net/wireless/reg.c
692     +++ b/net/wireless/reg.c
693     @@ -773,7 +773,7 @@ static bool reg_does_bw_fit(const struct ieee80211_freq_range *freq_range,
694     * definitions (the "2.4 GHz band", the "5 GHz band" and the "60GHz band"),
695     * however it is safe for now to assume that a frequency rule should not be
696     * part of a frequency's band if the start freq or end freq are off by more
697     - * than 2 GHz for the 2.4 and 5 GHz bands, and by more than 10 GHz for the
698     + * than 2 GHz for the 2.4 and 5 GHz bands, and by more than 20 GHz for the
699     * 60 GHz band.
700     * This resolution can be lowered and should be considered as we add
701     * regulatory rule support for other "bands".
702     @@ -788,7 +788,7 @@ static bool freq_in_rule_band(const struct ieee80211_freq_range *freq_range,
703     * with the Channel starting frequency above 45 GHz.
704     */
705     u32 limit = freq_khz > 45 * ONE_GHZ_IN_KHZ ?
706     - 10 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ;
707     + 20 * ONE_GHZ_IN_KHZ : 2 * ONE_GHZ_IN_KHZ;
708     if (abs(freq_khz - freq_range->start_freq_khz) <= limit)
709     return true;
710     if (abs(freq_khz - freq_range->end_freq_khz) <= limit)
711     diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
712     index 4490a699030b1..555df64d46ffc 100644
713     --- a/sound/core/compress_offload.c
714     +++ b/sound/core/compress_offload.c
715     @@ -529,7 +529,8 @@ static int snd_compress_check_input(struct snd_compr_params *params)
716     {
717     /* first let's check the buffer parameter's */
718     if (params->buffer.fragment_size == 0 ||
719     - params->buffer.fragments > INT_MAX / params->buffer.fragment_size)
720     + params->buffer.fragments > INT_MAX / params->buffer.fragment_size ||
721     + params->buffer.fragments == 0)
722     return -EINVAL;
723    
724     /* now codec parameters */
725     diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
726     index fc57da341d610..136df38c4536c 100644
727     --- a/sound/soc/fsl/imx-audmux.c
728     +++ b/sound/soc/fsl/imx-audmux.c
729     @@ -86,49 +86,49 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
730     if (!buf)
731     return -ENOMEM;
732    
733     - ret = snprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
734     + ret = scnprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
735     pdcr, ptcr);
736    
737     if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR)
738     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
739     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
740     "TxFS output from %s, ",
741     audmux_port_string((ptcr >> 27) & 0x7));
742     else
743     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
744     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
745     "TxFS input, ");
746    
747     if (ptcr & IMX_AUDMUX_V2_PTCR_TCLKDIR)
748     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
749     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
750     "TxClk output from %s",
751     audmux_port_string((ptcr >> 22) & 0x7));
752     else
753     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
754     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
755     "TxClk input");
756    
757     - ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");
758     + ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
759    
760     if (ptcr & IMX_AUDMUX_V2_PTCR_SYN) {
761     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
762     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
763     "Port is symmetric");
764     } else {
765     if (ptcr & IMX_AUDMUX_V2_PTCR_RFSDIR)
766     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
767     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
768     "RxFS output from %s, ",
769     audmux_port_string((ptcr >> 17) & 0x7));
770     else
771     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
772     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
773     "RxFS input, ");
774    
775     if (ptcr & IMX_AUDMUX_V2_PTCR_RCLKDIR)
776     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
777     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
778     "RxClk output from %s",
779     audmux_port_string((ptcr >> 12) & 0x7));
780     else
781     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
782     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
783     "RxClk input");
784     }
785    
786     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
787     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
788     "\nData received from %s\n",
789     audmux_port_string((pdcr >> 13) & 0x7));
790    
791     diff --git a/sound/soc/intel/boards/broadwell.c b/sound/soc/intel/boards/broadwell.c
792     index 7486a0022fdea..993d2c105ae14 100644
793     --- a/sound/soc/intel/boards/broadwell.c
794     +++ b/sound/soc/intel/boards/broadwell.c
795     @@ -191,7 +191,7 @@ static struct snd_soc_dai_link broadwell_rt286_dais[] = {
796     .stream_name = "Loopback",
797     .cpu_dai_name = "Loopback Pin",
798     .platform_name = "haswell-pcm-audio",
799     - .dynamic = 0,
800     + .dynamic = 1,
801     .codec_name = "snd-soc-dummy",
802     .codec_dai_name = "snd-soc-dummy-dai",
803     .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
804     diff --git a/sound/soc/intel/boards/haswell.c b/sound/soc/intel/boards/haswell.c
805     index 863f1d5e2a2c9..11d0cc2b0e390 100644
806     --- a/sound/soc/intel/boards/haswell.c
807     +++ b/sound/soc/intel/boards/haswell.c
808     @@ -145,7 +145,7 @@ static struct snd_soc_dai_link haswell_rt5640_dais[] = {
809     .stream_name = "Loopback",
810     .cpu_dai_name = "Loopback Pin",
811     .platform_name = "haswell-pcm-audio",
812     - .dynamic = 0,
813     + .dynamic = 1,
814     .codec_name = "snd-soc-dummy",
815     .codec_dai_name = "snd-soc-dummy-dai",
816     .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST},
817     diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
818     index 8bfc534e3b342..ab647f1fe11bd 100644
819     --- a/sound/soc/soc-dapm.c
820     +++ b/sound/soc/soc-dapm.c
821     @@ -1976,19 +1976,19 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
822     out = is_connected_output_ep(w, NULL, NULL);
823     }
824    
825     - ret = snprintf(buf, PAGE_SIZE, "%s: %s%s in %d out %d",
826     + ret = scnprintf(buf, PAGE_SIZE, "%s: %s%s in %d out %d",
827     w->name, w->power ? "On" : "Off",
828     w->force ? " (forced)" : "", in, out);
829    
830     if (w->reg >= 0)
831     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
832     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
833     " - R%d(0x%x) mask 0x%x",
834     w->reg, w->reg, w->mask << w->shift);
835    
836     - ret += snprintf(buf + ret, PAGE_SIZE - ret, "\n");
837     + ret += scnprintf(buf + ret, PAGE_SIZE - ret, "\n");
838    
839     if (w->sname)
840     - ret += snprintf(buf + ret, PAGE_SIZE - ret, " stream %s %s\n",
841     + ret += scnprintf(buf + ret, PAGE_SIZE - ret, " stream %s %s\n",
842     w->sname,
843     w->active ? "active" : "inactive");
844    
845     @@ -2001,7 +2001,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file,
846     if (!p->connect)
847     continue;
848    
849     - ret += snprintf(buf + ret, PAGE_SIZE - ret,
850     + ret += scnprintf(buf + ret, PAGE_SIZE - ret,
851     " %s \"%s\" \"%s\"\n",
852     (rdir == SND_SOC_DAPM_DIR_IN) ? "in" : "out",
853     p->name ? p->name : "static",