Magellan Linux

Annotation of /trunk/kernel26-alx/patches-3.10/0137-3.10.38-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2672 - (hide annotations) (download)
Tue Jul 21 16:46:35 2015 UTC (8 years, 9 months ago) by niro
File size: 22573 byte(s)
-3.10.84-alx-r1
1 niro 2672 diff --git a/Makefile b/Makefile
2     index bd9fb5b72fc0..bd51b50a567b 100644
3     --- a/Makefile
4     +++ b/Makefile
5     @@ -1,6 +1,6 @@
6     VERSION = 3
7     PATCHLEVEL = 10
8     -SUBLEVEL = 37
9     +SUBLEVEL = 38
10     EXTRAVERSION =
11     NAME = TOSSUG Baby Fish
12    
13     diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
14     index 9ac9f1666339..2668b3142fa2 100644
15     --- a/arch/sparc/Kconfig
16     +++ b/arch/sparc/Kconfig
17     @@ -25,7 +25,7 @@ config SPARC
18     select RTC_DRV_M48T59
19     select HAVE_DMA_ATTRS
20     select HAVE_DMA_API_DEBUG
21     - select HAVE_ARCH_JUMP_LABEL
22     + select HAVE_ARCH_JUMP_LABEL if SPARC64
23     select HAVE_GENERIC_HARDIRQS
24     select GENERIC_IRQ_SHOW
25     select ARCH_WANT_IPC_PARSE_VERSION
26     diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h
27     index e562d3caee57..ad7e178337f1 100644
28     --- a/arch/sparc/include/asm/uaccess_64.h
29     +++ b/arch/sparc/include/asm/uaccess_64.h
30     @@ -262,8 +262,8 @@ extern unsigned long __must_check __clear_user(void __user *, unsigned long);
31     extern __must_check long strlen_user(const char __user *str);
32     extern __must_check long strnlen_user(const char __user *str, long n);
33    
34     -#define __copy_to_user_inatomic ___copy_to_user
35     -#define __copy_from_user_inatomic ___copy_from_user
36     +#define __copy_to_user_inatomic __copy_to_user
37     +#define __copy_from_user_inatomic __copy_from_user
38    
39     struct pt_regs;
40     extern unsigned long compute_effective_address(struct pt_regs *,
41     diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
42     index baf4366e2d6a..906cbf0f8608 100644
43     --- a/arch/sparc/kernel/pci.c
44     +++ b/arch/sparc/kernel/pci.c
45     @@ -399,8 +399,8 @@ static void apb_fake_ranges(struct pci_dev *dev,
46     apb_calc_first_last(map, &first, &last);
47     res = bus->resource[1];
48     res->flags = IORESOURCE_MEM;
49     - region.start = (first << 21);
50     - region.end = (last << 21) + ((1 << 21) - 1);
51     + region.start = (first << 29);
52     + region.end = (last << 29) + ((1 << 29) - 1);
53     pcibios_bus_to_resource(dev, res, &region);
54     }
55    
56     diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
57     index baebab215492..b9cc9763faf4 100644
58     --- a/arch/sparc/kernel/process_64.c
59     +++ b/arch/sparc/kernel/process_64.c
60     @@ -57,9 +57,12 @@ void arch_cpu_idle(void)
61     {
62     if (tlb_type != hypervisor) {
63     touch_nmi_watchdog();
64     + local_irq_enable();
65     } else {
66     unsigned long pstate;
67    
68     + local_irq_enable();
69     +
70     /* The sun4v sleeping code requires that we have PSTATE.IE cleared over
71     * the cpu sleep hypervisor call.
72     */
73     @@ -81,7 +84,6 @@ void arch_cpu_idle(void)
74     : "=&r" (pstate)
75     : "i" (PSTATE_IE));
76     }
77     - local_irq_enable();
78     }
79    
80     #ifdef CONFIG_HOTPLUG_CPU
81     diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S
82     index 73ec8a798d95..c79c687fbe1e 100644
83     --- a/arch/sparc/kernel/syscalls.S
84     +++ b/arch/sparc/kernel/syscalls.S
85     @@ -189,7 +189,8 @@ linux_sparc_syscall32:
86     mov %i0, %l5 ! IEU1
87     5: call %l7 ! CTI Group brk forced
88     srl %i5, 0, %o5 ! IEU1
89     - ba,a,pt %xcc, 3f
90     + ba,pt %xcc, 3f
91     + sra %o0, 0, %o0
92    
93     /* Linux native system calls enter here... */
94     .align 32
95     @@ -217,7 +218,6 @@ linux_sparc_syscall:
96     3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
97     ret_sys_call:
98     ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
99     - sra %o0, 0, %o0
100     mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2
101     sllx %g2, 32, %g2
102    
103     diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
104     index 63bdb29b2549..4f7c82cdd0f5 100644
105     --- a/arch/x86/kernel/early-quirks.c
106     +++ b/arch/x86/kernel/early-quirks.c
107     @@ -202,18 +202,15 @@ static void __init intel_remapping_check(int num, int slot, int func)
108     revision = read_pci_config_byte(num, slot, func, PCI_REVISION_ID);
109    
110     /*
111     - * Revision 13 of all triggering devices id in this quirk have
112     - * a problem draining interrupts when irq remapping is enabled,
113     - * and should be flagged as broken. Additionally revisions 0x12
114     - * and 0x22 of device id 0x3405 has this problem.
115     + * Revision <= 13 of all triggering devices id in this quirk
116     + * have a problem draining interrupts when irq remapping is
117     + * enabled, and should be flagged as broken. Additionally
118     + * revision 0x22 of device id 0x3405 has this problem.
119     */
120     - if (revision == 0x13)
121     + if (revision <= 0x13)
122     set_irq_remapping_broken();
123     - else if ((device == 0x3405) &&
124     - ((revision == 0x12) ||
125     - (revision == 0x22)))
126     + else if (device == 0x3405 && revision == 0x22)
127     set_irq_remapping_broken();
128     -
129     }
130    
131     #define QFLAG_APPLY_ONCE 0x1
132     diff --git a/drivers/char/ipmi/ipmi_bt_sm.c b/drivers/char/ipmi/ipmi_bt_sm.c
133     index a22a7a502740..8156cafad11a 100644
134     --- a/drivers/char/ipmi/ipmi_bt_sm.c
135     +++ b/drivers/char/ipmi/ipmi_bt_sm.c
136     @@ -352,7 +352,7 @@ static inline void write_all_bytes(struct si_sm_data *bt)
137    
138     static inline int read_all_bytes(struct si_sm_data *bt)
139     {
140     - unsigned char i;
141     + unsigned int i;
142    
143     /*
144     * length is "framing info", minimum = 4: NetFn, Seq, Cmd, cCode.
145     diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c
146     index 05bcf0dffb8c..e54031c558e8 100644
147     --- a/drivers/staging/comedi/drivers/8255_pci.c
148     +++ b/drivers/staging/comedi/drivers/8255_pci.c
149     @@ -59,6 +59,7 @@ Configuration Options: not applicable, uses PCI auto config
150     #include "../comedidev.h"
151    
152     #include "8255.h"
153     +#include "mite.h"
154    
155     enum pci_8255_boardid {
156     BOARD_ADLINK_PCI7224,
157     @@ -82,6 +83,7 @@ struct pci_8255_boardinfo {
158     const char *name;
159     int dio_badr;
160     int n_8255;
161     + unsigned int has_mite:1;
162     };
163    
164     static const struct pci_8255_boardinfo pci_8255_boards[] = {
165     @@ -129,36 +131,43 @@ static const struct pci_8255_boardinfo pci_8255_boards[] = {
166     .name = "ni_pci-dio-96",
167     .dio_badr = 1,
168     .n_8255 = 4,
169     + .has_mite = 1,
170     },
171     [BOARD_NI_PCIDIO96B] = {
172     .name = "ni_pci-dio-96b",
173     .dio_badr = 1,
174     .n_8255 = 4,
175     + .has_mite = 1,
176     },
177     [BOARD_NI_PXI6508] = {
178     .name = "ni_pxi-6508",
179     .dio_badr = 1,
180     .n_8255 = 4,
181     + .has_mite = 1,
182     },
183     [BOARD_NI_PCI6503] = {
184     .name = "ni_pci-6503",
185     .dio_badr = 1,
186     .n_8255 = 1,
187     + .has_mite = 1,
188     },
189     [BOARD_NI_PCI6503B] = {
190     .name = "ni_pci-6503b",
191     .dio_badr = 1,
192     .n_8255 = 1,
193     + .has_mite = 1,
194     },
195     [BOARD_NI_PCI6503X] = {
196     .name = "ni_pci-6503x",
197     .dio_badr = 1,
198     .n_8255 = 1,
199     + .has_mite = 1,
200     },
201     [BOARD_NI_PXI_6503] = {
202     .name = "ni_pxi-6503",
203     .dio_badr = 1,
204     .n_8255 = 1,
205     + .has_mite = 1,
206     },
207     };
208    
209     @@ -166,6 +175,25 @@ struct pci_8255_private {
210     void __iomem *mmio_base;
211     };
212    
213     +static int pci_8255_mite_init(struct pci_dev *pcidev)
214     +{
215     + void __iomem *mite_base;
216     + u32 main_phys_addr;
217     +
218     + /* ioremap the MITE registers (BAR 0) temporarily */
219     + mite_base = pci_ioremap_bar(pcidev, 0);
220     + if (!mite_base)
221     + return -ENOMEM;
222     +
223     + /* set data window to main registers (BAR 1) */
224     + main_phys_addr = pci_resource_start(pcidev, 1);
225     + writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR);
226     +
227     + /* finished with MITE registers */
228     + iounmap(mite_base);
229     + return 0;
230     +}
231     +
232     static int pci_8255_mmio(int dir, int port, int data, unsigned long iobase)
233     {
234     void __iomem *mmio_base = (void __iomem *)iobase;
235     @@ -205,6 +233,12 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
236     if (ret)
237     return ret;
238    
239     + if (board->has_mite) {
240     + ret = pci_8255_mite_init(pcidev);
241     + if (ret)
242     + return ret;
243     + }
244     +
245     is_mmio = (pci_resource_flags(pcidev, board->dio_badr) &
246     IORESOURCE_MEM) != 0;
247     if (is_mmio) {
248     diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
249     index 59d26ef538d8..3723c0ebb316 100644
250     --- a/drivers/tty/tty_io.c
251     +++ b/drivers/tty/tty_io.c
252     @@ -1267,12 +1267,13 @@ static void pty_line_name(struct tty_driver *driver, int index, char *p)
253     *
254     * Locking: None
255     */
256     -static void tty_line_name(struct tty_driver *driver, int index, char *p)
257     +static ssize_t tty_line_name(struct tty_driver *driver, int index, char *p)
258     {
259     if (driver->flags & TTY_DRIVER_UNNUMBERED_NODE)
260     - strcpy(p, driver->name);
261     + return sprintf(p, "%s", driver->name);
262     else
263     - sprintf(p, "%s%d", driver->name, index + driver->name_base);
264     + return sprintf(p, "%s%d", driver->name,
265     + index + driver->name_base);
266     }
267    
268     /**
269     @@ -3538,9 +3539,19 @@ static ssize_t show_cons_active(struct device *dev,
270     if (i >= ARRAY_SIZE(cs))
271     break;
272     }
273     - while (i--)
274     - count += sprintf(buf + count, "%s%d%c",
275     - cs[i]->name, cs[i]->index, i ? ' ':'\n');
276     + while (i--) {
277     + int index = cs[i]->index;
278     + struct tty_driver *drv = cs[i]->device(cs[i], &index);
279     +
280     + /* don't resolve tty0 as some programs depend on it */
281     + if (drv && (cs[i]->index > 0 || drv->major != TTY_MAJOR))
282     + count += tty_line_name(drv, index, buf + count);
283     + else
284     + count += sprintf(buf + count, "%s%d",
285     + cs[i]->name, cs[i]->index);
286     +
287     + count += sprintf(buf + count, "%c", i ? ' ':'\n');
288     + }
289     console_unlock();
290    
291     return count;
292     diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
293     index b8b60b660c8f..4354b9127713 100644
294     --- a/fs/btrfs/disk-io.c
295     +++ b/fs/btrfs/disk-io.c
296     @@ -3161,6 +3161,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
297     /* send down all the barriers */
298     head = &info->fs_devices->devices;
299     list_for_each_entry_rcu(dev, head, dev_list) {
300     + if (dev->missing)
301     + continue;
302     if (!dev->bdev) {
303     errors_send++;
304     continue;
305     @@ -3175,6 +3177,8 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
306    
307     /* wait for all the barriers */
308     list_for_each_entry_rcu(dev, head, dev_list) {
309     + if (dev->missing)
310     + continue;
311     if (!dev->bdev) {
312     errors_wait++;
313     continue;
314     diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
315     index a2b625e279db..84d817b842a8 100644
316     --- a/fs/ext4/extents.c
317     +++ b/fs/ext4/extents.c
318     @@ -2511,6 +2511,27 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
319     ex_ee_block = le32_to_cpu(ex->ee_block);
320     ex_ee_len = ext4_ext_get_actual_len(ex);
321    
322     + /*
323     + * If we're starting with an extent other than the last one in the
324     + * node, we need to see if it shares a cluster with the extent to
325     + * the right (towards the end of the file). If its leftmost cluster
326     + * is this extent's rightmost cluster and it is not cluster aligned,
327     + * we'll mark it as a partial that is not to be deallocated.
328     + */
329     +
330     + if (ex != EXT_LAST_EXTENT(eh)) {
331     + ext4_fsblk_t current_pblk, right_pblk;
332     + long long current_cluster, right_cluster;
333     +
334     + current_pblk = ext4_ext_pblock(ex) + ex_ee_len - 1;
335     + current_cluster = (long long)EXT4_B2C(sbi, current_pblk);
336     + right_pblk = ext4_ext_pblock(ex + 1);
337     + right_cluster = (long long)EXT4_B2C(sbi, right_pblk);
338     + if (current_cluster == right_cluster &&
339     + EXT4_PBLK_COFF(sbi, right_pblk))
340     + *partial_cluster = -right_cluster;
341     + }
342     +
343     trace_ext4_ext_rm_leaf(inode, start, ex, *partial_cluster);
344    
345     while (ex >= EXT_FIRST_EXTENT(eh) &&
346     @@ -4032,7 +4053,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
347     struct ext4_extent newex, *ex, *ex2;
348     struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb);
349     ext4_fsblk_t newblock = 0;
350     - int free_on_err = 0, err = 0, depth;
351     + int free_on_err = 0, err = 0, depth, ret;
352     unsigned int allocated = 0, offset = 0;
353     unsigned int allocated_clusters = 0;
354     struct ext4_allocation_request ar;
355     @@ -4093,9 +4114,13 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
356     if (!ext4_ext_is_uninitialized(ex))
357     goto out;
358    
359     - allocated = ext4_ext_handle_uninitialized_extents(
360     + ret = ext4_ext_handle_uninitialized_extents(
361     handle, inode, map, path, flags,
362     allocated, newblock);
363     + if (ret < 0)
364     + err = ret;
365     + else
366     + allocated = ret;
367     goto out3;
368     }
369     }
370     diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
371     index e3ab1e4dc442..387213ac2608 100644
372     --- a/fs/fs-writeback.c
373     +++ b/fs/fs-writeback.c
374     @@ -87,16 +87,29 @@ static inline struct inode *wb_inode(struct list_head *head)
375     #define CREATE_TRACE_POINTS
376     #include <trace/events/writeback.h>
377    
378     +static void bdi_wakeup_thread(struct backing_dev_info *bdi)
379     +{
380     + spin_lock_bh(&bdi->wb_lock);
381     + if (test_bit(BDI_registered, &bdi->state))
382     + mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0);
383     + spin_unlock_bh(&bdi->wb_lock);
384     +}
385     +
386     static void bdi_queue_work(struct backing_dev_info *bdi,
387     struct wb_writeback_work *work)
388     {
389     trace_writeback_queue(bdi, work);
390    
391     spin_lock_bh(&bdi->wb_lock);
392     + if (!test_bit(BDI_registered, &bdi->state)) {
393     + if (work->done)
394     + complete(work->done);
395     + goto out_unlock;
396     + }
397     list_add_tail(&work->list, &bdi->work_list);
398     - spin_unlock_bh(&bdi->wb_lock);
399     -
400     mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0);
401     +out_unlock:
402     + spin_unlock_bh(&bdi->wb_lock);
403     }
404    
405     static void
406     @@ -112,7 +125,7 @@ __bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages,
407     work = kzalloc(sizeof(*work), GFP_ATOMIC);
408     if (!work) {
409     trace_writeback_nowork(bdi);
410     - mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0);
411     + bdi_wakeup_thread(bdi);
412     return;
413     }
414    
415     @@ -159,7 +172,7 @@ void bdi_start_background_writeback(struct backing_dev_info *bdi)
416     * writeback as soon as there is no other work to do.
417     */
418     trace_writeback_wake_background(bdi);
419     - mod_delayed_work(bdi_wq, &bdi->wb.dwork, 0);
420     + bdi_wakeup_thread(bdi);
421     }
422    
423     /*
424     @@ -1016,7 +1029,7 @@ void bdi_writeback_workfn(struct work_struct *work)
425     current->flags |= PF_SWAPWRITE;
426    
427     if (likely(!current_is_workqueue_rescuer() ||
428     - list_empty(&bdi->bdi_list))) {
429     + !test_bit(BDI_registered, &bdi->state))) {
430     /*
431     * The normal path. Keep writing back @bdi until its
432     * work_list is empty. Note that this path is also taken
433     @@ -1038,10 +1051,10 @@ void bdi_writeback_workfn(struct work_struct *work)
434     trace_writeback_pages_written(pages_written);
435     }
436    
437     - if (!list_empty(&bdi->work_list) ||
438     - (wb_has_dirty_io(wb) && dirty_writeback_interval))
439     - queue_delayed_work(bdi_wq, &wb->dwork,
440     - msecs_to_jiffies(dirty_writeback_interval * 10));
441     + if (!list_empty(&bdi->work_list))
442     + mod_delayed_work(bdi_wq, &wb->dwork, 0);
443     + else if (wb_has_dirty_io(wb) && dirty_writeback_interval)
444     + bdi_wakeup_thread_delayed(bdi);
445    
446     current->flags &= ~PF_SWAPWRITE;
447     }
448     diff --git a/fs/jffs2/compr_rtime.c b/fs/jffs2/compr_rtime.c
449     index 16a5047903a6..406d9cc84ba8 100644
450     --- a/fs/jffs2/compr_rtime.c
451     +++ b/fs/jffs2/compr_rtime.c
452     @@ -33,7 +33,7 @@ static int jffs2_rtime_compress(unsigned char *data_in,
453     unsigned char *cpage_out,
454     uint32_t *sourcelen, uint32_t *dstlen)
455     {
456     - short positions[256];
457     + unsigned short positions[256];
458     int outpos = 0;
459     int pos=0;
460    
461     @@ -74,7 +74,7 @@ static int jffs2_rtime_decompress(unsigned char *data_in,
462     unsigned char *cpage_out,
463     uint32_t srclen, uint32_t destlen)
464     {
465     - short positions[256];
466     + unsigned short positions[256];
467     int outpos = 0;
468     int pos=0;
469    
470     diff --git a/fs/jffs2/nodelist.h b/fs/jffs2/nodelist.h
471     index e4619b00f7c5..fa35ff79ab35 100644
472     --- a/fs/jffs2/nodelist.h
473     +++ b/fs/jffs2/nodelist.h
474     @@ -231,7 +231,7 @@ struct jffs2_tmp_dnode_info
475     uint32_t version;
476     uint32_t data_crc;
477     uint32_t partial_crc;
478     - uint16_t csize;
479     + uint32_t csize;
480     uint16_t overlapped;
481     };
482    
483     diff --git a/fs/jffs2/nodemgmt.c b/fs/jffs2/nodemgmt.c
484     index 03310721712f..b6bd4affd9ad 100644
485     --- a/fs/jffs2/nodemgmt.c
486     +++ b/fs/jffs2/nodemgmt.c
487     @@ -179,6 +179,7 @@ int jffs2_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
488     spin_unlock(&c->erase_completion_lock);
489    
490     schedule();
491     + remove_wait_queue(&c->erase_wait, &wait);
492     } else
493     spin_unlock(&c->erase_completion_lock);
494     } else if (ret)
495     @@ -211,20 +212,25 @@ out:
496     int jffs2_reserve_space_gc(struct jffs2_sb_info *c, uint32_t minsize,
497     uint32_t *len, uint32_t sumsize)
498     {
499     - int ret = -EAGAIN;
500     + int ret;
501     minsize = PAD(minsize);
502    
503     jffs2_dbg(1, "%s(): Requested 0x%x bytes\n", __func__, minsize);
504    
505     - spin_lock(&c->erase_completion_lock);
506     - while(ret == -EAGAIN) {
507     + while (true) {
508     + spin_lock(&c->erase_completion_lock);
509     ret = jffs2_do_reserve_space(c, minsize, len, sumsize);
510     if (ret) {
511     jffs2_dbg(1, "%s(): looping, ret is %d\n",
512     __func__, ret);
513     }
514     + spin_unlock(&c->erase_completion_lock);
515     +
516     + if (ret == -EAGAIN)
517     + cond_resched();
518     + else
519     + break;
520     }
521     - spin_unlock(&c->erase_completion_lock);
522     if (!ret)
523     ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, 1);
524    
525     diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h
526     index c3881553f7d1..4cfdbf28fc6a 100644
527     --- a/include/linux/backing-dev.h
528     +++ b/include/linux/backing-dev.h
529     @@ -95,7 +95,7 @@ struct backing_dev_info {
530     unsigned int max_ratio, max_prop_frac;
531    
532     struct bdi_writeback wb; /* default writeback info for this bdi */
533     - spinlock_t wb_lock; /* protects work_list */
534     + spinlock_t wb_lock; /* protects work_list & wb.dwork scheduling */
535    
536     struct list_head work_list;
537    
538     diff --git a/kernel/exit.c b/kernel/exit.c
539     index 7bb73f9d09db..6682b2ea5b11 100644
540     --- a/kernel/exit.c
541     +++ b/kernel/exit.c
542     @@ -570,9 +570,6 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
543     struct list_head *dead)
544     {
545     list_move_tail(&p->sibling, &p->real_parent->children);
546     -
547     - if (p->exit_state == EXIT_DEAD)
548     - return;
549     /*
550     * If this is a threaded reparent there is no need to
551     * notify anyone anything has happened.
552     @@ -580,9 +577,19 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
553     if (same_thread_group(p->real_parent, father))
554     return;
555    
556     - /* We don't want people slaying init. */
557     + /*
558     + * We don't want people slaying init.
559     + *
560     + * Note: we do this even if it is EXIT_DEAD, wait_task_zombie()
561     + * can change ->exit_state to EXIT_ZOMBIE. If this is the final
562     + * state, do_notify_parent() was already called and ->exit_signal
563     + * doesn't matter.
564     + */
565     p->exit_signal = SIGCHLD;
566    
567     + if (p->exit_state == EXIT_DEAD)
568     + return;
569     +
570     /* If it has exited notify the new parent about this child's death. */
571     if (!p->ptrace &&
572     p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {
573     @@ -794,6 +801,8 @@ void do_exit(long code)
574     exit_shm(tsk);
575     exit_files(tsk);
576     exit_fs(tsk);
577     + if (group_dead)
578     + disassociate_ctty(1);
579     exit_task_namespaces(tsk);
580     exit_task_work(tsk);
581     check_stack_usage();
582     @@ -809,13 +818,9 @@ void do_exit(long code)
583    
584     cgroup_exit(tsk, 1);
585    
586     - if (group_dead)
587     - disassociate_ctty(1);
588     -
589     module_put(task_thread_info(tsk)->exec_domain->module);
590    
591     proc_exit_connector(tsk);
592     -
593     /*
594     * FIXME: do that only when needed, using sched_exit tracepoint
595     */
596     diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c
597     index 6917e8edb48e..e32703d5e0ab 100644
598     --- a/kernel/pid_namespace.c
599     +++ b/kernel/pid_namespace.c
600     @@ -312,7 +312,9 @@ static void *pidns_get(struct task_struct *task)
601     struct pid_namespace *ns;
602    
603     rcu_read_lock();
604     - ns = get_pid_ns(task_active_pid_ns(task));
605     + ns = task_active_pid_ns(task);
606     + if (ns)
607     + get_pid_ns(ns);
608     rcu_read_unlock();
609    
610     return ns;
611     diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
612     index 9064b919a406..9bea1d7dd21f 100644
613     --- a/kernel/user_namespace.c
614     +++ b/kernel/user_namespace.c
615     @@ -148,7 +148,7 @@ static u32 map_id_range_down(struct uid_gid_map *map, u32 id, u32 count)
616    
617     /* Find the matching extent */
618     extents = map->nr_extents;
619     - smp_read_barrier_depends();
620     + smp_rmb();
621     for (idx = 0; idx < extents; idx++) {
622     first = map->extent[idx].first;
623     last = first + map->extent[idx].count - 1;
624     @@ -172,7 +172,7 @@ static u32 map_id_down(struct uid_gid_map *map, u32 id)
625    
626     /* Find the matching extent */
627     extents = map->nr_extents;
628     - smp_read_barrier_depends();
629     + smp_rmb();
630     for (idx = 0; idx < extents; idx++) {
631     first = map->extent[idx].first;
632     last = first + map->extent[idx].count - 1;
633     @@ -195,7 +195,7 @@ static u32 map_id_up(struct uid_gid_map *map, u32 id)
634    
635     /* Find the matching extent */
636     extents = map->nr_extents;
637     - smp_read_barrier_depends();
638     + smp_rmb();
639     for (idx = 0; idx < extents; idx++) {
640     first = map->extent[idx].lower_first;
641     last = first + map->extent[idx].count - 1;
642     @@ -611,9 +611,8 @@ static ssize_t map_write(struct file *file, const char __user *buf,
643     * were written before the count of the extents.
644     *
645     * To achieve this smp_wmb() is used on guarantee the write
646     - * order and smp_read_barrier_depends() is guaranteed that we
647     - * don't have crazy architectures returning stale data.
648     - *
649     + * order and smp_rmb() is guaranteed that we don't have crazy
650     + * architectures returning stale data.
651     */
652     mutex_lock(&id_map_mutex);
653    
654     diff --git a/mm/backing-dev.c b/mm/backing-dev.c
655     index 502517492258..eea1a9dfac38 100644
656     --- a/mm/backing-dev.c
657     +++ b/mm/backing-dev.c
658     @@ -287,13 +287,19 @@ int bdi_has_dirty_io(struct backing_dev_info *bdi)
659     * Note, we wouldn't bother setting up the timer, but this function is on the
660     * fast-path (used by '__mark_inode_dirty()'), so we save few context switches
661     * by delaying the wake-up.
662     + *
663     + * We have to be careful not to postpone flush work if it is scheduled for
664     + * earlier. Thus we use queue_delayed_work().
665     */
666     void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi)
667     {
668     unsigned long timeout;
669    
670     timeout = msecs_to_jiffies(dirty_writeback_interval * 10);
671     - mod_delayed_work(bdi_wq, &bdi->wb.dwork, timeout);
672     + spin_lock_bh(&bdi->wb_lock);
673     + if (test_bit(BDI_registered, &bdi->state))
674     + queue_delayed_work(bdi_wq, &bdi->wb.dwork, timeout);
675     + spin_unlock_bh(&bdi->wb_lock);
676     }
677    
678     /*
679     @@ -306,9 +312,6 @@ static void bdi_remove_from_list(struct backing_dev_info *bdi)
680     spin_unlock_bh(&bdi_lock);
681    
682     synchronize_rcu_expedited();
683     -
684     - /* bdi_list is now unused, clear it to mark @bdi dying */
685     - INIT_LIST_HEAD(&bdi->bdi_list);
686     }
687    
688     int bdi_register(struct backing_dev_info *bdi, struct device *parent,
689     @@ -359,6 +362,11 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi)
690     */
691     bdi_remove_from_list(bdi);
692    
693     + /* Make sure nobody queues further work */
694     + spin_lock_bh(&bdi->wb_lock);
695     + clear_bit(BDI_registered, &bdi->state);
696     + spin_unlock_bh(&bdi->wb_lock);
697     +
698     /*
699     * Drain work list and shutdown the delayed_work. At this point,
700     * @bdi->bdi_list is empty telling bdi_Writeback_workfn() that @bdi
701     diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
702     index dcaa6dbbab2c..cfca44f8d048 100644
703     --- a/net/bluetooth/hci_event.c
704     +++ b/net/bluetooth/hci_event.c
705     @@ -3619,7 +3619,13 @@ static void hci_le_ltk_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
706    
707     hci_send_cmd(hdev, HCI_OP_LE_LTK_REPLY, sizeof(cp), &cp);
708    
709     - if (ltk->type & HCI_SMP_STK) {
710     + /* Ref. Bluetooth Core SPEC pages 1975 and 2004. STK is a
711     + * temporary key used to encrypt a connection following
712     + * pairing. It is used during the Encrypted Session Setup to
713     + * distribute the keys. Later, security can be re-established
714     + * using a distributed LTK.
715     + */
716     + if (ltk->type == HCI_SMP_STK_SLAVE) {
717     list_del(&ltk->list);
718     kfree(ltk);
719     }