Magellan Linux

Annotation of /trunk/kernel-lts/patches-3.4/0143-3.4.44-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2203 - (hide annotations) (download)
Thu Jun 13 10:38:14 2013 UTC (10 years, 11 months ago) by niro
File size: 57581 byte(s)
-linux-3.4.44
1 niro 2203 diff --git a/arch/arm/configs/at91sam9g45_defconfig b/arch/arm/configs/at91sam9g45_defconfig
2     index 606d48f..8aab786 100644
3     --- a/arch/arm/configs/at91sam9g45_defconfig
4     +++ b/arch/arm/configs/at91sam9g45_defconfig
5     @@ -173,7 +173,6 @@ CONFIG_MMC=y
6     # CONFIG_MMC_BLOCK_BOUNCE is not set
7     CONFIG_SDIO_UART=m
8     CONFIG_MMC_ATMELMCI=y
9     -CONFIG_MMC_ATMELMCI_DMA=y
10     CONFIG_LEDS_ATMEL_PWM=y
11     CONFIG_LEDS_GPIO=y
12     CONFIG_LEDS_TRIGGER_TIMER=y
13     diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
14     index 41dc31f..cc5e50f 100644
15     --- a/arch/arm/include/asm/pgtable.h
16     +++ b/arch/arm/include/asm/pgtable.h
17     @@ -61,6 +61,15 @@ extern void __pgd_error(const char *file, int line, pgd_t);
18     #define FIRST_USER_ADDRESS PAGE_SIZE
19    
20     /*
21     + * Use TASK_SIZE as the ceiling argument for free_pgtables() and
22     + * free_pgd_range() to avoid freeing the modules pmd when LPAE is enabled (pmd
23     + * page shared between user and kernel).
24     + */
25     +#ifdef CONFIG_ARM_LPAE
26     +#define USER_PGTABLES_CEILING TASK_SIZE
27     +#endif
28     +
29     +/*
30     * The pgprot_* and protection_map entries will be fixed up in runtime
31     * to include the cachable and bufferable bits based on memory policy,
32     * as well as any architecture dependent bits like global/ASID and SMP
33     diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
34     index 55293a7..5db5174 100644
35     --- a/arch/arm/mach-at91/setup.c
36     +++ b/arch/arm/mach-at91/setup.c
37     @@ -326,7 +326,7 @@ static void at91_dt_rstc(void)
38    
39     of_id = of_match_node(rstc_ids, np);
40     if (!of_id)
41     - panic("AT91: rtsc no restart function availlable\n");
42     + panic("AT91: rtsc no restart function available\n");
43    
44     arm_pm_restart = of_id->data;
45    
46     diff --git a/arch/avr32/configs/favr-32_defconfig b/arch/avr32/configs/favr-32_defconfig
47     index 19973b0..59e4cc9 100644
48     --- a/arch/avr32/configs/favr-32_defconfig
49     +++ b/arch/avr32/configs/favr-32_defconfig
50     @@ -122,7 +122,6 @@ CONFIG_USB_G_SERIAL=m
51     CONFIG_USB_CDC_COMPOSITE=m
52     CONFIG_MMC=y
53     CONFIG_MMC_ATMELMCI=y
54     -CONFIG_MMC_ATMELMCI_DMA=y
55     CONFIG_NEW_LEDS=y
56     CONFIG_LEDS_CLASS=y
57     CONFIG_LEDS_ATMEL_PWM=m
58     diff --git a/arch/avr32/configs/merisc_defconfig b/arch/avr32/configs/merisc_defconfig
59     index 3befab9..65de443 100644
60     --- a/arch/avr32/configs/merisc_defconfig
61     +++ b/arch/avr32/configs/merisc_defconfig
62     @@ -102,7 +102,6 @@ CONFIG_FRAMEBUFFER_CONSOLE=y
63     CONFIG_LOGO=y
64     CONFIG_MMC=y
65     CONFIG_MMC_ATMELMCI=y
66     -CONFIG_MMC_ATMELMCI_DMA=y
67     CONFIG_NEW_LEDS=y
68     CONFIG_LEDS_CLASS=y
69     CONFIG_LEDS_ATMEL_PWM=y
70     diff --git a/arch/ia64/include/asm/futex.h b/arch/ia64/include/asm/futex.h
71     index d2bf1fd..76acbcd 100644
72     --- a/arch/ia64/include/asm/futex.h
73     +++ b/arch/ia64/include/asm/futex.h
74     @@ -106,16 +106,15 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
75     return -EFAULT;
76    
77     {
78     - register unsigned long r8 __asm ("r8");
79     + register unsigned long r8 __asm ("r8") = 0;
80     unsigned long prev;
81     __asm__ __volatile__(
82     " mf;; \n"
83     - " mov %0=r0 \n"
84     " mov ar.ccv=%4;; \n"
85     "[1:] cmpxchg4.acq %1=[%2],%3,ar.ccv \n"
86     " .xdata4 \"__ex_table\", 1b-., 2f-. \n"
87     "[2:]"
88     - : "=r" (r8), "=r" (prev)
89     + : "+r" (r8), "=&r" (prev)
90     : "r" (uaddr), "r" (newval),
91     "rO" ((long) (unsigned) oldval)
92     : "memory");
93     diff --git a/arch/ia64/include/asm/mca.h b/arch/ia64/include/asm/mca.h
94     index 43f96ab..8c70961 100644
95     --- a/arch/ia64/include/asm/mca.h
96     +++ b/arch/ia64/include/asm/mca.h
97     @@ -143,6 +143,7 @@ extern unsigned long __per_cpu_mca[NR_CPUS];
98     extern int cpe_vector;
99     extern int ia64_cpe_irq;
100     extern void ia64_mca_init(void);
101     +extern void ia64_mca_irq_init(void);
102     extern void ia64_mca_cpu_init(void *);
103     extern void ia64_os_mca_dispatch(void);
104     extern void ia64_os_mca_dispatch_end(void);
105     diff --git a/arch/ia64/kernel/irq.c b/arch/ia64/kernel/irq.c
106     index ad69606..f2c41828 100644
107     --- a/arch/ia64/kernel/irq.c
108     +++ b/arch/ia64/kernel/irq.c
109     @@ -23,6 +23,8 @@
110     #include <linux/interrupt.h>
111     #include <linux/kernel_stat.h>
112    
113     +#include <asm/mca.h>
114     +
115     /*
116     * 'what should we do if we get a hw irq event on an illegal vector'.
117     * each architecture has to answer this themselves.
118     @@ -83,6 +85,12 @@ bool is_affinity_mask_valid(const struct cpumask *cpumask)
119    
120     #endif /* CONFIG_SMP */
121    
122     +int __init arch_early_irq_init(void)
123     +{
124     + ia64_mca_irq_init();
125     + return 0;
126     +}
127     +
128     #ifdef CONFIG_HOTPLUG_CPU
129     unsigned int vectors_in_migration[NR_IRQS];
130    
131     diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
132     index 65bf9cd..d7396db 100644
133     --- a/arch/ia64/kernel/mca.c
134     +++ b/arch/ia64/kernel/mca.c
135     @@ -2074,22 +2074,16 @@ ia64_mca_init(void)
136     printk(KERN_INFO "MCA related initialization done\n");
137     }
138    
139     +
140     /*
141     - * ia64_mca_late_init
142     - *
143     - * Opportunity to setup things that require initialization later
144     - * than ia64_mca_init. Setup a timer to poll for CPEs if the
145     - * platform doesn't support an interrupt driven mechanism.
146     - *
147     - * Inputs : None
148     - * Outputs : Status
149     + * These pieces cannot be done in ia64_mca_init() because it is called before
150     + * early_irq_init() which would wipe out our percpu irq registrations. But we
151     + * cannot leave them until ia64_mca_late_init() because by then all the other
152     + * processors have been brought online and have set their own CMC vectors to
153     + * point at a non-existant action. Called from arch_early_irq_init().
154     */
155     -static int __init
156     -ia64_mca_late_init(void)
157     +void __init ia64_mca_irq_init(void)
158     {
159     - if (!mca_init)
160     - return 0;
161     -
162     /*
163     * Configure the CMCI/P vector and handler. Interrupts for CMC are
164     * per-processor, so AP CMC interrupts are setup in smp_callin() (smpboot.c).
165     @@ -2108,6 +2102,23 @@ ia64_mca_late_init(void)
166     /* Setup the CPEI/P handler */
167     register_percpu_irq(IA64_CPEP_VECTOR, &mca_cpep_irqaction);
168     #endif
169     +}
170     +
171     +/*
172     + * ia64_mca_late_init
173     + *
174     + * Opportunity to setup things that require initialization later
175     + * than ia64_mca_init. Setup a timer to poll for CPEs if the
176     + * platform doesn't support an interrupt driven mechanism.
177     + *
178     + * Inputs : None
179     + * Outputs : Status
180     + */
181     +static int __init
182     +ia64_mca_late_init(void)
183     +{
184     + if (!mca_init)
185     + return 0;
186    
187     register_hotcpu_notifier(&mca_cpu_notifier);
188    
189     diff --git a/arch/ia64/kvm/vtlb.c b/arch/ia64/kvm/vtlb.c
190     index 4332f7e..a7869f8 100644
191     --- a/arch/ia64/kvm/vtlb.c
192     +++ b/arch/ia64/kvm/vtlb.c
193     @@ -256,7 +256,7 @@ u64 guest_vhpt_lookup(u64 iha, u64 *pte)
194     "srlz.d;;"
195     "ssm psr.i;;"
196     "srlz.d;;"
197     - : "=r"(ret) : "r"(iha), "r"(pte):"memory");
198     + : "=&r"(ret) : "r"(iha), "r"(pte) : "memory");
199    
200     return ret;
201     }
202     diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
203     index 9e07bd0..1a3607b 100644
204     --- a/arch/powerpc/kernel/head_64.S
205     +++ b/arch/powerpc/kernel/head_64.S
206     @@ -489,6 +489,7 @@ _GLOBAL(copy_and_flush)
207     sync
208     addi r5,r5,8
209     addi r6,r6,8
210     + isync
211     blr
212    
213     .align 8
214     diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
215     index 1d75c92..ad697f8 100644
216     --- a/arch/powerpc/platforms/cell/spufs/inode.c
217     +++ b/arch/powerpc/platforms/cell/spufs/inode.c
218     @@ -99,6 +99,7 @@ spufs_new_inode(struct super_block *sb, umode_t mode)
219     if (!inode)
220     goto out;
221    
222     + inode->i_ino = get_next_ino();
223     inode->i_mode = mode;
224     inode->i_uid = current_fsuid();
225     inode->i_gid = current_fsgid();
226     diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
227     index 3dafc60..a14a835 100644
228     --- a/arch/x86/kernel/irq.c
229     +++ b/arch/x86/kernel/irq.c
230     @@ -165,10 +165,6 @@ u64 arch_irq_stat_cpu(unsigned int cpu)
231     u64 arch_irq_stat(void)
232     {
233     u64 sum = atomic_read(&irq_err_count);
234     -
235     -#ifdef CONFIG_X86_IO_APIC
236     - sum += atomic_read(&irq_mis_count);
237     -#endif
238     return sum;
239     }
240    
241     diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
242     index 8375622..8c45818 100644
243     --- a/arch/x86/kvm/emulate.c
244     +++ b/arch/x86/kvm/emulate.c
245     @@ -3737,6 +3737,10 @@ static int decode_operand(struct x86_emulate_ctxt *ctxt, struct operand *op,
246     break;
247     case OpMem8:
248     ctxt->memop.bytes = 1;
249     + if (ctxt->memop.type == OP_REG) {
250     + ctxt->memop.addr.reg = decode_register(ctxt, ctxt->modrm_rm, 1);
251     + fetch_register_operand(&ctxt->memop);
252     + }
253     goto mem_common;
254     case OpMem16:
255     ctxt->memop.bytes = 2;
256     diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
257     index 194dbcd..2992678 100644
258     --- a/arch/x86/xen/enlighten.c
259     +++ b/arch/x86/xen/enlighten.c
260     @@ -1515,8 +1515,11 @@ static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
261     switch (action) {
262     case CPU_UP_PREPARE:
263     xen_vcpu_setup(cpu);
264     - if (xen_have_vector_callback)
265     + if (xen_have_vector_callback) {
266     xen_init_lock_cpu(cpu);
267     + if (xen_feature(XENFEAT_hvm_safe_pvclock))
268     + xen_setup_timer(cpu);
269     + }
270     break;
271     default:
272     break;
273     diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
274     index 0296a95..054cc01 100644
275     --- a/arch/x86/xen/time.c
276     +++ b/arch/x86/xen/time.c
277     @@ -497,7 +497,11 @@ static void xen_hvm_setup_cpu_clockevents(void)
278     {
279     int cpu = smp_processor_id();
280     xen_setup_runstate_info(cpu);
281     - xen_setup_timer(cpu);
282     + /*
283     + * xen_setup_timer(cpu) - snprintf is bad in atomic context. Hence
284     + * doing it xen_hvm_cpu_notify (which gets called by smp_init during
285     + * early bootup and also during CPU hotplug events).
286     + */
287     xen_setup_cpu_clockevents();
288     }
289    
290     diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
291     index 7aff631..5b0f075 100644
292     --- a/drivers/acpi/pci_root.c
293     +++ b/drivers/acpi/pci_root.c
294     @@ -247,8 +247,8 @@ static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root,
295     *control &= OSC_PCI_CONTROL_MASKS;
296     capbuf[OSC_CONTROL_TYPE] = *control | root->osc_control_set;
297     } else {
298     - /* Run _OSC query for all possible controls. */
299     - capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS;
300     + /* Run _OSC query only with existing controls. */
301     + capbuf[OSC_CONTROL_TYPE] = root->osc_control_set;
302     }
303    
304     status = acpi_pci_run_osc(root->device->handle, capbuf, &result);
305     diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
306     index 2bded76..d70106e 100644
307     --- a/drivers/i2c/busses/i2c-xiic.c
308     +++ b/drivers/i2c/busses/i2c-xiic.c
309     @@ -311,10 +311,8 @@ static void xiic_fill_tx_fifo(struct xiic_i2c *i2c)
310     /* last message in transfer -> STOP */
311     data |= XIIC_TX_DYN_STOP_MASK;
312     dev_dbg(i2c->adap.dev.parent, "%s TX STOP\n", __func__);
313     -
314     - xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data);
315     - } else
316     - xiic_setreg8(i2c, XIIC_DTR_REG_OFFSET, data);
317     + }
318     + xiic_setreg16(i2c, XIIC_DTR_REG_OFFSET, data);
319     }
320     }
321    
322     diff --git a/drivers/md/md.c b/drivers/md/md.c
323     index e0930bb..7b45b5e 100644
324     --- a/drivers/md/md.c
325     +++ b/drivers/md/md.c
326     @@ -1587,8 +1587,8 @@ static int super_1_load(struct md_rdev *rdev, struct md_rdev *refdev, int minor_
327     sector, count, 1) == 0)
328     return -EINVAL;
329     }
330     - } else if (sb->bblog_offset == 0)
331     - rdev->badblocks.shift = -1;
332     + } else if (sb->bblog_offset != 0)
333     + rdev->badblocks.shift = 0;
334    
335     if (!refdev) {
336     ret = 1;
337     @@ -3107,7 +3107,7 @@ int md_rdev_init(struct md_rdev *rdev)
338     * be used - I wonder if that matters
339     */
340     rdev->badblocks.count = 0;
341     - rdev->badblocks.shift = 0;
342     + rdev->badblocks.shift = -1; /* disabled until explicitly enabled */
343     rdev->badblocks.page = kmalloc(PAGE_SIZE, GFP_KERNEL);
344     seqlock_init(&rdev->badblocks.lock);
345     if (rdev->badblocks.page == NULL)
346     @@ -3179,9 +3179,6 @@ static struct md_rdev *md_import_device(dev_t newdev, int super_format, int supe
347     goto abort_free;
348     }
349     }
350     - if (super_format == -1)
351     - /* hot-add for 0.90, or non-persistent: so no badblocks */
352     - rdev->badblocks.shift = -1;
353    
354     return rdev;
355    
356     diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c
357     index 8d816cc..105f820 100644
358     --- a/drivers/mfd/adp5520.c
359     +++ b/drivers/mfd/adp5520.c
360     @@ -36,6 +36,7 @@ struct adp5520_chip {
361     struct blocking_notifier_head notifier_list;
362     int irq;
363     unsigned long id;
364     + uint8_t mode;
365     };
366    
367     static int __adp5520_read(struct i2c_client *client,
368     @@ -326,7 +327,10 @@ static int adp5520_suspend(struct device *dev)
369     struct i2c_client *client = to_i2c_client(dev);
370     struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
371    
372     - adp5520_clr_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
373     + adp5520_read(chip->dev, ADP5520_MODE_STATUS, &chip->mode);
374     + /* All other bits are W1C */
375     + chip->mode &= ADP5520_BL_EN | ADP5520_DIM_EN | ADP5520_nSTNBY;
376     + adp5520_write(chip->dev, ADP5520_MODE_STATUS, 0);
377     return 0;
378     }
379    
380     @@ -335,7 +339,7 @@ static int adp5520_resume(struct device *dev)
381     struct i2c_client *client = to_i2c_client(dev);
382     struct adp5520_chip *chip = dev_get_drvdata(&client->dev);
383    
384     - adp5520_set_bits(chip->dev, ADP5520_MODE_STATUS, ADP5520_nSTNBY);
385     + adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode);
386     return 0;
387     }
388     #endif
389     diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
390     index 54df5ad..5352cd7 100644
391     --- a/drivers/mmc/core/mmc.c
392     +++ b/drivers/mmc/core/mmc.c
393     @@ -385,13 +385,13 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
394     ext_csd[EXT_CSD_SEC_FEATURE_SUPPORT];
395     card->ext_csd.raw_trim_mult =
396     ext_csd[EXT_CSD_TRIM_MULT];
397     + card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT];
398     if (card->ext_csd.rev >= 4) {
399     /*
400     * Enhanced area feature support -- check whether the eMMC
401     * card has the Enhanced area enabled. If so, export enhanced
402     * area offset and size to user by adding sysfs interface.
403     */
404     - card->ext_csd.raw_partition_support = ext_csd[EXT_CSD_PARTITION_SUPPORT];
405     if ((ext_csd[EXT_CSD_PARTITION_SUPPORT] & 0x2) &&
406     (ext_csd[EXT_CSD_PARTITION_ATTRIBUTE] & 0x1)) {
407     hc_erase_grp_sz =
408     diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
409     index 2bc06e7..dbdd907 100644
410     --- a/drivers/mmc/host/Kconfig
411     +++ b/drivers/mmc/host/Kconfig
412     @@ -297,16 +297,6 @@ config MMC_ATMELMCI
413    
414     endchoice
415    
416     -config MMC_ATMELMCI_DMA
417     - bool "Atmel MCI DMA support"
418     - depends on MMC_ATMELMCI && (AVR32 || ARCH_AT91SAM9G45) && DMA_ENGINE
419     - help
420     - Say Y here to have the Atmel MCI driver use a DMA engine to
421     - do data transfers and thus increase the throughput and
422     - reduce the CPU utilization.
423     -
424     - If unsure, say N.
425     -
426     config MMC_IMX
427     tristate "Motorola i.MX Multimedia Card Interface support"
428     depends on ARCH_MX1
429     diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
430     index e94476b..2a822d9 100644
431     --- a/drivers/mmc/host/atmel-mci.c
432     +++ b/drivers/mmc/host/atmel-mci.c
433     @@ -165,6 +165,7 @@ struct atmel_mci {
434     void __iomem *regs;
435    
436     struct scatterlist *sg;
437     + unsigned int sg_len;
438     unsigned int pio_offset;
439    
440     struct atmel_mci_slot *cur_slot;
441     @@ -754,6 +755,7 @@ static u32 atmci_prepare_data(struct atmel_mci *host, struct mmc_data *data)
442     data->error = -EINPROGRESS;
443    
444     host->sg = data->sg;
445     + host->sg_len = data->sg_len;
446     host->data = data;
447     host->data_chan = NULL;
448    
449     @@ -1592,7 +1594,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
450     if (offset == sg->length) {
451     flush_dcache_page(sg_page(sg));
452     host->sg = sg = sg_next(sg);
453     - if (!sg)
454     + host->sg_len--;
455     + if (!sg || !host->sg_len)
456     goto done;
457    
458     offset = 0;
459     @@ -1605,7 +1608,8 @@ static void atmci_read_data_pio(struct atmel_mci *host)
460    
461     flush_dcache_page(sg_page(sg));
462     host->sg = sg = sg_next(sg);
463     - if (!sg)
464     + host->sg_len--;
465     + if (!sg || !host->sg_len)
466     goto done;
467    
468     offset = 4 - remaining;
469     @@ -1659,7 +1663,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
470     nbytes += 4;
471     if (offset == sg->length) {
472     host->sg = sg = sg_next(sg);
473     - if (!sg)
474     + host->sg_len--;
475     + if (!sg || !host->sg_len)
476     goto done;
477    
478     offset = 0;
479     @@ -1673,7 +1678,8 @@ static void atmci_write_data_pio(struct atmel_mci *host)
480     nbytes += remaining;
481    
482     host->sg = sg = sg_next(sg);
483     - if (!sg) {
484     + host->sg_len--;
485     + if (!sg || !host->sg_len) {
486     atmci_writel(host, ATMCI_TDR, value);
487     goto done;
488     }
489     @@ -2190,10 +2196,8 @@ static int __exit atmci_remove(struct platform_device *pdev)
490     atmci_readl(host, ATMCI_SR);
491     clk_disable(host->mck);
492    
493     -#ifdef CONFIG_MMC_ATMELMCI_DMA
494     if (host->dma.chan)
495     dma_release_channel(host->dma.chan);
496     -#endif
497    
498     free_irq(platform_get_irq(pdev, 0), host);
499     iounmap(host->regs);
500     diff --git a/drivers/net/ethernet/freescale/gianfar_ptp.c b/drivers/net/ethernet/freescale/gianfar_ptp.c
501     index 5fd620b..ca2748a 100644
502     --- a/drivers/net/ethernet/freescale/gianfar_ptp.c
503     +++ b/drivers/net/ethernet/freescale/gianfar_ptp.c
504     @@ -127,7 +127,6 @@ struct gianfar_ptp_registers {
505    
506     #define DRIVER "gianfar_ptp"
507     #define DEFAULT_CKSEL 1
508     -#define N_ALARM 1 /* first alarm is used internally to reset fipers */
509     #define N_EXT_TS 2
510     #define REG_SIZE sizeof(struct gianfar_ptp_registers)
511    
512     @@ -410,7 +409,7 @@ static struct ptp_clock_info ptp_gianfar_caps = {
513     .owner = THIS_MODULE,
514     .name = "gianfar clock",
515     .max_adj = 512000,
516     - .n_alarm = N_ALARM,
517     + .n_alarm = 0,
518     .n_ext_ts = N_EXT_TS,
519     .n_per_out = 0,
520     .pps = 1,
521     diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
522     index 6d1f6c5..8f95545 100644
523     --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
524     +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
525     @@ -2263,6 +2263,16 @@ static irqreturn_t ixgbe_msix_other(int irq, void *data)
526     * with the write to EICR.
527     */
528     eicr = IXGBE_READ_REG(hw, IXGBE_EICS);
529     +
530     + /* The lower 16bits of the EICR register are for the queue interrupts
531     + * which should be masked here in order to not accidently clear them if
532     + * the bits are high when ixgbe_msix_other is called. There is a race
533     + * condition otherwise which results in possible performance loss
534     + * especially if the ixgbe_msix_other interrupt is triggering
535     + * consistently (as it would when PPS is turned on for the X540 device)
536     + */
537     + eicr &= 0xFFFF0000;
538     +
539     IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
540    
541     if (eicr & IXGBE_EICR_LSC)
542     diff --git a/drivers/net/wireless/mwifiex/pcie.c b/drivers/net/wireless/mwifiex/pcie.c
543     index 9abb8f5..59e946a 100644
544     --- a/drivers/net/wireless/mwifiex/pcie.c
545     +++ b/drivers/net/wireless/mwifiex/pcie.c
546     @@ -1828,9 +1828,9 @@ static void mwifiex_pcie_cleanup(struct mwifiex_adapter *adapter)
547     if (pdev) {
548     pci_iounmap(pdev, card->pci_mmap);
549     pci_iounmap(pdev, card->pci_mmap1);
550     -
551     - pci_release_regions(pdev);
552     pci_disable_device(pdev);
553     + pci_release_region(pdev, 2);
554     + pci_release_region(pdev, 0);
555     pci_set_drvdata(pdev, NULL);
556     }
557     }
558     diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
559     index 111569c..d08c0d8 100644
560     --- a/drivers/pci/pci.c
561     +++ b/drivers/pci/pci.c
562     @@ -673,15 +673,11 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
563     error = platform_pci_set_power_state(dev, state);
564     if (!error)
565     pci_update_current_state(dev, state);
566     - /* Fall back to PCI_D0 if native PM is not supported */
567     - if (!dev->pm_cap)
568     - dev->current_state = PCI_D0;
569     - } else {
570     + } else
571     error = -ENODEV;
572     - /* Fall back to PCI_D0 if native PM is not supported */
573     - if (!dev->pm_cap)
574     - dev->current_state = PCI_D0;
575     - }
576     +
577     + if (error && !dev->pm_cap) /* Fall back to PCI_D0 */
578     + dev->current_state = PCI_D0;
579    
580     return error;
581     }
582     diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
583     index 7d5f56e..5f8844c 100644
584     --- a/drivers/rtc/rtc-cmos.c
585     +++ b/drivers/rtc/rtc-cmos.c
586     @@ -805,9 +805,8 @@ static int cmos_suspend(struct device *dev)
587     mask = RTC_IRQMASK;
588     tmp &= ~mask;
589     CMOS_WRITE(tmp, RTC_CONTROL);
590     + hpet_mask_rtc_irq_bit(mask);
591    
592     - /* shut down hpet emulation - we don't need it for alarm */
593     - hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
594     cmos_checkintr(cmos, tmp);
595     }
596     spin_unlock_irq(&rtc_lock);
597     @@ -872,6 +871,7 @@ static int cmos_resume(struct device *dev)
598     rtc_update_irq(cmos->rtc, 1, mask);
599     tmp &= ~RTC_AIE;
600     hpet_mask_rtc_irq_bit(RTC_AIE);
601     + hpet_rtc_timer_init();
602     } while (mask & RTC_AIE);
603     spin_unlock_irq(&rtc_lock);
604     }
605     diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
606     index 231a1d8..e73b219 100644
607     --- a/drivers/s390/char/sclp_cmd.c
608     +++ b/drivers/s390/char/sclp_cmd.c
609     @@ -509,6 +509,8 @@ static void __init sclp_add_standby_memory(void)
610     add_memory_merged(0);
611     }
612    
613     +#define MEM_SCT_SIZE (1UL << SECTION_SIZE_BITS)
614     +
615     static void __init insert_increment(u16 rn, int standby, int assigned)
616     {
617     struct memory_increment *incr, *new_incr;
618     @@ -521,7 +523,7 @@ static void __init insert_increment(u16 rn, int standby, int assigned)
619     new_incr->rn = rn;
620     new_incr->standby = standby;
621     if (!standby)
622     - new_incr->usecount = 1;
623     + new_incr->usecount = rzm > MEM_SCT_SIZE ? rzm/MEM_SCT_SIZE : 1;
624     last_rn = 0;
625     prev = &sclp_mem_list;
626     list_for_each_entry(incr, &sclp_mem_list, list) {
627     diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
628     index 636c539..cf9a191 100644
629     --- a/drivers/tty/pty.c
630     +++ b/drivers/tty/pty.c
631     @@ -607,6 +607,9 @@ static int ptmx_open(struct inode *inode, struct file *filp)
632    
633     nonseekable_open(inode, filp);
634    
635     + /* We refuse fsnotify events on ptmx, since it's a shared resource */
636     + filp->f_mode |= FMODE_NONOTIFY;
637     +
638     retval = tty_alloc_file(filp);
639     if (retval)
640     return retval;
641     diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
642     index 246b823..4185cc5 100644
643     --- a/drivers/tty/serial/serial_core.c
644     +++ b/drivers/tty/serial/serial_core.c
645     @@ -1877,6 +1877,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)
646     mutex_unlock(&port->mutex);
647     return 0;
648     }
649     + put_device(tty_dev);
650     +
651     if (console_suspend_enabled || !uart_console(uport))
652     uport->suspended = 1;
653    
654     @@ -1942,9 +1944,11 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)
655     disable_irq_wake(uport->irq);
656     uport->irq_wake = 0;
657     }
658     + put_device(tty_dev);
659     mutex_unlock(&port->mutex);
660     return 0;
661     }
662     + put_device(tty_dev);
663     uport->suspended = 0;
664    
665     /*
666     diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
667     index bf9f987..b28d635 100644
668     --- a/drivers/tty/tty_io.c
669     +++ b/drivers/tty/tty_io.c
670     @@ -938,10 +938,10 @@ void start_tty(struct tty_struct *tty)
671    
672     EXPORT_SYMBOL(start_tty);
673    
674     +/* We limit tty time update visibility to every 8 seconds or so. */
675     static void tty_update_time(struct timespec *time)
676     {
677     - unsigned long sec = get_seconds();
678     - sec -= sec % 60;
679     + unsigned long sec = get_seconds() & ~7;
680     if ((long)(sec - time->tv_sec) > 0)
681     time->tv_sec = sec;
682     }
683     diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
684     index 404413b..336b82d 100644
685     --- a/drivers/usb/core/devio.c
686     +++ b/drivers/usb/core/devio.c
687     @@ -681,6 +681,8 @@ static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype,
688     index &= 0xff;
689     switch (requesttype & USB_RECIP_MASK) {
690     case USB_RECIP_ENDPOINT:
691     + if ((index & ~USB_DIR_IN) == 0)
692     + return 0;
693     ret = findintfep(ps->dev, index);
694     if (ret >= 0)
695     ret = checkintf(ps, ret);
696     diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
697     index ac0d75a..9f7003e 100644
698     --- a/drivers/usb/misc/appledisplay.c
699     +++ b/drivers/usb/misc/appledisplay.c
700     @@ -63,6 +63,7 @@ static const struct usb_device_id appledisplay_table[] = {
701     { APPLEDISPLAY_DEVICE(0x9219) },
702     { APPLEDISPLAY_DEVICE(0x921c) },
703     { APPLEDISPLAY_DEVICE(0x921d) },
704     + { APPLEDISPLAY_DEVICE(0x9236) },
705    
706     /* Terminating entry */
707     { }
708     diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
709     index 07a4fb0..e5ccafc 100644
710     --- a/drivers/usb/serial/ftdi_sio.c
711     +++ b/drivers/usb/serial/ftdi_sio.c
712     @@ -197,6 +197,7 @@ static struct usb_device_id id_table_combined [] = {
713     { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_THROTTLE_PID) },
714     { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GATEWAY_PID) },
715     { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_PID) },
716     + { USB_DEVICE(FTDI_VID, FTDI_OPENDCC_GBM_BOOST_PID) },
717     { USB_DEVICE(NEWPORT_VID, NEWPORT_AGILIS_PID) },
718     { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_IOBOARD_PID) },
719     { USB_DEVICE(INTERBIOMETRICS_VID, INTERBIOMETRICS_MINI_IOBOARD_PID) },
720     @@ -878,7 +879,9 @@ static struct usb_device_id id_table_combined [] = {
721     { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) },
722     { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID),
723     .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
724     - { USB_DEVICE(ST_VID, ST_STMCLT1030_PID),
725     + { USB_DEVICE(ST_VID, ST_STMCLT_2232_PID),
726     + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
727     + { USB_DEVICE(ST_VID, ST_STMCLT_4232_PID),
728     .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk },
729     { USB_DEVICE(FTDI_VID, FTDI_RF_R106) },
730     { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID),
731     diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
732     index e79861e..9852827 100644
733     --- a/drivers/usb/serial/ftdi_sio_ids.h
734     +++ b/drivers/usb/serial/ftdi_sio_ids.h
735     @@ -74,6 +74,7 @@
736     #define FTDI_OPENDCC_THROTTLE_PID 0xBFDA
737     #define FTDI_OPENDCC_GATEWAY_PID 0xBFDB
738     #define FTDI_OPENDCC_GBM_PID 0xBFDC
739     +#define FTDI_OPENDCC_GBM_BOOST_PID 0xBFDD
740    
741     /* NZR SEM 16+ USB (http://www.nzr.de) */
742     #define FTDI_NZR_SEM_USB_PID 0xC1E0 /* NZR SEM-LOG16+ */
743     @@ -1150,7 +1151,8 @@
744     * STMicroelectonics
745     */
746     #define ST_VID 0x0483
747     -#define ST_STMCLT1030_PID 0x3747 /* ST Micro Connect Lite STMCLT1030 */
748     +#define ST_STMCLT_2232_PID 0x3746
749     +#define ST_STMCLT_4232_PID 0x3747
750    
751     /*
752     * Papouch products (http://www.papouch.com/)
753     diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
754     index 78c4774..16efe0a 100644
755     --- a/drivers/usb/serial/option.c
756     +++ b/drivers/usb/serial/option.c
757     @@ -347,6 +347,7 @@ static void option_instat_callback(struct urb *urb);
758     /* Olivetti products */
759     #define OLIVETTI_VENDOR_ID 0x0b3c
760     #define OLIVETTI_PRODUCT_OLICARD100 0xc000
761     +#define OLIVETTI_PRODUCT_OLICARD145 0xc003
762    
763     /* Celot products */
764     #define CELOT_VENDOR_ID 0x211f
765     @@ -1273,6 +1274,7 @@ static const struct usb_device_id option_ids[] = {
766     { USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
767    
768     { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
769     + { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD145) },
770     { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
771     { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
772     { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730 LTE USB modem.*/
773     @@ -1350,6 +1352,12 @@ static const struct usb_device_id option_ids[] = {
774     { USB_DEVICE(TPLINK_VENDOR_ID, TPLINK_PRODUCT_MA180),
775     .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
776     { USB_DEVICE(CHANGHONG_VENDOR_ID, CHANGHONG_PRODUCT_CH690) },
777     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x02, 0x01) }, /* D-Link DWM-156 (variant) */
778     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d01, 0xff, 0x00, 0x00) }, /* D-Link DWM-156 (variant) */
779     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x02, 0x01) },
780     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d02, 0xff, 0x00, 0x00) },
781     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x02, 0x01) },
782     + { USB_DEVICE_AND_INTERFACE_INFO(0x2001, 0x7d03, 0xff, 0x00, 0x00) },
783     { } /* Terminating entry */
784     };
785     MODULE_DEVICE_TABLE(usb, option_ids);
786     diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c
787     index 5fe451d..c1f6751 100644
788     --- a/drivers/usb/storage/cypress_atacb.c
789     +++ b/drivers/usb/storage/cypress_atacb.c
790     @@ -248,14 +248,26 @@ static int cypress_probe(struct usb_interface *intf,
791     {
792     struct us_data *us;
793     int result;
794     + struct usb_device *device;
795    
796     result = usb_stor_probe1(&us, intf, id,
797     (id - cypress_usb_ids) + cypress_unusual_dev_list);
798     if (result)
799     return result;
800    
801     - us->protocol_name = "Transparent SCSI with Cypress ATACB";
802     - us->proto_handler = cypress_atacb_passthrough;
803     + /* Among CY7C68300 chips, the A revision does not support Cypress ATACB
804     + * Filter out this revision from EEPROM default descriptor values
805     + */
806     + device = interface_to_usbdev(intf);
807     + if (device->descriptor.iManufacturer != 0x38 ||
808     + device->descriptor.iProduct != 0x4e ||
809     + device->descriptor.iSerialNumber != 0x64) {
810     + us->protocol_name = "Transparent SCSI with Cypress ATACB";
811     + us->proto_handler = cypress_atacb_passthrough;
812     + } else {
813     + us->protocol_name = "Transparent SCSI";
814     + us->proto_handler = usb_stor_transparent_scsi_command;
815     + }
816    
817     result = usb_stor_probe2(us);
818     return result;
819     diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
820     index 18ded2d..a01317c 100644
821     --- a/drivers/video/console/fbcon.c
822     +++ b/drivers/video/console/fbcon.c
823     @@ -1228,6 +1228,8 @@ static void fbcon_deinit(struct vc_data *vc)
824     finished:
825    
826     fbcon_free_font(p, free_font);
827     + if (free_font)
828     + vc->vc_font.data = NULL;
829    
830     if (!con_is_bound(&fb_con))
831     fbcon_exit();
832     diff --git a/fs/dcache.c b/fs/dcache.c
833     index f104945..e498de2 100644
834     --- a/fs/dcache.c
835     +++ b/fs/dcache.c
836     @@ -1238,8 +1238,10 @@ void shrink_dcache_parent(struct dentry * parent)
837     LIST_HEAD(dispose);
838     int found;
839    
840     - while ((found = select_parent(parent, &dispose)) != 0)
841     + while ((found = select_parent(parent, &dispose)) != 0) {
842     shrink_dentry_list(&dispose);
843     + cond_resched();
844     + }
845     }
846     EXPORT_SYMBOL(shrink_dcache_parent);
847    
848     diff --git a/fs/exec.c b/fs/exec.c
849     index e3a7e36d..2b7f5ff 100644
850     --- a/fs/exec.c
851     +++ b/fs/exec.c
852     @@ -627,7 +627,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
853     * when the old and new regions overlap clear from new_end.
854     */
855     free_pgd_range(&tlb, new_end, old_end, new_end,
856     - vma->vm_next ? vma->vm_next->vm_start : 0);
857     + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
858     } else {
859     /*
860     * otherwise, clean from old_start; this is done to not touch
861     @@ -636,7 +636,7 @@ static int shift_arg_pages(struct vm_area_struct *vma, unsigned long shift)
862     * for the others its just a little faster.
863     */
864     free_pgd_range(&tlb, old_start, old_end, new_end,
865     - vma->vm_next ? vma->vm_next->vm_start : 0);
866     + vma->vm_next ? vma->vm_next->vm_start : USER_PGTABLES_CEILING);
867     }
868     tlb_finish_mmu(&tlb, new_end, old_end);
869    
870     diff --git a/fs/ext4/Kconfig b/fs/ext4/Kconfig
871     index 9ed1bb1..5459168 100644
872     --- a/fs/ext4/Kconfig
873     +++ b/fs/ext4/Kconfig
874     @@ -82,4 +82,5 @@ config EXT4_DEBUG
875     Enables run-time debugging support for the ext4 filesystem.
876    
877     If you select Y here, then you will be able to turn on debugging
878     - with a command such as "echo 1 > /sys/kernel/debug/ext4/mballoc-debug"
879     + with a command such as:
880     + echo 1 > /sys/module/ext4/parameters/mballoc_debug
881     diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
882     index 83b20fc..6b23a96 100644
883     --- a/fs/ext4/ext4_jbd2.h
884     +++ b/fs/ext4/ext4_jbd2.h
885     @@ -164,16 +164,20 @@ static inline void ext4_journal_callback_add(handle_t *handle,
886     * ext4_journal_callback_del: delete a registered callback
887     * @handle: active journal transaction handle on which callback was registered
888     * @jce: registered journal callback entry to unregister
889     + * Return true if object was sucessfully removed
890     */
891     -static inline void ext4_journal_callback_del(handle_t *handle,
892     +static inline bool ext4_journal_callback_try_del(handle_t *handle,
893     struct ext4_journal_cb_entry *jce)
894     {
895     + bool deleted;
896     struct ext4_sb_info *sbi =
897     EXT4_SB(handle->h_transaction->t_journal->j_private);
898    
899     spin_lock(&sbi->s_md_lock);
900     + deleted = !list_empty(&jce->jce_list);
901     list_del_init(&jce->jce_list);
902     spin_unlock(&sbi->s_md_lock);
903     + return deleted;
904     }
905    
906     int
907     diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
908     index 6c32dd8..ec970cb 100644
909     --- a/fs/ext4/mballoc.c
910     +++ b/fs/ext4/mballoc.c
911     @@ -4436,11 +4436,11 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
912     node = rb_prev(new_node);
913     if (node) {
914     entry = rb_entry(node, struct ext4_free_data, efd_node);
915     - if (can_merge(entry, new_entry)) {
916     + if (can_merge(entry, new_entry) &&
917     + ext4_journal_callback_try_del(handle, &entry->efd_jce)) {
918     new_entry->efd_start_cluster = entry->efd_start_cluster;
919     new_entry->efd_count += entry->efd_count;
920     rb_erase(node, &(db->bb_free_root));
921     - ext4_journal_callback_del(handle, &entry->efd_jce);
922     kmem_cache_free(ext4_free_data_cachep, entry);
923     }
924     }
925     @@ -4448,10 +4448,10 @@ ext4_mb_free_metadata(handle_t *handle, struct ext4_buddy *e4b,
926     node = rb_next(new_node);
927     if (node) {
928     entry = rb_entry(node, struct ext4_free_data, efd_node);
929     - if (can_merge(new_entry, entry)) {
930     + if (can_merge(new_entry, entry) &&
931     + ext4_journal_callback_try_del(handle, &entry->efd_jce)) {
932     new_entry->efd_count += entry->efd_count;
933     rb_erase(node, &(db->bb_free_root));
934     - ext4_journal_callback_del(handle, &entry->efd_jce);
935     kmem_cache_free(ext4_free_data_cachep, entry);
936     }
937     }
938     diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
939     index 3fc0e8b..9202b22 100644
940     --- a/fs/ext4/resize.c
941     +++ b/fs/ext4/resize.c
942     @@ -1202,6 +1202,8 @@ static void ext4_update_super(struct super_block *sb,
943    
944     /* Update the global fs size fields */
945     sbi->s_groups_count += flex_gd->count;
946     + sbi->s_blockfile_groups = min_t(ext4_group_t, sbi->s_groups_count,
947     + (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)));
948    
949     /* Update the reserved block counts only once the new group is
950     * active. */
951     diff --git a/fs/ext4/super.c b/fs/ext4/super.c
952     index 88bb68d..b93de81 100644
953     --- a/fs/ext4/super.c
954     +++ b/fs/ext4/super.c
955     @@ -437,10 +437,13 @@ static void ext4_journal_commit_callback(journal_t *journal, transaction_t *txn)
956     struct super_block *sb = journal->j_private;
957     struct ext4_sb_info *sbi = EXT4_SB(sb);
958     int error = is_journal_aborted(journal);
959     - struct ext4_journal_cb_entry *jce, *tmp;
960     + struct ext4_journal_cb_entry *jce;
961    
962     + BUG_ON(txn->t_state == T_FINISHED);
963     spin_lock(&sbi->s_md_lock);
964     - list_for_each_entry_safe(jce, tmp, &txn->t_private_list, jce_list) {
965     + while (!list_empty(&txn->t_private_list)) {
966     + jce = list_entry(txn->t_private_list.next,
967     + struct ext4_journal_cb_entry, jce_list);
968     list_del_init(&jce->jce_list);
969     spin_unlock(&sbi->s_md_lock);
970     jce->jce_func(sb, jce, error);
971     diff --git a/fs/fscache/stats.c b/fs/fscache/stats.c
972     index 4765190..73c0bd7 100644
973     --- a/fs/fscache/stats.c
974     +++ b/fs/fscache/stats.c
975     @@ -276,5 +276,5 @@ const struct file_operations fscache_stats_fops = {
976     .open = fscache_stats_open,
977     .read = seq_read,
978     .llseek = seq_lseek,
979     - .release = seq_release,
980     + .release = single_release,
981     };
982     diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
983     index 840f70f..a0dcbd62 100644
984     --- a/fs/jbd2/commit.c
985     +++ b/fs/jbd2/commit.c
986     @@ -325,7 +325,7 @@ void jbd2_journal_commit_transaction(journal_t *journal)
987     int space_left = 0;
988     int first_tag = 0;
989     int tag_flag;
990     - int i, to_free = 0;
991     + int i;
992     int tag_bytes = journal_tag_bytes(journal);
993     struct buffer_head *cbh = NULL; /* For transactional checksums */
994     __u32 crc32_sum = ~0;
995     @@ -1044,7 +1044,7 @@ restart_loop:
996     journal->j_stats.run.rs_blocks_logged += stats.run.rs_blocks_logged;
997     spin_unlock(&journal->j_history_lock);
998    
999     - commit_transaction->t_state = T_FINISHED;
1000     + commit_transaction->t_state = T_COMMIT_CALLBACK;
1001     J_ASSERT(commit_transaction == journal->j_committing_transaction);
1002     journal->j_commit_sequence = commit_transaction->t_tid;
1003     journal->j_committing_transaction = NULL;
1004     @@ -1059,38 +1059,44 @@ restart_loop:
1005     journal->j_average_commit_time*3) / 4;
1006     else
1007     journal->j_average_commit_time = commit_time;
1008     +
1009     write_unlock(&journal->j_state_lock);
1010    
1011     - if (commit_transaction->t_checkpoint_list == NULL &&
1012     - commit_transaction->t_checkpoint_io_list == NULL) {
1013     - __jbd2_journal_drop_transaction(journal, commit_transaction);
1014     - to_free = 1;
1015     + if (journal->j_checkpoint_transactions == NULL) {
1016     + journal->j_checkpoint_transactions = commit_transaction;
1017     + commit_transaction->t_cpnext = commit_transaction;
1018     + commit_transaction->t_cpprev = commit_transaction;
1019     } else {
1020     - if (journal->j_checkpoint_transactions == NULL) {
1021     - journal->j_checkpoint_transactions = commit_transaction;
1022     - commit_transaction->t_cpnext = commit_transaction;
1023     - commit_transaction->t_cpprev = commit_transaction;
1024     - } else {
1025     - commit_transaction->t_cpnext =
1026     - journal->j_checkpoint_transactions;
1027     - commit_transaction->t_cpprev =
1028     - commit_transaction->t_cpnext->t_cpprev;
1029     - commit_transaction->t_cpnext->t_cpprev =
1030     - commit_transaction;
1031     - commit_transaction->t_cpprev->t_cpnext =
1032     + commit_transaction->t_cpnext =
1033     + journal->j_checkpoint_transactions;
1034     + commit_transaction->t_cpprev =
1035     + commit_transaction->t_cpnext->t_cpprev;
1036     + commit_transaction->t_cpnext->t_cpprev =
1037     + commit_transaction;
1038     + commit_transaction->t_cpprev->t_cpnext =
1039     commit_transaction;
1040     - }
1041     }
1042     spin_unlock(&journal->j_list_lock);
1043     -
1044     + /* Drop all spin_locks because commit_callback may be block.
1045     + * __journal_remove_checkpoint() can not destroy transaction
1046     + * under us because it is not marked as T_FINISHED yet */
1047     if (journal->j_commit_callback)
1048     journal->j_commit_callback(journal, commit_transaction);
1049    
1050     trace_jbd2_end_commit(journal, commit_transaction);
1051     jbd_debug(1, "JBD2: commit %d complete, head %d\n",
1052     journal->j_commit_sequence, journal->j_tail_sequence);
1053     - if (to_free)
1054     - jbd2_journal_free_transaction(commit_transaction);
1055    
1056     + write_lock(&journal->j_state_lock);
1057     + spin_lock(&journal->j_list_lock);
1058     + commit_transaction->t_state = T_FINISHED;
1059     + /* Recheck checkpoint lists after j_list_lock was dropped */
1060     + if (commit_transaction->t_checkpoint_list == NULL &&
1061     + commit_transaction->t_checkpoint_io_list == NULL) {
1062     + __jbd2_journal_drop_transaction(journal, commit_transaction);
1063     + jbd2_journal_free_transaction(commit_transaction);
1064     + }
1065     + spin_unlock(&journal->j_list_lock);
1066     + write_unlock(&journal->j_state_lock);
1067     wake_up(&journal->j_wait_done_commit);
1068     }
1069     diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
1070     index ca0a080..193f04c 100644
1071     --- a/fs/lockd/clntlock.c
1072     +++ b/fs/lockd/clntlock.c
1073     @@ -144,6 +144,9 @@ int nlmclnt_block(struct nlm_wait *block, struct nlm_rqst *req, long timeout)
1074     timeout);
1075     if (ret < 0)
1076     return -ERESTARTSYS;
1077     + /* Reset the lock status after a server reboot so we resend */
1078     + if (block->b_status == nlm_lck_denied_grace_period)
1079     + block->b_status = nlm_lck_blocked;
1080     req->a_res.status = block->b_status;
1081     return 0;
1082     }
1083     diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
1084     index a3a0987..8392cb8 100644
1085     --- a/fs/lockd/clntproc.c
1086     +++ b/fs/lockd/clntproc.c
1087     @@ -551,9 +551,6 @@ again:
1088     status = nlmclnt_block(block, req, NLMCLNT_POLL_TIMEOUT);
1089     if (status < 0)
1090     break;
1091     - /* Resend the blocking lock request after a server reboot */
1092     - if (resp->status == nlm_lck_denied_grace_period)
1093     - continue;
1094     if (resp->status != nlm_lck_blocked)
1095     break;
1096     }
1097     diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
1098     index 3035187..04f449c 100644
1099     --- a/fs/nfs/nfs4proc.c
1100     +++ b/fs/nfs/nfs4proc.c
1101     @@ -1362,6 +1362,12 @@ int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state
1102     case -ENOMEM:
1103     err = 0;
1104     goto out;
1105     + case -NFS4ERR_DELAY:
1106     + case -NFS4ERR_GRACE:
1107     + set_bit(NFS_DELEGATED_STATE, &state->flags);
1108     + ssleep(1);
1109     + err = -EAGAIN;
1110     + goto out;
1111     }
1112     err = nfs4_handle_exception(server, err, &exception);
1113     } while (exception.retry);
1114     diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
1115     index abd785e..f90b197 100644
1116     --- a/fs/nfsd/nfs4state.c
1117     +++ b/fs/nfsd/nfs4state.c
1118     @@ -213,13 +213,7 @@ static void __nfs4_file_put_access(struct nfs4_file *fp, int oflag)
1119     {
1120     if (atomic_dec_and_test(&fp->fi_access[oflag])) {
1121     nfs4_file_put_fd(fp, oflag);
1122     - /*
1123     - * It's also safe to get rid of the RDWR open *if*
1124     - * we no longer have need of the other kind of access
1125     - * or if we already have the other kind of open:
1126     - */
1127     - if (fp->fi_fds[1-oflag]
1128     - || atomic_read(&fp->fi_access[1 - oflag]) == 0)
1129     + if (atomic_read(&fp->fi_access[1 - oflag]) == 0)
1130     nfs4_file_put_fd(fp, O_RDWR);
1131     }
1132     }
1133     diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
1134     index ace6745..1798846 100644
1135     --- a/fs/nfsd/nfs4xdr.c
1136     +++ b/fs/nfsd/nfs4xdr.c
1137     @@ -343,10 +343,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
1138     all 32 bits of 'nseconds'. */
1139     READ_BUF(12);
1140     len += 12;
1141     - READ32(dummy32);
1142     - if (dummy32)
1143     - return nfserr_inval;
1144     - READ32(iattr->ia_atime.tv_sec);
1145     + READ64(iattr->ia_atime.tv_sec);
1146     READ32(iattr->ia_atime.tv_nsec);
1147     if (iattr->ia_atime.tv_nsec >= (u32)1000000000)
1148     return nfserr_inval;
1149     @@ -369,10 +366,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
1150     all 32 bits of 'nseconds'. */
1151     READ_BUF(12);
1152     len += 12;
1153     - READ32(dummy32);
1154     - if (dummy32)
1155     - return nfserr_inval;
1156     - READ32(iattr->ia_mtime.tv_sec);
1157     + READ64(iattr->ia_mtime.tv_sec);
1158     READ32(iattr->ia_mtime.tv_nsec);
1159     if (iattr->ia_mtime.tv_nsec >= (u32)1000000000)
1160     return nfserr_inval;
1161     @@ -2371,8 +2365,7 @@ out_acl:
1162     if (bmval1 & FATTR4_WORD1_TIME_ACCESS) {
1163     if ((buflen -= 12) < 0)
1164     goto out_resource;
1165     - WRITE32(0);
1166     - WRITE32(stat.atime.tv_sec);
1167     + WRITE64((s64)stat.atime.tv_sec);
1168     WRITE32(stat.atime.tv_nsec);
1169     }
1170     if (bmval1 & FATTR4_WORD1_TIME_DELTA) {
1171     @@ -2385,15 +2378,13 @@ out_acl:
1172     if (bmval1 & FATTR4_WORD1_TIME_METADATA) {
1173     if ((buflen -= 12) < 0)
1174     goto out_resource;
1175     - WRITE32(0);
1176     - WRITE32(stat.ctime.tv_sec);
1177     + WRITE64((s64)stat.ctime.tv_sec);
1178     WRITE32(stat.ctime.tv_nsec);
1179     }
1180     if (bmval1 & FATTR4_WORD1_TIME_MODIFY) {
1181     if ((buflen -= 12) < 0)
1182     goto out_resource;
1183     - WRITE32(0);
1184     - WRITE32(stat.mtime.tv_sec);
1185     + WRITE64((s64)stat.mtime.tv_sec);
1186     WRITE32(stat.mtime.tv_nsec);
1187     }
1188     if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {
1189     diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
1190     index 45024ef..9a5f07d 100644
1191     --- a/fs/sysfs/dir.c
1192     +++ b/fs/sysfs/dir.c
1193     @@ -994,6 +994,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
1194     enum kobj_ns_type type;
1195     const void *ns;
1196     ino_t ino;
1197     + loff_t off;
1198    
1199     type = sysfs_ns_type(parent_sd);
1200     ns = sysfs_info(dentry->d_sb)->ns[type];
1201     @@ -1016,6 +1017,7 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
1202     return 0;
1203     }
1204     mutex_lock(&sysfs_mutex);
1205     + off = filp->f_pos;
1206     for (pos = sysfs_dir_pos(ns, parent_sd, filp->f_pos, pos);
1207     pos;
1208     pos = sysfs_dir_next_pos(ns, parent_sd, filp->f_pos, pos)) {
1209     @@ -1027,19 +1029,24 @@ static int sysfs_readdir(struct file * filp, void * dirent, filldir_t filldir)
1210     len = strlen(name);
1211     ino = pos->s_ino;
1212     type = dt_type(pos);
1213     - filp->f_pos = pos->s_hash;
1214     + off = filp->f_pos = pos->s_hash;
1215     filp->private_data = sysfs_get(pos);
1216    
1217     mutex_unlock(&sysfs_mutex);
1218     - ret = filldir(dirent, name, len, filp->f_pos, ino, type);
1219     + ret = filldir(dirent, name, len, off, ino, type);
1220     mutex_lock(&sysfs_mutex);
1221     if (ret < 0)
1222     break;
1223     }
1224     mutex_unlock(&sysfs_mutex);
1225     - if ((filp->f_pos > 1) && !pos) { /* EOF */
1226     - filp->f_pos = INT_MAX;
1227     +
1228     + /* don't reference last entry if its refcount is dropped */
1229     + if (!pos) {
1230     filp->private_data = NULL;
1231     +
1232     + /* EOF and not changed as 0 or 1 in read/write path */
1233     + if (off == filp->f_pos && off > 1)
1234     + filp->f_pos = INT_MAX;
1235     }
1236     return 0;
1237     }
1238     diff --git a/include/asm-generic/pgtable.h b/include/asm-generic/pgtable.h
1239     index c7ec2cd..9a6eb25 100644
1240     --- a/include/asm-generic/pgtable.h
1241     +++ b/include/asm-generic/pgtable.h
1242     @@ -7,6 +7,16 @@
1243     #include <linux/mm_types.h>
1244     #include <linux/bug.h>
1245    
1246     +/*
1247     + * On almost all architectures and configurations, 0 can be used as the
1248     + * upper ceiling to free_pgtables(): on many architectures it has the same
1249     + * effect as using TASK_SIZE. However, there is one configuration which
1250     + * must impose a more careful limit, to avoid freeing kernel pgtables.
1251     + */
1252     +#ifndef USER_PGTABLES_CEILING
1253     +#define USER_PGTABLES_CEILING 0UL
1254     +#endif
1255     +
1256     #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
1257     extern int ptep_set_access_flags(struct vm_area_struct *vma,
1258     unsigned long address, pte_t *ptep,
1259     diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h
1260     index 8a297a5..497c6cc 100644
1261     --- a/include/linux/ipc_namespace.h
1262     +++ b/include/linux/ipc_namespace.h
1263     @@ -42,8 +42,8 @@ struct ipc_namespace {
1264    
1265     size_t shm_ctlmax;
1266     size_t shm_ctlall;
1267     + unsigned long shm_tot;
1268     int shm_ctlmni;
1269     - int shm_tot;
1270     /*
1271     * Defines whether IPC_RMID is forced for _all_ shm segments regardless
1272     * of shmctl()
1273     diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
1274     index 2ed66ef..dd6444f 100644
1275     --- a/include/linux/jbd2.h
1276     +++ b/include/linux/jbd2.h
1277     @@ -470,6 +470,7 @@ struct transaction_s
1278     T_COMMIT,
1279     T_COMMIT_DFLUSH,
1280     T_COMMIT_JFLUSH,
1281     + T_COMMIT_CALLBACK,
1282     T_FINISHED
1283     } t_state;
1284    
1285     diff --git a/ipc/shm.c b/ipc/shm.c
1286     index 406c5b2..85d81b4 100644
1287     --- a/ipc/shm.c
1288     +++ b/ipc/shm.c
1289     @@ -450,7 +450,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
1290     size_t size = params->u.size;
1291     int error;
1292     struct shmid_kernel *shp;
1293     - int numpages = (size + PAGE_SIZE -1) >> PAGE_SHIFT;
1294     + size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
1295     struct file * file;
1296     char name[13];
1297     int id;
1298     diff --git a/kernel/cgroup.c b/kernel/cgroup.c
1299     index a4c47d1b..4eb1ed3 100644
1300     --- a/kernel/cgroup.c
1301     +++ b/kernel/cgroup.c
1302     @@ -2020,7 +2020,7 @@ static int cgroup_attach_proc(struct cgroup *cgrp, struct task_struct *leader)
1303     if (!group)
1304     return -ENOMEM;
1305     /* pre-allocate to guarantee space while iterating in rcu read-side. */
1306     - retval = flex_array_prealloc(group, 0, group_size - 1, GFP_KERNEL);
1307     + retval = flex_array_prealloc(group, 0, group_size, GFP_KERNEL);
1308     if (retval)
1309     goto out_free_group_list;
1310    
1311     diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
1312     index e4cee8d..60f7e32 100644
1313     --- a/kernel/hrtimer.c
1314     +++ b/kernel/hrtimer.c
1315     @@ -298,6 +298,10 @@ ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec)
1316     } else {
1317     unsigned long rem = do_div(nsec, NSEC_PER_SEC);
1318    
1319     + /* Make sure nsec fits into long */
1320     + if (unlikely(nsec > KTIME_SEC_MAX))
1321     + return (ktime_t){ .tv64 = KTIME_MAX };
1322     +
1323     tmp = ktime_set((long)nsec, rem);
1324     }
1325    
1326     @@ -1308,6 +1312,8 @@ retry:
1327    
1328     expires = ktime_sub(hrtimer_get_expires(timer),
1329     base->offset);
1330     + if (expires.tv64 < 0)
1331     + expires.tv64 = KTIME_MAX;
1332     if (expires.tv64 < expires_next.tv64)
1333     expires_next = expires;
1334     break;
1335     diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
1336     index a13987a..239a323 100644
1337     --- a/kernel/time/tick-broadcast.c
1338     +++ b/kernel/time/tick-broadcast.c
1339     @@ -66,6 +66,8 @@ static void tick_broadcast_start_periodic(struct clock_event_device *bc)
1340     */
1341     int tick_check_broadcast_device(struct clock_event_device *dev)
1342     {
1343     + struct clock_event_device *cur = tick_broadcast_device.evtdev;
1344     +
1345     if ((dev->features & CLOCK_EVT_FEAT_DUMMY) ||
1346     (tick_broadcast_device.evtdev &&
1347     tick_broadcast_device.evtdev->rating >= dev->rating) ||
1348     @@ -73,6 +75,8 @@ int tick_check_broadcast_device(struct clock_event_device *dev)
1349     return 0;
1350    
1351     clockevents_exchange_device(tick_broadcast_device.evtdev, dev);
1352     + if (cur)
1353     + cur->event_handler = clockevents_handle_noop;
1354     tick_broadcast_device.evtdev = dev;
1355     if (!cpumask_empty(tick_get_broadcast_mask()))
1356     tick_broadcast_start_periodic(dev);
1357     diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
1358     index da6c9ec..ead79bc 100644
1359     --- a/kernel/time/tick-common.c
1360     +++ b/kernel/time/tick-common.c
1361     @@ -323,6 +323,7 @@ static void tick_shutdown(unsigned int *cpup)
1362     */
1363     dev->mode = CLOCK_EVT_MODE_UNUSED;
1364     clockevents_exchange_device(dev, NULL);
1365     + dev->event_handler = clockevents_handle_noop;
1366     td->evtdev = NULL;
1367     }
1368     raw_spin_unlock_irqrestore(&tick_device_lock, flags);
1369     diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1370     index a3c1dd9..c962d31 100644
1371     --- a/kernel/trace/ftrace.c
1372     +++ b/kernel/trace/ftrace.c
1373     @@ -624,7 +624,7 @@ int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
1374    
1375     pages = DIV_ROUND_UP(functions, PROFILES_PER_PAGE);
1376    
1377     - for (i = 0; i < pages; i++) {
1378     + for (i = 1; i < pages; i++) {
1379     pg->next = (void *)get_zeroed_page(GFP_KERNEL);
1380     if (!pg->next)
1381     goto out_free;
1382     @@ -3611,7 +3611,8 @@ out:
1383     if (fail)
1384     return -EINVAL;
1385    
1386     - ftrace_graph_filter_enabled = 1;
1387     + ftrace_graph_filter_enabled = !!(*idx);
1388     +
1389     return 0;
1390     }
1391    
1392     diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
1393     index 8beda39..b29ebd3 100644
1394     --- a/kernel/trace/trace.c
1395     +++ b/kernel/trace/trace.c
1396     @@ -4717,6 +4717,8 @@ static __init int tracer_init_debugfs(void)
1397     trace_access_lock_init();
1398    
1399     d_tracer = tracing_init_dentry();
1400     + if (!d_tracer)
1401     + return 0;
1402    
1403     trace_create_file("tracing_enabled", 0644, d_tracer,
1404     &global_trace, &tracing_ctrl_fops);
1405     diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c
1406     index d4545f4..c70f6bf 100644
1407     --- a/kernel/trace/trace_stack.c
1408     +++ b/kernel/trace/trace_stack.c
1409     @@ -20,13 +20,24 @@
1410    
1411     #define STACK_TRACE_ENTRIES 500
1412    
1413     +#ifdef CC_USING_FENTRY
1414     +# define fentry 1
1415     +#else
1416     +# define fentry 0
1417     +#endif
1418     +
1419     static unsigned long stack_dump_trace[STACK_TRACE_ENTRIES+1] =
1420     { [0 ... (STACK_TRACE_ENTRIES)] = ULONG_MAX };
1421     static unsigned stack_dump_index[STACK_TRACE_ENTRIES];
1422    
1423     +/*
1424     + * Reserve one entry for the passed in ip. This will allow
1425     + * us to remove most or all of the stack size overhead
1426     + * added by the stack tracer itself.
1427     + */
1428     static struct stack_trace max_stack_trace = {
1429     - .max_entries = STACK_TRACE_ENTRIES,
1430     - .entries = stack_dump_trace,
1431     + .max_entries = STACK_TRACE_ENTRIES - 1,
1432     + .entries = &stack_dump_trace[1],
1433     };
1434    
1435     static unsigned long max_stack_size;
1436     @@ -40,25 +51,34 @@ static DEFINE_MUTEX(stack_sysctl_mutex);
1437     int stack_tracer_enabled;
1438     static int last_stack_tracer_enabled;
1439    
1440     -static inline void check_stack(void)
1441     +static inline void
1442     +check_stack(unsigned long ip, unsigned long *stack)
1443     {
1444     unsigned long this_size, flags;
1445     unsigned long *p, *top, *start;
1446     + static int tracer_frame;
1447     + int frame_size = ACCESS_ONCE(tracer_frame);
1448     int i;
1449    
1450     - this_size = ((unsigned long)&this_size) & (THREAD_SIZE-1);
1451     + this_size = ((unsigned long)stack) & (THREAD_SIZE-1);
1452     this_size = THREAD_SIZE - this_size;
1453     + /* Remove the frame of the tracer */
1454     + this_size -= frame_size;
1455    
1456     if (this_size <= max_stack_size)
1457     return;
1458    
1459     /* we do not handle interrupt stacks yet */
1460     - if (!object_is_on_stack(&this_size))
1461     + if (!object_is_on_stack(stack))
1462     return;
1463    
1464     local_irq_save(flags);
1465     arch_spin_lock(&max_stack_lock);
1466    
1467     + /* In case another CPU set the tracer_frame on us */
1468     + if (unlikely(!frame_size))
1469     + this_size -= tracer_frame;
1470     +
1471     /* a race could have already updated it */
1472     if (this_size <= max_stack_size)
1473     goto out;
1474     @@ -71,10 +91,18 @@ static inline void check_stack(void)
1475     save_stack_trace(&max_stack_trace);
1476    
1477     /*
1478     + * Add the passed in ip from the function tracer.
1479     + * Searching for this on the stack will skip over
1480     + * most of the overhead from the stack tracer itself.
1481     + */
1482     + stack_dump_trace[0] = ip;
1483     + max_stack_trace.nr_entries++;
1484     +
1485     + /*
1486     * Now find where in the stack these are.
1487     */
1488     i = 0;
1489     - start = &this_size;
1490     + start = stack;
1491     top = (unsigned long *)
1492     (((unsigned long)start & ~(THREAD_SIZE-1)) + THREAD_SIZE);
1493    
1494     @@ -98,6 +126,18 @@ static inline void check_stack(void)
1495     found = 1;
1496     /* Start the search from here */
1497     start = p + 1;
1498     + /*
1499     + * We do not want to show the overhead
1500     + * of the stack tracer stack in the
1501     + * max stack. If we haven't figured
1502     + * out what that is, then figure it out
1503     + * now.
1504     + */
1505     + if (unlikely(!tracer_frame) && i == 1) {
1506     + tracer_frame = (p - stack) *
1507     + sizeof(unsigned long);
1508     + max_stack_size -= tracer_frame;
1509     + }
1510     }
1511     }
1512    
1513     @@ -113,6 +153,7 @@ static inline void check_stack(void)
1514     static void
1515     stack_trace_call(unsigned long ip, unsigned long parent_ip)
1516     {
1517     + unsigned long stack;
1518     int cpu;
1519    
1520     if (unlikely(!ftrace_enabled || stack_trace_disabled))
1521     @@ -125,7 +166,26 @@ stack_trace_call(unsigned long ip, unsigned long parent_ip)
1522     if (per_cpu(trace_active, cpu)++ != 0)
1523     goto out;
1524    
1525     - check_stack();
1526     + /*
1527     + * When fentry is used, the traced function does not get
1528     + * its stack frame set up, and we lose the parent.
1529     + * The ip is pretty useless because the function tracer
1530     + * was called before that function set up its stack frame.
1531     + * In this case, we use the parent ip.
1532     + *
1533     + * By adding the return address of either the parent ip
1534     + * or the current ip we can disregard most of the stack usage
1535     + * caused by the stack tracer itself.
1536     + *
1537     + * The function tracer always reports the address of where the
1538     + * mcount call was, but the stack will hold the return address.
1539     + */
1540     + if (fentry)
1541     + ip = parent_ip;
1542     + else
1543     + ip += MCOUNT_INSN_SIZE;
1544     +
1545     + check_stack(ip, &stack);
1546    
1547     out:
1548     per_cpu(trace_active, cpu)--;
1549     @@ -373,6 +433,8 @@ static __init int stack_trace_init(void)
1550     struct dentry *d_tracer;
1551    
1552     d_tracer = tracing_init_dentry();
1553     + if (!d_tracer)
1554     + return 0;
1555    
1556     trace_create_file("stack_max_size", 0644, d_tracer,
1557     &max_stack_size, &stack_max_size_fops);
1558     diff --git a/kernel/trace/trace_stat.c b/kernel/trace/trace_stat.c
1559     index 96cffb2..847f88a 100644
1560     --- a/kernel/trace/trace_stat.c
1561     +++ b/kernel/trace/trace_stat.c
1562     @@ -307,6 +307,8 @@ static int tracing_stat_init(void)
1563     struct dentry *d_tracing;
1564    
1565     d_tracing = tracing_init_dentry();
1566     + if (!d_tracing)
1567     + return 0;
1568    
1569     stat_dir = debugfs_create_dir("trace_stat", d_tracing);
1570     if (!stat_dir)
1571     diff --git a/mm/mmap.c b/mm/mmap.c
1572     index 2add0a1..3635d47 100644
1573     --- a/mm/mmap.c
1574     +++ b/mm/mmap.c
1575     @@ -1920,7 +1920,7 @@ static void unmap_region(struct mm_struct *mm,
1576     unmap_vmas(&tlb, vma, start, end, &nr_accounted, NULL);
1577     vm_unacct_memory(nr_accounted);
1578     free_pgtables(&tlb, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
1579     - next ? next->vm_start : 0);
1580     + next ? next->vm_start : USER_PGTABLES_CEILING);
1581     tlb_finish_mmu(&tlb, start, end);
1582     }
1583    
1584     @@ -2308,7 +2308,7 @@ void exit_mmap(struct mm_struct *mm)
1585     unmap_vmas(&tlb, vma, 0, -1, &nr_accounted, NULL);
1586     vm_unacct_memory(nr_accounted);
1587    
1588     - free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, 0);
1589     + free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
1590     tlb_finish_mmu(&tlb, 0, -1);
1591    
1592     /*
1593     diff --git a/net/wireless/reg.c b/net/wireless/reg.c
1594     index 4dc8347..796a0ee 100644
1595     --- a/net/wireless/reg.c
1596     +++ b/net/wireless/reg.c
1597     @@ -862,7 +862,7 @@ static void handle_channel(struct wiphy *wiphy,
1598     return;
1599    
1600     REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq);
1601     - chan->flags = IEEE80211_CHAN_DISABLED;
1602     + chan->flags |= IEEE80211_CHAN_DISABLED;
1603     return;
1604     }
1605    
1606     diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
1607     index af7324b..4790568 100644
1608     --- a/sound/soc/codecs/max98088.c
1609     +++ b/sound/soc/codecs/max98088.c
1610     @@ -2006,7 +2006,7 @@ static int max98088_probe(struct snd_soc_codec *codec)
1611     ret);
1612     goto err_access;
1613     }
1614     - dev_info(codec->dev, "revision %c\n", ret + 'A');
1615     + dev_info(codec->dev, "revision %c\n", ret - 0x40 + 'A');
1616    
1617     snd_soc_write(codec, M98088_REG_51_PWR_SYS, M98088_PWRSV);
1618    
1619     diff --git a/sound/usb/card.c b/sound/usb/card.c
1620     index 388460d..b41730d 100644
1621     --- a/sound/usb/card.c
1622     +++ b/sound/usb/card.c
1623     @@ -611,7 +611,9 @@ int snd_usb_autoresume(struct snd_usb_audio *chip)
1624     int err = -ENODEV;
1625    
1626     down_read(&chip->shutdown_rwsem);
1627     - if (!chip->shutdown && !chip->probing)
1628     + if (chip->probing)
1629     + err = 0;
1630     + else if (!chip->shutdown)
1631     err = usb_autopm_get_interface(chip->pm_intf);
1632     up_read(&chip->shutdown_rwsem);
1633    
1634     diff --git a/sound/usb/midi.c b/sound/usb/midi.c
1635     index 34b9bb7..e5fee18 100644
1636     --- a/sound/usb/midi.c
1637     +++ b/sound/usb/midi.c
1638     @@ -126,7 +126,6 @@ struct snd_usb_midi {
1639     struct snd_usb_midi_in_endpoint *in;
1640     } endpoints[MIDI_MAX_ENDPOINTS];
1641     unsigned long input_triggered;
1642     - bool autopm_reference;
1643     unsigned int opened[2];
1644     unsigned char disconnected;
1645     unsigned char input_running;
1646     @@ -1040,7 +1039,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1647     {
1648     struct snd_usb_midi* umidi = substream->rmidi->private_data;
1649     struct snd_kcontrol *ctl;
1650     - int err;
1651    
1652     down_read(&umidi->disc_rwsem);
1653     if (umidi->disconnected) {
1654     @@ -1051,13 +1049,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1655     mutex_lock(&umidi->mutex);
1656     if (open) {
1657     if (!umidi->opened[0] && !umidi->opened[1]) {
1658     - err = usb_autopm_get_interface(umidi->iface);
1659     - umidi->autopm_reference = err >= 0;
1660     - if (err < 0 && err != -EACCES) {
1661     - mutex_unlock(&umidi->mutex);
1662     - up_read(&umidi->disc_rwsem);
1663     - return -EIO;
1664     - }
1665     if (umidi->roland_load_ctl) {
1666     ctl = umidi->roland_load_ctl;
1667     ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1668     @@ -1080,8 +1071,6 @@ static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1669     snd_ctl_notify(umidi->card,
1670     SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
1671     }
1672     - if (umidi->autopm_reference)
1673     - usb_autopm_put_interface(umidi->iface);
1674     }
1675     }
1676     mutex_unlock(&umidi->mutex);
1677     @@ -2256,6 +2245,8 @@ int snd_usbmidi_create(struct snd_card *card,
1678     return err;
1679     }
1680    
1681     + usb_autopm_get_interface_no_resume(umidi->iface);
1682     +
1683     list_add_tail(&umidi->list, midi_list);
1684     return 0;
1685     }
1686     diff --git a/sound/usb/stream.c b/sound/usb/stream.c
1687     index 5ff8010..33a335b 100644
1688     --- a/sound/usb/stream.c
1689     +++ b/sound/usb/stream.c
1690     @@ -168,6 +168,14 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
1691     if (!csep && altsd->bNumEndpoints >= 2)
1692     csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT);
1693    
1694     + /*
1695     + * If we can't locate the USB_DT_CS_ENDPOINT descriptor in the extra
1696     + * bytes after the first endpoint, go search the entire interface.
1697     + * Some devices have it directly *before* the standard endpoint.
1698     + */
1699     + if (!csep)
1700     + csep = snd_usb_find_desc(alts->extra, alts->extralen, NULL, USB_DT_CS_ENDPOINT);
1701     +
1702     if (!csep || csep->bLength < 7 ||
1703     csep->bDescriptorSubtype != UAC_EP_GENERAL) {
1704     snd_printk(KERN_WARNING "%d:%u:%d : no or invalid"