Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.4/0127-3.4.28-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2110 - (hide annotations) (download)
Tue Mar 12 12:15:23 2013 UTC (11 years, 2 months ago) by niro
File size: 28817 byte(s)
-sync with upstream
1 niro 2110 diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
2     index f3decb3..6cba428 100644
3     --- a/drivers/acpi/processor_idle.c
4     +++ b/drivers/acpi/processor_idle.c
5     @@ -1018,6 +1018,9 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr)
6     return -EINVAL;
7     }
8    
9     + if (!dev)
10     + return -EINVAL;
11     +
12     dev->cpu = pr->id;
13    
14     if (max_cstate == 0)
15     @@ -1205,6 +1208,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
16     }
17    
18     /* Populate Updated C-state information */
19     + acpi_processor_get_power_info(pr);
20     acpi_processor_setup_cpuidle_states(pr);
21    
22     /* Enable all cpuidle devices */
23     diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
24     index 93cbc44..71a4d04 100644
25     --- a/drivers/ata/ahci.c
26     +++ b/drivers/ata/ahci.c
27     @@ -53,6 +53,7 @@
28    
29     enum {
30     AHCI_PCI_BAR_STA2X11 = 0,
31     + AHCI_PCI_BAR_ENMOTUS = 2,
32     AHCI_PCI_BAR_STANDARD = 5,
33     };
34    
35     @@ -405,7 +406,13 @@ static const struct pci_device_id ahci_pci_tbl[] = {
36     { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
37    
38     /* Asmedia */
39     - { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1061 */
40     + { PCI_VDEVICE(ASMEDIA, 0x0601), board_ahci }, /* ASM1060 */
41     + { PCI_VDEVICE(ASMEDIA, 0x0602), board_ahci }, /* ASM1060 */
42     + { PCI_VDEVICE(ASMEDIA, 0x0611), board_ahci }, /* ASM1061 */
43     + { PCI_VDEVICE(ASMEDIA, 0x0612), board_ahci }, /* ASM1062 */
44     +
45     + /* Enmotus */
46     + { PCI_DEVICE(0x1c44, 0x8000), board_ahci },
47    
48     /* Generic, PCI class code for AHCI */
49     { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
50     @@ -1079,9 +1086,11 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
51     dev_info(&pdev->dev,
52     "PDC42819 can only drive SATA devices with this driver\n");
53    
54     - /* The Connext uses non-standard BAR */
55     + /* Both Connext and Enmotus devices use non-standard BARs */
56     if (pdev->vendor == PCI_VENDOR_ID_STMICRO && pdev->device == 0xCC06)
57     ahci_pci_bar = AHCI_PCI_BAR_STA2X11;
58     + else if (pdev->vendor == 0x1c44 && pdev->device == 0x8000)
59     + ahci_pci_bar = AHCI_PCI_BAR_ENMOTUS;
60    
61     /* acquire resources */
62     rc = pcim_enable_device(pdev);
63     diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
64     index f7f1dc6..ed0e8b7 100644
65     --- a/drivers/dma/ioat/dma_v3.c
66     +++ b/drivers/dma/ioat/dma_v3.c
67     @@ -951,7 +951,7 @@ static int __devinit ioat_xor_val_self_test(struct ioatdma_device *device)
68     goto free_resources;
69     }
70     }
71     - dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_TO_DEVICE);
72     + dma_sync_single_for_device(dev, dest_dma, PAGE_SIZE, DMA_FROM_DEVICE);
73    
74     /* skip validate if the capability is not present */
75     if (!dma_has_cap(DMA_XOR_VAL, dma_chan->device->cap_mask))
76     diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
77     index b298158..fd3ae62 100644
78     --- a/drivers/firmware/dmi_scan.c
79     +++ b/drivers/firmware/dmi_scan.c
80     @@ -16,6 +16,7 @@
81     */
82     static char dmi_empty_string[] = " ";
83    
84     +static u16 __initdata dmi_ver;
85     /*
86     * Catch too early calls to dmi_check_system():
87     */
88     @@ -118,12 +119,12 @@ static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,
89     return 0;
90     }
91    
92     -static int __init dmi_checksum(const u8 *buf)
93     +static int __init dmi_checksum(const u8 *buf, u8 len)
94     {
95     u8 sum = 0;
96     int a;
97    
98     - for (a = 0; a < 15; a++)
99     + for (a = 0; a < len; a++)
100     sum += buf[a];
101    
102     return sum == 0;
103     @@ -161,8 +162,10 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
104     return;
105    
106     for (i = 0; i < 16 && (is_ff || is_00); i++) {
107     - if(d[i] != 0x00) is_ff = 0;
108     - if(d[i] != 0xFF) is_00 = 0;
109     + if (d[i] != 0x00)
110     + is_00 = 0;
111     + if (d[i] != 0xFF)
112     + is_ff = 0;
113     }
114    
115     if (is_ff || is_00)
116     @@ -172,7 +175,15 @@ static void __init dmi_save_uuid(const struct dmi_header *dm, int slot, int inde
117     if (!s)
118     return;
119    
120     - sprintf(s, "%pUB", d);
121     + /*
122     + * As of version 2.6 of the SMBIOS specification, the first 3 fields of
123     + * the UUID are supposed to be little-endian encoded. The specification
124     + * says that this is the defacto standard.
125     + */
126     + if (dmi_ver >= 0x0206)
127     + sprintf(s, "%pUL", d);
128     + else
129     + sprintf(s, "%pUB", d);
130    
131     dmi_ident[slot] = s;
132     }
133     @@ -404,29 +415,57 @@ static int __init dmi_present(const char __iomem *p)
134     u8 buf[15];
135    
136     memcpy_fromio(buf, p, 15);
137     - if ((memcmp(buf, "_DMI_", 5) == 0) && dmi_checksum(buf)) {
138     + if (dmi_checksum(buf, 15)) {
139     dmi_num = (buf[13] << 8) | buf[12];
140     dmi_len = (buf[7] << 8) | buf[6];
141     dmi_base = (buf[11] << 24) | (buf[10] << 16) |
142     (buf[9] << 8) | buf[8];
143    
144     - /*
145     - * DMI version 0.0 means that the real version is taken from
146     - * the SMBIOS version, which we don't know at this point.
147     - */
148     - if (buf[14] != 0)
149     - printk(KERN_INFO "DMI %d.%d present.\n",
150     - buf[14] >> 4, buf[14] & 0xF);
151     - else
152     - printk(KERN_INFO "DMI present.\n");
153     if (dmi_walk_early(dmi_decode) == 0) {
154     + if (dmi_ver)
155     + pr_info("SMBIOS %d.%d present.\n",
156     + dmi_ver >> 8, dmi_ver & 0xFF);
157     + else {
158     + dmi_ver = (buf[14] & 0xF0) << 4 |
159     + (buf[14] & 0x0F);
160     + pr_info("Legacy DMI %d.%d present.\n",
161     + dmi_ver >> 8, dmi_ver & 0xFF);
162     + }
163     dmi_dump_ids();
164     return 0;
165     }
166     }
167     + dmi_ver = 0;
168     return 1;
169     }
170    
171     +static int __init smbios_present(const char __iomem *p)
172     +{
173     + u8 buf[32];
174     + int offset = 0;
175     +
176     + memcpy_fromio(buf, p, 32);
177     + if ((buf[5] < 32) && dmi_checksum(buf, buf[5])) {
178     + dmi_ver = (buf[6] << 8) + buf[7];
179     +
180     + /* Some BIOS report weird SMBIOS version, fix that up */
181     + switch (dmi_ver) {
182     + case 0x021F:
183     + case 0x0221:
184     + pr_debug("SMBIOS version fixup(2.%d->2.%d)\n",
185     + dmi_ver & 0xFF, 3);
186     + dmi_ver = 0x0203;
187     + break;
188     + case 0x0233:
189     + pr_debug("SMBIOS version fixup(2.%d->2.%d)\n", 51, 6);
190     + dmi_ver = 0x0206;
191     + break;
192     + }
193     + offset = 16;
194     + }
195     + return dmi_present(buf + offset);
196     +}
197     +
198     void __init dmi_scan_machine(void)
199     {
200     char __iomem *p, *q;
201     @@ -444,7 +483,7 @@ void __init dmi_scan_machine(void)
202     if (p == NULL)
203     goto error;
204    
205     - rc = dmi_present(p + 0x10); /* offset of _DMI_ string */
206     + rc = smbios_present(p);
207     dmi_iounmap(p, 32);
208     if (!rc) {
209     dmi_available = 1;
210     @@ -462,7 +501,12 @@ void __init dmi_scan_machine(void)
211     goto error;
212    
213     for (q = p; q < p + 0x10000; q += 16) {
214     - rc = dmi_present(q);
215     + if (memcmp(q, "_SM_", 4) == 0 && q - p <= 0xFFE0)
216     + rc = smbios_present(q);
217     + else if (memcmp(q, "_DMI_", 5) == 0)
218     + rc = dmi_present(q);
219     + else
220     + continue;
221     if (!rc) {
222     dmi_available = 1;
223     dmi_iounmap(p, 0x10000);
224     diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
225     index de43194..d4417e3 100644
226     --- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
227     +++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
228     @@ -707,6 +707,8 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
229     total = 0;
230     for (i = 0; i < count; i++) {
231     struct drm_i915_gem_relocation_entry __user *user_relocs;
232     + u64 invalid_offset = (u64)-1;
233     + int j;
234    
235     user_relocs = (void __user *)(uintptr_t)exec[i].relocs_ptr;
236    
237     @@ -717,6 +719,25 @@ i915_gem_execbuffer_relocate_slow(struct drm_device *dev,
238     goto err;
239     }
240    
241     + /* As we do not update the known relocation offsets after
242     + * relocating (due to the complexities in lock handling),
243     + * we need to mark them as invalid now so that we force the
244     + * relocation processing next time. Just in case the target
245     + * object is evicted and then rebound into its old
246     + * presumed_offset before the next execbuffer - if that
247     + * happened we would make the mistake of assuming that the
248     + * relocations were valid.
249     + */
250     + for (j = 0; j < exec[i].relocation_count; j++) {
251     + if (copy_to_user(&user_relocs[j].presumed_offset,
252     + &invalid_offset,
253     + sizeof(invalid_offset))) {
254     + ret = -EFAULT;
255     + mutex_lock(&dev->struct_mutex);
256     + goto err;
257     + }
258     + }
259     +
260     reloc_offset[i] = total;
261     total += exec[i].relocation_count;
262     }
263     diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
264     index 27a296a..dde62bf 100644
265     --- a/drivers/gpu/drm/i915/i915_reg.h
266     +++ b/drivers/gpu/drm/i915/i915_reg.h
267     @@ -27,6 +27,8 @@
268    
269     #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
270    
271     +#define _MASKED_BIT_ENABLE(a) (((a) << 16) | (a))
272     +
273     /*
274     * The Bridge device's PCI config space has information about the
275     * fb aperture size and the amount of pre-reserved memory.
276     @@ -433,6 +435,7 @@
277     * the enables for writing to the corresponding low bit.
278     */
279     #define _3D_CHICKEN 0x02084
280     +#define _3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB (1 << 10)
281     #define _3D_CHICKEN2 0x0208c
282     /* Disables pipelining of read flushes past the SF-WIZ interface.
283     * Required on all Ironlake steppings according to the B-Spec, but the
284     diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
285     index 8e95c94..3c9b9c5 100644
286     --- a/drivers/gpu/drm/i915/intel_display.c
287     +++ b/drivers/gpu/drm/i915/intel_display.c
288     @@ -8592,6 +8592,10 @@ static void gen6_init_clock_gating(struct drm_device *dev)
289     I915_READ(ILK_DISPLAY_CHICKEN2) |
290     ILK_ELPIN_409_SELECT);
291    
292     + /* WaDisableHiZPlanesWhenMSAAEnabled */
293     + I915_WRITE(_3D_CHICKEN,
294     + _MASKED_BIT_ENABLE(_3D_CHICKEN_HIZ_PLANE_DISABLE_MSAA_4X_SNB));
295     +
296     I915_WRITE(WM3_LP_ILK, 0);
297     I915_WRITE(WM2_LP_ILK, 0);
298     I915_WRITE(WM1_LP_ILK, 0);
299     diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
300     index 4b7cce1..a321b77 100644
301     --- a/drivers/pci/hotplug/pciehp.h
302     +++ b/drivers/pci/hotplug/pciehp.h
303     @@ -44,7 +44,6 @@ extern bool pciehp_poll_mode;
304     extern int pciehp_poll_time;
305     extern bool pciehp_debug;
306     extern bool pciehp_force;
307     -extern struct workqueue_struct *pciehp_wq;
308    
309     #define dbg(format, arg...) \
310     do { \
311     @@ -78,6 +77,7 @@ struct slot {
312     struct hotplug_slot *hotplug_slot;
313     struct delayed_work work; /* work for button event */
314     struct mutex lock;
315     + struct workqueue_struct *wq;
316     };
317    
318     struct event_info {
319     diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
320     index 365c6b9..9e39df9 100644
321     --- a/drivers/pci/hotplug/pciehp_core.c
322     +++ b/drivers/pci/hotplug/pciehp_core.c
323     @@ -42,7 +42,6 @@ bool pciehp_debug;
324     bool pciehp_poll_mode;
325     int pciehp_poll_time;
326     bool pciehp_force;
327     -struct workqueue_struct *pciehp_wq;
328    
329     #define DRIVER_VERSION "0.4"
330     #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
331     @@ -340,18 +339,13 @@ static int __init pcied_init(void)
332     {
333     int retval = 0;
334    
335     - pciehp_wq = alloc_workqueue("pciehp", 0, 0);
336     - if (!pciehp_wq)
337     - return -ENOMEM;
338     -
339     pciehp_firmware_init();
340     retval = pcie_port_service_register(&hpdriver_portdrv);
341     dbg("pcie_port_service_register = %d\n", retval);
342     info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
343     - if (retval) {
344     - destroy_workqueue(pciehp_wq);
345     + if (retval)
346     dbg("Failure to register service\n");
347     - }
348     +
349     return retval;
350     }
351    
352     @@ -359,7 +353,6 @@ static void __exit pcied_cleanup(void)
353     {
354     dbg("unload_pciehpd()\n");
355     pcie_port_service_unregister(&hpdriver_portdrv);
356     - destroy_workqueue(pciehp_wq);
357     info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
358     }
359    
360     diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c
361     index 27f4429..38f0186 100644
362     --- a/drivers/pci/hotplug/pciehp_ctrl.c
363     +++ b/drivers/pci/hotplug/pciehp_ctrl.c
364     @@ -49,7 +49,7 @@ static int queue_interrupt_event(struct slot *p_slot, u32 event_type)
365     info->p_slot = p_slot;
366     INIT_WORK(&info->work, interrupt_event_handler);
367    
368     - queue_work(pciehp_wq, &info->work);
369     + queue_work(p_slot->wq, &info->work);
370    
371     return 0;
372     }
373     @@ -344,7 +344,7 @@ void pciehp_queue_pushbutton_work(struct work_struct *work)
374     kfree(info);
375     goto out;
376     }
377     - queue_work(pciehp_wq, &info->work);
378     + queue_work(p_slot->wq, &info->work);
379     out:
380     mutex_unlock(&p_slot->lock);
381     }
382     @@ -377,7 +377,7 @@ static void handle_button_press_event(struct slot *p_slot)
383     if (ATTN_LED(ctrl))
384     pciehp_set_attention_status(p_slot, 0);
385    
386     - queue_delayed_work(pciehp_wq, &p_slot->work, 5*HZ);
387     + queue_delayed_work(p_slot->wq, &p_slot->work, 5*HZ);
388     break;
389     case BLINKINGOFF_STATE:
390     case BLINKINGON_STATE:
391     @@ -439,7 +439,7 @@ static void handle_surprise_event(struct slot *p_slot)
392     else
393     p_slot->state = POWERON_STATE;
394    
395     - queue_work(pciehp_wq, &info->work);
396     + queue_work(p_slot->wq, &info->work);
397     }
398    
399     static void interrupt_event_handler(struct work_struct *work)
400     diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
401     index a960fae..9dd2c01 100644
402     --- a/drivers/pci/hotplug/pciehp_hpc.c
403     +++ b/drivers/pci/hotplug/pciehp_hpc.c
404     @@ -874,23 +874,32 @@ static void pcie_shutdown_notification(struct controller *ctrl)
405     static int pcie_init_slot(struct controller *ctrl)
406     {
407     struct slot *slot;
408     + char name[32];
409    
410     slot = kzalloc(sizeof(*slot), GFP_KERNEL);
411     if (!slot)
412     return -ENOMEM;
413    
414     + snprintf(name, sizeof(name), "pciehp-%u", PSN(ctrl));
415     + slot->wq = alloc_workqueue(name, 0, 0);
416     + if (!slot->wq)
417     + goto abort;
418     +
419     slot->ctrl = ctrl;
420     mutex_init(&slot->lock);
421     INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
422     ctrl->slot = slot;
423     return 0;
424     +abort:
425     + kfree(slot);
426     + return -ENOMEM;
427     }
428    
429     static void pcie_cleanup_slot(struct controller *ctrl)
430     {
431     struct slot *slot = ctrl->slot;
432     cancel_delayed_work(&slot->work);
433     - flush_workqueue(pciehp_wq);
434     + destroy_workqueue(slot->wq);
435     kfree(slot);
436     }
437    
438     diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
439     index ca64932..1b69d95 100644
440     --- a/drivers/pci/hotplug/shpchp.h
441     +++ b/drivers/pci/hotplug/shpchp.h
442     @@ -47,7 +47,6 @@ extern bool shpchp_poll_mode;
443     extern int shpchp_poll_time;
444     extern bool shpchp_debug;
445     extern struct workqueue_struct *shpchp_wq;
446     -extern struct workqueue_struct *shpchp_ordered_wq;
447    
448     #define dbg(format, arg...) \
449     do { \
450     diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
451     index 7414fd9..5f1f0d9 100644
452     --- a/drivers/pci/hotplug/shpchp_core.c
453     +++ b/drivers/pci/hotplug/shpchp_core.c
454     @@ -40,7 +40,6 @@ bool shpchp_debug;
455     bool shpchp_poll_mode;
456     int shpchp_poll_time;
457     struct workqueue_struct *shpchp_wq;
458     -struct workqueue_struct *shpchp_ordered_wq;
459    
460     #define DRIVER_VERSION "0.4"
461     #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
462     @@ -175,7 +174,6 @@ void cleanup_slots(struct controller *ctrl)
463     list_del(&slot->slot_list);
464     cancel_delayed_work(&slot->work);
465     flush_workqueue(shpchp_wq);
466     - flush_workqueue(shpchp_ordered_wq);
467     pci_hp_deregister(slot->hotplug_slot);
468     }
469     }
470     @@ -364,17 +362,10 @@ static int __init shpcd_init(void)
471     if (!shpchp_wq)
472     return -ENOMEM;
473    
474     - shpchp_ordered_wq = alloc_ordered_workqueue("shpchp_ordered", 0);
475     - if (!shpchp_ordered_wq) {
476     - destroy_workqueue(shpchp_wq);
477     - return -ENOMEM;
478     - }
479     -
480     retval = pci_register_driver(&shpc_driver);
481     dbg("%s: pci_register_driver = %d\n", __func__, retval);
482     info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
483     if (retval) {
484     - destroy_workqueue(shpchp_ordered_wq);
485     destroy_workqueue(shpchp_wq);
486     }
487     return retval;
488     @@ -384,7 +375,6 @@ static void __exit shpcd_cleanup(void)
489     {
490     dbg("unload_shpchpd()\n");
491     pci_unregister_driver(&shpc_driver);
492     - destroy_workqueue(shpchp_ordered_wq);
493     destroy_workqueue(shpchp_wq);
494     info(DRIVER_DESC " version: " DRIVER_VERSION " unloaded\n");
495     }
496     diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c
497     index b00b09b..bba5b3e 100644
498     --- a/drivers/pci/hotplug/shpchp_ctrl.c
499     +++ b/drivers/pci/hotplug/shpchp_ctrl.c
500     @@ -456,7 +456,7 @@ void shpchp_queue_pushbutton_work(struct work_struct *work)
501     kfree(info);
502     goto out;
503     }
504     - queue_work(shpchp_ordered_wq, &info->work);
505     + queue_work(shpchp_wq, &info->work);
506     out:
507     mutex_unlock(&p_slot->lock);
508     }
509     diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
510     index 0ca0535..a56105b 100644
511     --- a/drivers/pci/pcie/aer/aerdrv_core.c
512     +++ b/drivers/pci/pcie/aer/aerdrv_core.c
513     @@ -637,6 +637,7 @@ static void aer_recover_work_func(struct work_struct *work)
514     continue;
515     }
516     do_recovery(pdev, entry.severity);
517     + pci_dev_put(pdev);
518     }
519     }
520     #endif
521     diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
522     index b500840..474f22f 100644
523     --- a/drivers/pci/pcie/aspm.c
524     +++ b/drivers/pci/pcie/aspm.c
525     @@ -798,6 +798,9 @@ void pcie_clear_aspm(struct pci_bus *bus)
526     {
527     struct pci_dev *child;
528    
529     + if (aspm_force)
530     + return;
531     +
532     /*
533     * Clear any ASPM setup that the firmware has carried out on this bus
534     */
535     diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
536     index a239382..5b3cadb 100644
537     --- a/drivers/scsi/sd.c
538     +++ b/drivers/scsi/sd.c
539     @@ -2919,10 +2919,6 @@ static int __init init_sd(void)
540     if (err)
541     goto err_out;
542    
543     - err = scsi_register_driver(&sd_template.gendrv);
544     - if (err)
545     - goto err_out_class;
546     -
547     sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
548     0, 0, NULL);
549     if (!sd_cdb_cache) {
550     @@ -2936,8 +2932,15 @@ static int __init init_sd(void)
551     goto err_out_cache;
552     }
553    
554     + err = scsi_register_driver(&sd_template.gendrv);
555     + if (err)
556     + goto err_out_driver;
557     +
558     return 0;
559    
560     +err_out_driver:
561     + mempool_destroy(sd_cdb_pool);
562     +
563     err_out_cache:
564     kmem_cache_destroy(sd_cdb_cache);
565    
566     @@ -2960,10 +2963,10 @@ static void __exit exit_sd(void)
567    
568     SCSI_LOG_HLQUEUE(3, printk("exit_sd: exiting sd driver\n"));
569    
570     + scsi_unregister_driver(&sd_template.gendrv);
571     mempool_destroy(sd_cdb_pool);
572     kmem_cache_destroy(sd_cdb_cache);
573    
574     - scsi_unregister_driver(&sd_template.gendrv);
575     class_unregister(&sd_disk_class);
576    
577     for (i = 0; i < SD_MAJORS; i++)
578     diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
579     index cee0c3e..f62629b 100644
580     --- a/drivers/usb/dwc3/gadget.c
581     +++ b/drivers/usb/dwc3/gadget.c
582     @@ -1453,6 +1453,7 @@ static int __devinit dwc3_gadget_init_endpoints(struct dwc3 *dwc)
583    
584     if (epnum == 0 || epnum == 1) {
585     dep->endpoint.maxpacket = 512;
586     + dep->endpoint.maxburst = 1;
587     dep->endpoint.ops = &dwc3_gadget_ep0_ops;
588     if (!epnum)
589     dwc->gadget.ep0 = &dep->endpoint;
590     diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
591     index e4db350..3fe069f 100644
592     --- a/drivers/usb/host/uhci-hcd.c
593     +++ b/drivers/usb/host/uhci-hcd.c
594     @@ -447,6 +447,10 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
595     return IRQ_NONE;
596     uhci_writew(uhci, status, USBSTS); /* Clear it */
597    
598     + spin_lock(&uhci->lock);
599     + if (unlikely(!uhci->is_initialized)) /* not yet configured */
600     + goto done;
601     +
602     if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
603     if (status & USBSTS_HSE)
604     dev_err(uhci_dev(uhci), "host system error, "
605     @@ -455,7 +459,6 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
606     dev_err(uhci_dev(uhci), "host controller process "
607     "error, something bad happened!\n");
608     if (status & USBSTS_HCH) {
609     - spin_lock(&uhci->lock);
610     if (uhci->rh_state >= UHCI_RH_RUNNING) {
611     dev_err(uhci_dev(uhci),
612     "host controller halted, "
613     @@ -473,15 +476,15 @@ static irqreturn_t uhci_irq(struct usb_hcd *hcd)
614     * pending unlinks */
615     mod_timer(&hcd->rh_timer, jiffies);
616     }
617     - spin_unlock(&uhci->lock);
618     }
619     }
620    
621     - if (status & USBSTS_RD)
622     + if (status & USBSTS_RD) {
623     + spin_unlock(&uhci->lock);
624     usb_hcd_poll_rh_status(hcd);
625     - else {
626     - spin_lock(&uhci->lock);
627     + } else {
628     uhci_scan_schedule(uhci);
629     + done:
630     spin_unlock(&uhci->lock);
631     }
632    
633     @@ -662,9 +665,9 @@ static int uhci_start(struct usb_hcd *hcd)
634     */
635     mb();
636    
637     + spin_lock_irq(&uhci->lock);
638     configure_hc(uhci);
639     uhci->is_initialized = 1;
640     - spin_lock_irq(&uhci->lock);
641     start_rh(uhci);
642     spin_unlock_irq(&uhci->lock);
643     return 0;
644     diff --git a/include/linux/sched.h b/include/linux/sched.h
645     index 48241aa..3dd0efb 100644
646     --- a/include/linux/sched.h
647     +++ b/include/linux/sched.h
648     @@ -2695,7 +2695,16 @@ static inline void thread_group_cputime_init(struct signal_struct *sig)
649     extern void recalc_sigpending_and_wake(struct task_struct *t);
650     extern void recalc_sigpending(void);
651    
652     -extern void signal_wake_up(struct task_struct *t, int resume_stopped);
653     +extern void signal_wake_up_state(struct task_struct *t, unsigned int state);
654     +
655     +static inline void signal_wake_up(struct task_struct *t, bool resume)
656     +{
657     + signal_wake_up_state(t, resume ? TASK_WAKEKILL : 0);
658     +}
659     +static inline void ptrace_signal_wake_up(struct task_struct *t, bool resume)
660     +{
661     + signal_wake_up_state(t, resume ? __TASK_TRACED : 0);
662     +}
663    
664     /*
665     * Wrappers for p->thread_info->cpu access. No-op on UP.
666     diff --git a/kernel/ptrace.c b/kernel/ptrace.c
667     index ee8d49b..daf4394 100644
668     --- a/kernel/ptrace.c
669     +++ b/kernel/ptrace.c
670     @@ -117,11 +117,45 @@ void __ptrace_unlink(struct task_struct *child)
671     * TASK_KILLABLE sleeps.
672     */
673     if (child->jobctl & JOBCTL_STOP_PENDING || task_is_traced(child))
674     - signal_wake_up(child, task_is_traced(child));
675     + ptrace_signal_wake_up(child, true);
676    
677     spin_unlock(&child->sighand->siglock);
678     }
679    
680     +/* Ensure that nothing can wake it up, even SIGKILL */
681     +static bool ptrace_freeze_traced(struct task_struct *task)
682     +{
683     + bool ret = false;
684     +
685     + /* Lockless, nobody but us can set this flag */
686     + if (task->jobctl & JOBCTL_LISTENING)
687     + return ret;
688     +
689     + spin_lock_irq(&task->sighand->siglock);
690     + if (task_is_traced(task) && !__fatal_signal_pending(task)) {
691     + task->state = __TASK_TRACED;
692     + ret = true;
693     + }
694     + spin_unlock_irq(&task->sighand->siglock);
695     +
696     + return ret;
697     +}
698     +
699     +static void ptrace_unfreeze_traced(struct task_struct *task)
700     +{
701     + if (task->state != __TASK_TRACED)
702     + return;
703     +
704     + WARN_ON(!task->ptrace || task->parent != current);
705     +
706     + spin_lock_irq(&task->sighand->siglock);
707     + if (__fatal_signal_pending(task))
708     + wake_up_state(task, __TASK_TRACED);
709     + else
710     + task->state = TASK_TRACED;
711     + spin_unlock_irq(&task->sighand->siglock);
712     +}
713     +
714     /**
715     * ptrace_check_attach - check whether ptracee is ready for ptrace operation
716     * @child: ptracee to check for
717     @@ -151,24 +185,29 @@ int ptrace_check_attach(struct task_struct *child, bool ignore_state)
718     * be changed by us so it's not changing right after this.
719     */
720     read_lock(&tasklist_lock);
721     - if ((child->ptrace & PT_PTRACED) && child->parent == current) {
722     + if (child->ptrace && child->parent == current) {
723     + WARN_ON(child->state == __TASK_TRACED);
724     /*
725     * child->sighand can't be NULL, release_task()
726     * does ptrace_unlink() before __exit_signal().
727     */
728     - spin_lock_irq(&child->sighand->siglock);
729     - WARN_ON_ONCE(task_is_stopped(child));
730     - if (ignore_state || (task_is_traced(child) &&
731     - !(child->jobctl & JOBCTL_LISTENING)))
732     + if (ignore_state || ptrace_freeze_traced(child))
733     ret = 0;
734     - spin_unlock_irq(&child->sighand->siglock);
735     }
736     read_unlock(&tasklist_lock);
737    
738     - if (!ret && !ignore_state)
739     - ret = wait_task_inactive(child, TASK_TRACED) ? 0 : -ESRCH;
740     + if (!ret && !ignore_state) {
741     + if (!wait_task_inactive(child, __TASK_TRACED)) {
742     + /*
743     + * This can only happen if may_ptrace_stop() fails and
744     + * ptrace_stop() changes ->state back to TASK_RUNNING,
745     + * so we should not worry about leaking __TASK_TRACED.
746     + */
747     + WARN_ON(child->state == __TASK_TRACED);
748     + ret = -ESRCH;
749     + }
750     + }
751    
752     - /* All systems go.. */
753     return ret;
754     }
755    
756     @@ -311,7 +350,7 @@ static int ptrace_attach(struct task_struct *task, long request,
757     */
758     if (task_is_stopped(task) &&
759     task_set_jobctl_pending(task, JOBCTL_TRAP_STOP | JOBCTL_TRAPPING))
760     - signal_wake_up(task, 1);
761     + signal_wake_up_state(task, __TASK_STOPPED);
762    
763     spin_unlock(&task->sighand->siglock);
764    
765     @@ -728,7 +767,7 @@ int ptrace_request(struct task_struct *child, long request,
766     * tracee into STOP.
767     */
768     if (likely(task_set_jobctl_pending(child, JOBCTL_TRAP_STOP)))
769     - signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);
770     + ptrace_signal_wake_up(child, child->jobctl & JOBCTL_LISTENING);
771    
772     unlock_task_sighand(child, &flags);
773     ret = 0;
774     @@ -754,7 +793,7 @@ int ptrace_request(struct task_struct *child, long request,
775     * start of this trap and now. Trigger re-trap.
776     */
777     if (child->jobctl & JOBCTL_TRAP_NOTIFY)
778     - signal_wake_up(child, true);
779     + ptrace_signal_wake_up(child, true);
780     ret = 0;
781     }
782     unlock_task_sighand(child, &flags);
783     @@ -891,6 +930,8 @@ SYSCALL_DEFINE4(ptrace, long, request, long, pid, unsigned long, addr,
784     goto out_put_task_struct;
785    
786     ret = arch_ptrace(child, request, addr, data);
787     + if (ret || request != PTRACE_DETACH)
788     + ptrace_unfreeze_traced(child);
789    
790     out_put_task_struct:
791     put_task_struct(child);
792     @@ -1030,8 +1071,11 @@ asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid,
793    
794     ret = ptrace_check_attach(child, request == PTRACE_KILL ||
795     request == PTRACE_INTERRUPT);
796     - if (!ret)
797     + if (!ret) {
798     ret = compat_arch_ptrace(child, request, addr, data);
799     + if (ret || request != PTRACE_DETACH)
800     + ptrace_unfreeze_traced(child);
801     + }
802    
803     out_put_task_struct:
804     put_task_struct(child);
805     diff --git a/kernel/sched/core.c b/kernel/sched/core.c
806     index 1d22981..e1718bc 100644
807     --- a/kernel/sched/core.c
808     +++ b/kernel/sched/core.c
809     @@ -1688,7 +1688,8 @@ out:
810     */
811     int wake_up_process(struct task_struct *p)
812     {
813     - return try_to_wake_up(p, TASK_ALL, 0);
814     + WARN_ON(task_is_stopped_or_traced(p));
815     + return try_to_wake_up(p, TASK_NORMAL, 0);
816     }
817     EXPORT_SYMBOL(wake_up_process);
818    
819     diff --git a/kernel/signal.c b/kernel/signal.c
820     index 17afcaf..a4363a9 100644
821     --- a/kernel/signal.c
822     +++ b/kernel/signal.c
823     @@ -677,23 +677,17 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info)
824     * No need to set need_resched since signal event passing
825     * goes through ->blocked
826     */
827     -void signal_wake_up(struct task_struct *t, int resume)
828     +void signal_wake_up_state(struct task_struct *t, unsigned int state)
829     {
830     - unsigned int mask;
831     -
832     set_tsk_thread_flag(t, TIF_SIGPENDING);
833     -
834     /*
835     - * For SIGKILL, we want to wake it up in the stopped/traced/killable
836     + * TASK_WAKEKILL also means wake it up in the stopped/traced/killable
837     * case. We don't check t->state here because there is a race with it
838     * executing another processor and just now entering stopped state.
839     * By using wake_up_state, we ensure the process will wake up and
840     * handle its death signal.
841     */
842     - mask = TASK_INTERRUPTIBLE;
843     - if (resume)
844     - mask |= TASK_WAKEKILL;
845     - if (!wake_up_state(t, mask))
846     + if (!wake_up_state(t, state | TASK_INTERRUPTIBLE))
847     kick_process(t);
848     }
849    
850     @@ -842,7 +836,7 @@ static void ptrace_trap_notify(struct task_struct *t)
851     assert_spin_locked(&t->sighand->siglock);
852    
853     task_set_jobctl_pending(t, JOBCTL_TRAP_NOTIFY);
854     - signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
855     + ptrace_signal_wake_up(t, t->jobctl & JOBCTL_LISTENING);
856     }
857    
858     /*
859     @@ -1808,6 +1802,10 @@ static inline int may_ptrace_stop(void)
860     * If SIGKILL was already sent before the caller unlocked
861     * ->siglock we must see ->core_state != NULL. Otherwise it
862     * is safe to enter schedule().
863     + *
864     + * This is almost outdated, a task with the pending SIGKILL can't
865     + * block in TASK_TRACED. But PTRACE_EVENT_EXIT can be reported
866     + * after SIGKILL was already dequeued.
867     */
868     if (unlikely(current->mm->core_state) &&
869     unlikely(current->mm == current->parent->mm))
870     @@ -1933,6 +1931,7 @@ static void ptrace_stop(int exit_code, int why, int clear_code, siginfo_t *info)
871     if (gstop_done)
872     do_notify_parent_cldstop(current, false, why);
873    
874     + /* tasklist protects us from ptrace_freeze_traced() */
875     __set_current_state(TASK_RUNNING);
876     if (clear_code)
877     current->exit_code = 0;
878     diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
879     index 100b7fd..6b194d8 100644
880     --- a/kernel/trace/ftrace.c
881     +++ b/kernel/trace/ftrace.c
882     @@ -3869,7 +3869,7 @@ static int ftrace_module_notify(struct notifier_block *self,
883    
884     struct notifier_block ftrace_module_nb = {
885     .notifier_call = ftrace_module_notify,
886     - .priority = 0,
887     + .priority = INT_MAX, /* Run before anything that can use kprobes */
888     };
889    
890     extern unsigned long __start_mcount_loc[];
891     diff --git a/security/integrity/evm/evm_crypto.c b/security/integrity/evm/evm_crypto.c
892     index 49a464f..62fa2c5 100644
893     --- a/security/integrity/evm/evm_crypto.c
894     +++ b/security/integrity/evm/evm_crypto.c
895     @@ -205,9 +205,9 @@ int evm_update_evmxattr(struct dentry *dentry, const char *xattr_name,
896     rc = __vfs_setxattr_noperm(dentry, XATTR_NAME_EVM,
897     &xattr_data,
898     sizeof(xattr_data), 0);
899     - }
900     - else if (rc == -ENODATA)
901     + } else if (rc == -ENODATA && inode->i_op->removexattr) {
902     rc = inode->i_op->removexattr(dentry, XATTR_NAME_EVM);
903     + }
904     return rc;
905     }
906    
907     diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
908     index 24c5114..9ab2b3e 100644
909     --- a/sound/usb/endpoint.c
910     +++ b/sound/usb/endpoint.c
911     @@ -148,10 +148,8 @@ void snd_usb_release_substream_urbs(struct snd_usb_substream *subs, int force)
912     int i;
913    
914     /* stop urbs (to be sure) */
915     - if (!subs->stream->chip->shutdown) {
916     - deactivate_urbs(subs, force, 1);
917     - wait_clear_urbs(subs);
918     - }
919     + deactivate_urbs(subs, force, 1);
920     + wait_clear_urbs(subs);
921    
922     for (i = 0; i < MAX_URBS; i++)
923     release_urb_ctx(&subs->dataurb[i]);