Magellan Linux

Annotation of /trunk/kernel-alx/patches-3.4/0134-3.4.35-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2110 - (hide annotations) (download)
Tue Mar 12 12:15:23 2013 UTC (11 years, 2 months ago) by niro
File size: 46737 byte(s)
-sync with upstream
1 niro 2110 diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
2     index c1601e5..753d18a 100644
3     --- a/Documentation/kernel-parameters.txt
4     +++ b/Documentation/kernel-parameters.txt
5     @@ -557,6 +557,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
6     UART at the specified I/O port or MMIO address,
7     switching to the matching ttyS device later. The
8     options are the same as for ttyS, above.
9     + hvc<n> Use the hypervisor console device <n>. This is for
10     + both Xen and PowerPC hypervisors.
11    
12     If the device connected to the port is not a TTY but a braille
13     device, prepend "brl," before the device type, for instance
14     @@ -742,6 +744,7 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
15    
16     earlyprintk= [X86,SH,BLACKFIN]
17     earlyprintk=vga
18     + earlyprintk=xen
19     earlyprintk=serial[,ttySn[,baudrate]]
20     earlyprintk=ttySn[,baudrate]
21     earlyprintk=dbgp[debugController#]
22     @@ -759,6 +762,8 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
23     The VGA output is eventually overwritten by the real
24     console.
25    
26     + The xen output can only be used by Xen PV guests.
27     +
28     ekgdboc= [X86,KGDB] Allow early kernel console debugging
29     ekgdboc=kbd
30    
31     diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c
32     index 48d9d4e..992f442 100644
33     --- a/arch/x86/kernel/head.c
34     +++ b/arch/x86/kernel/head.c
35     @@ -5,8 +5,6 @@
36     #include <asm/setup.h>
37     #include <asm/bios_ebda.h>
38    
39     -#define BIOS_LOWMEM_KILOBYTES 0x413
40     -
41     /*
42     * The BIOS places the EBDA/XBDA at the top of conventional
43     * memory, and usually decreases the reported amount of
44     @@ -16,17 +14,30 @@
45     * chipset: reserve a page before VGA to prevent PCI prefetch
46     * into it (errata #56). Usually the page is reserved anyways,
47     * unless you have no PS/2 mouse plugged in.
48     + *
49     + * This functions is deliberately very conservative. Losing
50     + * memory in the bottom megabyte is rarely a problem, as long
51     + * as we have enough memory to install the trampoline. Using
52     + * memory that is in use by the BIOS or by some DMA device
53     + * the BIOS didn't shut down *is* a big problem.
54     */
55     +
56     +#define BIOS_LOWMEM_KILOBYTES 0x413
57     +#define LOWMEM_CAP 0x9f000U /* Absolute maximum */
58     +#define INSANE_CUTOFF 0x20000U /* Less than this = insane */
59     +
60     void __init reserve_ebda_region(void)
61     {
62     unsigned int lowmem, ebda_addr;
63    
64     - /* To determine the position of the EBDA and the */
65     - /* end of conventional memory, we need to look at */
66     - /* the BIOS data area. In a paravirtual environment */
67     - /* that area is absent. We'll just have to assume */
68     - /* that the paravirt case can handle memory setup */
69     - /* correctly, without our help. */
70     + /*
71     + * To determine the position of the EBDA and the
72     + * end of conventional memory, we need to look at
73     + * the BIOS data area. In a paravirtual environment
74     + * that area is absent. We'll just have to assume
75     + * that the paravirt case can handle memory setup
76     + * correctly, without our help.
77     + */
78     if (paravirt_enabled())
79     return;
80    
81     @@ -37,19 +48,23 @@ void __init reserve_ebda_region(void)
82     /* start of EBDA area */
83     ebda_addr = get_bios_ebda();
84    
85     - /* Fixup: bios puts an EBDA in the top 64K segment */
86     - /* of conventional memory, but does not adjust lowmem. */
87     - if ((lowmem - ebda_addr) <= 0x10000)
88     - lowmem = ebda_addr;
89     + /*
90     + * Note: some old Dells seem to need 4k EBDA without
91     + * reporting so, so just consider the memory above 0x9f000
92     + * to be off limits (bugzilla 2990).
93     + */
94     +
95     + /* If the EBDA address is below 128K, assume it is bogus */
96     + if (ebda_addr < INSANE_CUTOFF)
97     + ebda_addr = LOWMEM_CAP;
98    
99     - /* Fixup: bios does not report an EBDA at all. */
100     - /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
101     - if ((ebda_addr == 0) && (lowmem >= 0x9f000))
102     - lowmem = 0x9f000;
103     + /* If lowmem is less than 128K, assume it is bogus */
104     + if (lowmem < INSANE_CUTOFF)
105     + lowmem = LOWMEM_CAP;
106    
107     - /* Paranoia: should never happen, but... */
108     - if ((lowmem == 0) || (lowmem >= 0x100000))
109     - lowmem = 0x9f000;
110     + /* Use the lower of the lowmem and EBDA markers as the cutoff */
111     + lowmem = min(lowmem, ebda_addr);
112     + lowmem = min(lowmem, LOWMEM_CAP); /* Absolute cap */
113    
114     /* reserve all memory between lowmem and the 1MB mark */
115     memblock_reserve(lowmem, 0x100000 - lowmem);
116     diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
117     index 3705bb0..1e40637 100644
118     --- a/arch/x86/platform/efi/efi.c
119     +++ b/arch/x86/platform/efi/efi.c
120     @@ -84,9 +84,10 @@ int efi_enabled(int facility)
121     }
122     EXPORT_SYMBOL(efi_enabled);
123    
124     +static bool disable_runtime = false;
125     static int __init setup_noefi(char *arg)
126     {
127     - clear_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
128     + disable_runtime = true;
129     return 0;
130     }
131     early_param("noefi", setup_noefi);
132     @@ -733,7 +734,7 @@ void __init efi_init(void)
133     if (!efi_is_native())
134     pr_info("No EFI runtime due to 32/64-bit mismatch with kernel\n");
135     else {
136     - if (efi_runtime_init())
137     + if (disable_runtime || efi_runtime_init())
138     return;
139     set_bit(EFI_RUNTIME_SERVICES, &x86_efi_facility);
140     }
141     diff --git a/block/genhd.c b/block/genhd.c
142     index 9cf5583..60108d9 100644
143     --- a/block/genhd.c
144     +++ b/block/genhd.c
145     @@ -25,7 +25,7 @@ static DEFINE_MUTEX(block_class_lock);
146     struct kobject *block_depr;
147    
148     /* for extended dynamic devt allocation, currently only one major is used */
149     -#define MAX_EXT_DEVT (1 << MINORBITS)
150     +#define NR_EXT_DEVT (1 << MINORBITS)
151    
152     /* For extended devt allocation. ext_devt_mutex prevents look up
153     * results from going away underneath its user.
154     @@ -420,17 +420,18 @@ int blk_alloc_devt(struct hd_struct *part, dev_t *devt)
155     do {
156     if (!idr_pre_get(&ext_devt_idr, GFP_KERNEL))
157     return -ENOMEM;
158     + mutex_lock(&ext_devt_mutex);
159     rc = idr_get_new(&ext_devt_idr, part, &idx);
160     + if (!rc && idx >= NR_EXT_DEVT) {
161     + idr_remove(&ext_devt_idr, idx);
162     + rc = -EBUSY;
163     + }
164     + mutex_unlock(&ext_devt_mutex);
165     } while (rc == -EAGAIN);
166    
167     if (rc)
168     return rc;
169    
170     - if (idx > MAX_EXT_DEVT) {
171     - idr_remove(&ext_devt_idr, idx);
172     - return -EBUSY;
173     - }
174     -
175     *devt = MKDEV(BLOCK_EXT_MAJOR, blk_mangle_minor(idx));
176     return 0;
177     }
178     @@ -644,7 +645,6 @@ void del_gendisk(struct gendisk *disk)
179     disk_part_iter_exit(&piter);
180    
181     invalidate_partition(disk, 0);
182     - blk_free_devt(disk_to_dev(disk)->devt);
183     set_capacity(disk, 0);
184     disk->flags &= ~GENHD_FL_UP;
185    
186     @@ -662,6 +662,7 @@ void del_gendisk(struct gendisk *disk)
187     if (!sysfs_deprecated)
188     sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
189     device_del(disk_to_dev(disk));
190     + blk_free_devt(disk_to_dev(disk)->devt);
191     }
192     EXPORT_SYMBOL(del_gendisk);
193    
194     diff --git a/block/partition-generic.c b/block/partition-generic.c
195     index 6df5d69..7b8b8d1 100644
196     --- a/block/partition-generic.c
197     +++ b/block/partition-generic.c
198     @@ -249,11 +249,11 @@ void delete_partition(struct gendisk *disk, int partno)
199     if (!part)
200     return;
201    
202     - blk_free_devt(part_devt(part));
203     rcu_assign_pointer(ptbl->part[partno], NULL);
204     rcu_assign_pointer(ptbl->last_lookup, NULL);
205     kobject_put(part->holder_dir);
206     device_del(part_to_dev(part));
207     + blk_free_devt(part_devt(part));
208    
209     hd_struct_put(part);
210     }
211     diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
212     index aa0a904..189c704 100644
213     --- a/drivers/acpi/sleep.c
214     +++ b/drivers/acpi/sleep.c
215     @@ -186,6 +186,14 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
216     },
217     {
218     .callback = init_nvs_nosave,
219     + .ident = "Sony Vaio VGN-FW41E_H",
220     + .matches = {
221     + DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
222     + DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FW41E_H"),
223     + },
224     + },
225     + {
226     + .callback = init_nvs_nosave,
227     .ident = "Sony Vaio VGN-FW21E",
228     .matches = {
229     DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
230     diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
231     index 3c809bf..88f6908 100644
232     --- a/drivers/ata/ata_piix.c
233     +++ b/drivers/ata/ata_piix.c
234     @@ -331,6 +331,23 @@ static const struct pci_device_id piix_pci_tbl[] = {
235     { 0x8086, 0x8c09, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
236     /* SATA Controller IDE (DH89xxCC) */
237     { 0x8086, 0x2326, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
238     + /* SATA Controller IDE (Avoton) */
239     + { 0x8086, 0x1f20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
240     + /* SATA Controller IDE (Avoton) */
241     + { 0x8086, 0x1f21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
242     + /* SATA Controller IDE (Avoton) */
243     + { 0x8086, 0x1f30, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
244     + /* SATA Controller IDE (Avoton) */
245     + { 0x8086, 0x1f31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
246     + /* SATA Controller IDE (Wellsburg) */
247     + { 0x8086, 0x8d00, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
248     + /* SATA Controller IDE (Wellsburg) */
249     + { 0x8086, 0x8d08, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
250     + /* SATA Controller IDE (Wellsburg) */
251     + { 0x8086, 0x8d60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_snb },
252     + /* SATA Controller IDE (Wellsburg) */
253     + { 0x8086, 0x8d68, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata },
254     +
255     { } /* terminate list */
256     };
257    
258     diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
259     index c6decb9..73d8c92 100644
260     --- a/drivers/block/xen-blkback/blkback.c
261     +++ b/drivers/block/xen-blkback/blkback.c
262     @@ -623,7 +623,6 @@ static int dispatch_rw_block_io(struct xen_blkif *blkif,
263     goto fail_response;
264     }
265    
266     - preq.dev = req->u.rw.handle;
267     preq.sector_number = req->u.rw.sector_number;
268     preq.nr_sects = 0;
269    
270     diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
271     index 4f66171..a155254 100644
272     --- a/drivers/block/xen-blkback/xenbus.c
273     +++ b/drivers/block/xen-blkback/xenbus.c
274     @@ -367,6 +367,7 @@ static int xen_blkbk_remove(struct xenbus_device *dev)
275     be->blkif = NULL;
276     }
277    
278     + kfree(be->mode);
279     kfree(be);
280     dev_set_drvdata(&dev->dev, NULL);
281     return 0;
282     @@ -502,6 +503,7 @@ static void backend_changed(struct xenbus_watch *watch,
283     = container_of(watch, struct backend_info, backend_watch);
284     struct xenbus_device *dev = be->dev;
285     int cdrom = 0;
286     + unsigned long handle;
287     char *device_type;
288    
289     DPRINTK("");
290     @@ -521,10 +523,10 @@ static void backend_changed(struct xenbus_watch *watch,
291     return;
292     }
293    
294     - if ((be->major || be->minor) &&
295     - ((be->major != major) || (be->minor != minor))) {
296     - pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported.\n",
297     - be->major, be->minor, major, minor);
298     + if (be->major | be->minor) {
299     + if (be->major != major || be->minor != minor)
300     + pr_warn(DRV_PFX "changing physical device (from %x:%x to %x:%x) not supported.\n",
301     + be->major, be->minor, major, minor);
302     return;
303     }
304    
305     @@ -542,36 +544,33 @@ static void backend_changed(struct xenbus_watch *watch,
306     kfree(device_type);
307     }
308    
309     - if (be->major == 0 && be->minor == 0) {
310     - /* Front end dir is a number, which is used as the handle. */
311     -
312     - char *p = strrchr(dev->otherend, '/') + 1;
313     - long handle;
314     - err = strict_strtoul(p, 0, &handle);
315     - if (err)
316     - return;
317     + /* Front end dir is a number, which is used as the handle. */
318     + err = strict_strtoul(strrchr(dev->otherend, '/') + 1, 0, &handle);
319     + if (err)
320     + return;
321    
322     - be->major = major;
323     - be->minor = minor;
324     + be->major = major;
325     + be->minor = minor;
326    
327     - err = xen_vbd_create(be->blkif, handle, major, minor,
328     - (NULL == strchr(be->mode, 'w')), cdrom);
329     - if (err) {
330     - be->major = 0;
331     - be->minor = 0;
332     - xenbus_dev_fatal(dev, err, "creating vbd structure");
333     - return;
334     - }
335     + err = xen_vbd_create(be->blkif, handle, major, minor,
336     + !strchr(be->mode, 'w'), cdrom);
337    
338     + if (err)
339     + xenbus_dev_fatal(dev, err, "creating vbd structure");
340     + else {
341     err = xenvbd_sysfs_addif(dev);
342     if (err) {
343     xen_vbd_free(&be->blkif->vbd);
344     - be->major = 0;
345     - be->minor = 0;
346     xenbus_dev_fatal(dev, err, "creating sysfs entries");
347     - return;
348     }
349     + }
350    
351     + if (err) {
352     + kfree(be->mode);
353     + be->mode = NULL;
354     + be->major = 0;
355     + be->minor = 0;
356     + } else {
357     /* We're potentially connected now */
358     xen_update_blkif_status(be->blkif);
359     }
360     diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
361     index 68109e9..04ebeaf 100644
362     --- a/drivers/firewire/core-device.c
363     +++ b/drivers/firewire/core-device.c
364     @@ -999,6 +999,10 @@ static void fw_device_init(struct work_struct *work)
365     ret = idr_pre_get(&fw_device_idr, GFP_KERNEL) ?
366     idr_get_new(&fw_device_idr, device, &minor) :
367     -ENOMEM;
368     + if (minor >= 1 << MINORBITS) {
369     + idr_remove(&fw_device_idr, minor);
370     + minor = -ENOSPC;
371     + }
372     up_write(&fw_device_rwsem);
373    
374     if (ret < 0)
375     diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
376     index 1a92a27..ff73d60 100644
377     --- a/drivers/hid/hid-core.c
378     +++ b/drivers/hid/hid-core.c
379     @@ -1922,6 +1922,7 @@ static const struct hid_device_id hid_ignore_list[] = {
380     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HYBRID) },
381     { HID_USB_DEVICE(USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_HEATCONTROL) },
382     { HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_BEATPAD) },
383     + { HID_USB_DEVICE(USB_VENDOR_ID_MASTERKIT, USB_DEVICE_ID_MASTERKIT_MA901RADIO) },
384     { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS) },
385     { HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
386     { HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
387     diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
388     index 5583899..02f4664 100644
389     --- a/drivers/hid/hid-ids.h
390     +++ b/drivers/hid/hid-ids.h
391     @@ -520,6 +520,9 @@
392     #define USB_VENDOR_ID_MADCATZ 0x0738
393     #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
394    
395     +#define USB_VENDOR_ID_MASTERKIT 0x16c0
396     +#define USB_DEVICE_ID_MASTERKIT_MA901RADIO 0x05df
397     +
398     #define USB_VENDOR_ID_MCC 0x09db
399     #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
400     #define USB_DEVICE_ID_MCC_PMD1208LS 0x007a
401     diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
402     index ef0ae93..b573f80 100644
403     --- a/drivers/iommu/amd_iommu_init.c
404     +++ b/drivers/iommu/amd_iommu_init.c
405     @@ -1572,8 +1572,6 @@ int __init amd_iommu_init_hardware(void)
406     if (amd_iommu_pd_alloc_bitmap == NULL)
407     goto free;
408    
409     - /* init the device table */
410     - init_device_table();
411    
412     /*
413     * let all alias entries point to itself
414     @@ -1655,6 +1653,7 @@ out:
415     */
416     static int __init amd_iommu_init(void)
417     {
418     + struct amd_iommu *iommu;
419     int ret = 0;
420    
421     ret = amd_iommu_init_hardware();
422     @@ -1673,6 +1672,12 @@ static int __init amd_iommu_init(void)
423     if (ret)
424     goto free;
425    
426     + /* init the device table */
427     + init_device_table();
428     +
429     + for_each_iommu(iommu)
430     + iommu_flush_all_caches(iommu);
431     +
432     amd_iommu_init_api();
433    
434     x86_platform.iommu_shutdown = disable_iommus;
435     diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
436     index cabc19c..cec1f8c 100644
437     --- a/drivers/media/rc/rc-main.c
438     +++ b/drivers/media/rc/rc-main.c
439     @@ -778,8 +778,10 @@ static ssize_t show_protocols(struct device *device,
440     } else if (dev->raw) {
441     enabled = dev->raw->enabled_protocols;
442     allowed = ir_raw_get_allowed_protocols();
443     - } else
444     + } else {
445     + mutex_unlock(&dev->lock);
446     return -ENODEV;
447     + }
448    
449     IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n",
450     (long long)allowed,
451     diff --git a/drivers/net/wireless/ath/ath9k/ar9003_calib.c b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
452     index 63089cc..9284bca 100644
453     --- a/drivers/net/wireless/ath/ath9k/ar9003_calib.c
454     +++ b/drivers/net/wireless/ath/ath9k/ar9003_calib.c
455     @@ -938,6 +938,8 @@ static bool ar9003_hw_init_cal(struct ath_hw *ah,
456     AR_PHY_CL_TAB_1,
457     AR_PHY_CL_TAB_2 };
458    
459     + ar9003_hw_set_chain_masks(ah, ah->caps.rx_chainmask, ah->caps.tx_chainmask);
460     +
461     if (rtt) {
462     if (!ar9003_hw_rtt_restore(ah, chan))
463     run_rtt_cal = true;
464     diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
465     index 600aca9..f86ee0c 100644
466     --- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
467     +++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
468     @@ -543,7 +543,7 @@ static void ar9003_hw_init_bb(struct ath_hw *ah,
469     udelay(synthDelay + BASE_ACTIVATE_DELAY);
470     }
471    
472     -static void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
473     +void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx)
474     {
475     switch (rx) {
476     case 0x5:
477     diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
478     index f8e1fbb..d5c5dca 100644
479     --- a/drivers/net/wireless/ath/ath9k/hw.h
480     +++ b/drivers/net/wireless/ath/ath9k/hw.h
481     @@ -1014,6 +1014,7 @@ int ar9003_paprd_setup_gain_table(struct ath_hw *ah, int chain);
482     int ar9003_paprd_init_table(struct ath_hw *ah);
483     bool ar9003_paprd_is_done(struct ath_hw *ah);
484     void ar9003_hw_set_paprd_txdesc(struct ath_hw *ah, void *ds, u8 chains);
485     +void ar9003_hw_set_chain_masks(struct ath_hw *ah, u8 rx, u8 tx);
486    
487     /* Hardware family op attach helpers */
488     void ar5008_hw_attach_phy_ops(struct ath_hw *ah);
489     diff --git a/drivers/power/ab8500_btemp.c b/drivers/power/ab8500_btemp.c
490     index d8bb993..2a6bf76 100644
491     --- a/drivers/power/ab8500_btemp.c
492     +++ b/drivers/power/ab8500_btemp.c
493     @@ -1115,7 +1115,7 @@ static void __exit ab8500_btemp_exit(void)
494     platform_driver_unregister(&ab8500_btemp_driver);
495     }
496    
497     -subsys_initcall_sync(ab8500_btemp_init);
498     +device_initcall(ab8500_btemp_init);
499     module_exit(ab8500_btemp_exit);
500    
501     MODULE_LICENSE("GPL v2");
502     diff --git a/drivers/power/abx500_chargalg.c b/drivers/power/abx500_chargalg.c
503     index 804b88c..d8cd151 100644
504     --- a/drivers/power/abx500_chargalg.c
505     +++ b/drivers/power/abx500_chargalg.c
506     @@ -1698,7 +1698,7 @@ static ssize_t abx500_chargalg_sysfs_charger(struct kobject *kobj,
507     static struct attribute abx500_chargalg_en_charger = \
508     {
509     .name = "chargalg",
510     - .mode = S_IWUGO,
511     + .mode = S_IWUSR,
512     };
513    
514     static struct attribute *abx500_chargalg_chg[] = {
515     diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
516     index cf67ce5..3799cf1 100644
517     --- a/drivers/staging/comedi/comedi_fops.c
518     +++ b/drivers/staging/comedi/comedi_fops.c
519     @@ -1577,7 +1577,7 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait)
520    
521     mask = 0;
522     read_subdev = comedi_get_read_subdevice(dev_file_info);
523     - if (read_subdev) {
524     + if (read_subdev && read_subdev->async) {
525     poll_wait(file, &read_subdev->async->wait_head, wait);
526     if (!read_subdev->busy
527     || comedi_buf_read_n_available(read_subdev->async) > 0
528     @@ -1587,7 +1587,7 @@ static unsigned int comedi_poll(struct file *file, poll_table * wait)
529     }
530     }
531     write_subdev = comedi_get_write_subdevice(dev_file_info);
532     - if (write_subdev) {
533     + if (write_subdev && write_subdev->async) {
534     poll_wait(file, &write_subdev->async->wait_head, wait);
535     comedi_buf_write_alloc(write_subdev->async,
536     write_subdev->async->prealloc_bufsz);
537     @@ -1629,7 +1629,7 @@ static ssize_t comedi_write(struct file *file, const char __user *buf,
538     }
539    
540     s = comedi_get_write_subdevice(dev_file_info);
541     - if (s == NULL) {
542     + if (s == NULL || s->async == NULL) {
543     retval = -EIO;
544     goto done;
545     }
546     @@ -1740,7 +1740,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
547     }
548    
549     s = comedi_get_read_subdevice(dev_file_info);
550     - if (s == NULL) {
551     + if (s == NULL || s->async == NULL) {
552     retval = -EIO;
553     goto done;
554     }
555     diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
556     index 721b2be..0517a23 100644
557     --- a/drivers/staging/comedi/drivers/ni_labpc.c
558     +++ b/drivers/staging/comedi/drivers/ni_labpc.c
559     @@ -1264,7 +1264,9 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
560     else
561     channel = CR_CHAN(cmd->chanlist[0]);
562     /* munge channel bits for differential / scan disabled mode */
563     - if (labpc_ai_scan_mode(cmd) != MODE_SINGLE_CHAN && aref == AREF_DIFF)
564     + if ((labpc_ai_scan_mode(cmd) == MODE_SINGLE_CHAN ||
565     + labpc_ai_scan_mode(cmd) == MODE_SINGLE_CHAN_INTERVAL) &&
566     + aref == AREF_DIFF)
567     channel *= 2;
568     devpriv->command1_bits |= ADC_CHAN_BITS(channel);
569     devpriv->command1_bits |= thisboard->ai_range_code[range];
570     @@ -1280,21 +1282,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
571     devpriv->write_byte(devpriv->command1_bits,
572     dev->iobase + COMMAND1_REG);
573     }
574     - /* setup any external triggering/pacing (command4 register) */
575     - devpriv->command4_bits = 0;
576     - if (cmd->convert_src != TRIG_EXT)
577     - devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
578     - /* XXX should discard first scan when using interval scanning
579     - * since manual says it is not synced with scan clock */
580     - if (labpc_use_continuous_mode(cmd) == 0) {
581     - devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
582     - if (cmd->scan_begin_src == TRIG_EXT)
583     - devpriv->command4_bits |= EXT_SCAN_EN_BIT;
584     - }
585     - /* single-ended/differential */
586     - if (aref == AREF_DIFF)
587     - devpriv->command4_bits |= ADC_DIFF_BIT;
588     - devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
589    
590     devpriv->write_byte(cmd->chanlist_len,
591     dev->iobase + INTERVAL_COUNT_REG);
592     @@ -1374,6 +1361,22 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
593     devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT;
594     devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
595    
596     + /* setup any external triggering/pacing (command4 register) */
597     + devpriv->command4_bits = 0;
598     + if (cmd->convert_src != TRIG_EXT)
599     + devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
600     + /* XXX should discard first scan when using interval scanning
601     + * since manual says it is not synced with scan clock */
602     + if (labpc_use_continuous_mode(cmd) == 0) {
603     + devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
604     + if (cmd->scan_begin_src == TRIG_EXT)
605     + devpriv->command4_bits |= EXT_SCAN_EN_BIT;
606     + }
607     + /* single-ended/differential */
608     + if (aref == AREF_DIFF)
609     + devpriv->command4_bits |= ADC_DIFF_BIT;
610     + devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
611     +
612     /* startup acquisition */
613    
614     /* command2 reg */
615     diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c
616     index 4ecf9d6..79d9865 100644
617     --- a/drivers/target/target_core_device.c
618     +++ b/drivers/target/target_core_device.c
619     @@ -1483,24 +1483,18 @@ static struct se_lun *core_dev_get_lun(struct se_portal_group *tpg, u32 unpacked
620    
621     struct se_lun_acl *core_dev_init_initiator_node_lun_acl(
622     struct se_portal_group *tpg,
623     + struct se_node_acl *nacl,
624     u32 mapped_lun,
625     - char *initiatorname,
626     int *ret)
627     {
628     struct se_lun_acl *lacl;
629     - struct se_node_acl *nacl;
630    
631     - if (strlen(initiatorname) >= TRANSPORT_IQN_LEN) {
632     + if (strlen(nacl->initiatorname) >= TRANSPORT_IQN_LEN) {
633     pr_err("%s InitiatorName exceeds maximum size.\n",
634     tpg->se_tpg_tfo->get_fabric_name());
635     *ret = -EOVERFLOW;
636     return NULL;
637     }
638     - nacl = core_tpg_get_initiator_node_acl(tpg, initiatorname);
639     - if (!nacl) {
640     - *ret = -EINVAL;
641     - return NULL;
642     - }
643     lacl = kzalloc(sizeof(struct se_lun_acl), GFP_KERNEL);
644     if (!lacl) {
645     pr_err("Unable to allocate memory for struct se_lun_acl.\n");
646     @@ -1511,7 +1505,8 @@ struct se_lun_acl *core_dev_init_initiator_node_lun_acl(
647     INIT_LIST_HEAD(&lacl->lacl_list);
648     lacl->mapped_lun = mapped_lun;
649     lacl->se_lun_nacl = nacl;
650     - snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s", initiatorname);
651     + snprintf(lacl->initiatorname, TRANSPORT_IQN_LEN, "%s",
652     + nacl->initiatorname);
653    
654     return lacl;
655     }
656     diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
657     index 817ba7c..6b79ee7 100644
658     --- a/drivers/target/target_core_fabric_configfs.c
659     +++ b/drivers/target/target_core_fabric_configfs.c
660     @@ -356,9 +356,17 @@ static struct config_group *target_fabric_make_mappedlun(
661     ret = -EINVAL;
662     goto out;
663     }
664     + if (mapped_lun > (TRANSPORT_MAX_LUNS_PER_TPG-1)) {
665     + pr_err("Mapped LUN: %lu exceeds TRANSPORT_MAX_LUNS_PER_TPG"
666     + "-1: %u for Target Portal Group: %u\n", mapped_lun,
667     + TRANSPORT_MAX_LUNS_PER_TPG-1,
668     + se_tpg->se_tpg_tfo->tpg_get_tag(se_tpg));
669     + ret = -EINVAL;
670     + goto out;
671     + }
672    
673     - lacl = core_dev_init_initiator_node_lun_acl(se_tpg, mapped_lun,
674     - config_item_name(acl_ci), &ret);
675     + lacl = core_dev_init_initiator_node_lun_acl(se_tpg, se_nacl,
676     + mapped_lun, &ret);
677     if (!lacl) {
678     ret = -EINVAL;
679     goto out;
680     diff --git a/drivers/target/target_core_internal.h b/drivers/target/target_core_internal.h
681     index 21c0563..17179b1 100644
682     --- a/drivers/target/target_core_internal.h
683     +++ b/drivers/target/target_core_internal.h
684     @@ -61,7 +61,7 @@ struct se_lun *core_dev_add_lun(struct se_portal_group *, struct se_hba *,
685     int core_dev_del_lun(struct se_portal_group *, u32);
686     struct se_lun *core_get_lun_from_tpg(struct se_portal_group *, u32);
687     struct se_lun_acl *core_dev_init_initiator_node_lun_acl(struct se_portal_group *,
688     - u32, char *, int *);
689     + struct se_node_acl *, u32, int *);
690     int core_dev_add_initiator_node_lun_acl(struct se_portal_group *,
691     struct se_lun_acl *, u32, u32);
692     int core_dev_del_initiator_node_lun_acl(struct se_portal_group *,
693     diff --git a/drivers/target/target_core_tpg.c b/drivers/target/target_core_tpg.c
694     index ba537b6..0e17fa3 100644
695     --- a/drivers/target/target_core_tpg.c
696     +++ b/drivers/target/target_core_tpg.c
697     @@ -114,16 +114,10 @@ struct se_node_acl *core_tpg_get_initiator_node_acl(
698     struct se_node_acl *acl;
699    
700     spin_lock_irq(&tpg->acl_node_lock);
701     - list_for_each_entry(acl, &tpg->acl_node_list, acl_list) {
702     - if (!strcmp(acl->initiatorname, initiatorname) &&
703     - !acl->dynamic_node_acl) {
704     - spin_unlock_irq(&tpg->acl_node_lock);
705     - return acl;
706     - }
707     - }
708     + acl = __core_tpg_get_initiator_node_acl(tpg, initiatorname);
709     spin_unlock_irq(&tpg->acl_node_lock);
710    
711     - return NULL;
712     + return acl;
713     }
714    
715     /* core_tpg_add_node_to_devs():
716     diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
717     index 51e4c1e..1a9e2a9 100644
718     --- a/drivers/vhost/vhost.c
719     +++ b/drivers/vhost/vhost.c
720     @@ -1074,7 +1074,7 @@ static int translate_desc(struct vhost_dev *dev, u64 addr, u32 len,
721     }
722     _iov = iov + ret;
723     size = reg->memory_size - addr + reg->guest_phys_addr;
724     - _iov->iov_len = min((u64)len, size);
725     + _iov->iov_len = min((u64)len - s, size);
726     _iov->iov_base = (void __user *)(unsigned long)
727     (reg->userspace_addr + addr - reg->guest_phys_addr);
728     s += size;
729     diff --git a/fs/direct-io.c b/fs/direct-io.c
730     index f4aadd1..29c4fda 100644
731     --- a/fs/direct-io.c
732     +++ b/fs/direct-io.c
733     @@ -305,9 +305,9 @@ static ssize_t dio_complete(struct dio *dio, loff_t offset, ssize_t ret, bool is
734     dio->end_io(dio->iocb, offset, transferred,
735     dio->private, ret, is_async);
736     } else {
737     + inode_dio_done(dio->inode);
738     if (is_async)
739     aio_complete(dio->iocb, ret, 0);
740     - inode_dio_done(dio->inode);
741     }
742    
743     return ret;
744     diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
745     index df76291..3e1018a 100644
746     --- a/fs/ext4/balloc.c
747     +++ b/fs/ext4/balloc.c
748     @@ -326,7 +326,7 @@ err_out:
749     return 0;
750     }
751     /**
752     - * ext4_read_block_bitmap()
753     + * ext4_read_block_bitmap_nowait()
754     * @sb: super block
755     * @block_group: given block group
756     *
757     @@ -422,6 +422,8 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group)
758     struct buffer_head *bh;
759    
760     bh = ext4_read_block_bitmap_nowait(sb, block_group);
761     + if (!bh)
762     + return NULL;
763     if (ext4_wait_block_bitmap(sb, block_group, bh)) {
764     put_bh(bh);
765     return NULL;
766     @@ -447,11 +449,16 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,
767    
768     free_clusters = percpu_counter_read_positive(fcc);
769     dirty_clusters = percpu_counter_read_positive(dcc);
770     - root_clusters = EXT4_B2C(sbi, ext4_r_blocks_count(sbi->s_es));
771     +
772     + /*
773     + * r_blocks_count should always be multiple of the cluster ratio so
774     + * we are safe to do a plane bit shift only.
775     + */
776     + root_clusters = ext4_r_blocks_count(sbi->s_es) >> sbi->s_cluster_bits;
777    
778     if (free_clusters - (nclusters + root_clusters + dirty_clusters) <
779     EXT4_FREECLUSTERS_WATERMARK) {
780     - free_clusters = EXT4_C2B(sbi, percpu_counter_sum_positive(fcc));
781     + free_clusters = percpu_counter_sum_positive(fcc);
782     dirty_clusters = percpu_counter_sum_positive(dcc);
783     }
784     /* Check whether we have space after accounting for current
785     diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
786     index e77c4fe..3122ece 100644
787     --- a/fs/ext4/mballoc.c
788     +++ b/fs/ext4/mballoc.c
789     @@ -4126,7 +4126,7 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
790     /* The max size of hash table is PREALLOC_TB_SIZE */
791     order = PREALLOC_TB_SIZE - 1;
792     /* Add the prealloc space to lg */
793     - rcu_read_lock();
794     + spin_lock(&lg->lg_prealloc_lock);
795     list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
796     pa_inode_list) {
797     spin_lock(&tmp_pa->pa_lock);
798     @@ -4150,12 +4150,12 @@ static void ext4_mb_add_n_trim(struct ext4_allocation_context *ac)
799     if (!added)
800     list_add_tail_rcu(&pa->pa_inode_list,
801     &lg->lg_prealloc_list[order]);
802     - rcu_read_unlock();
803     + spin_unlock(&lg->lg_prealloc_lock);
804    
805     /* Now trim the list to be not more than 8 elements */
806     if (lg_prealloc_count > 8) {
807     ext4_mb_discard_lg_preallocations(sb, lg,
808     - order, lg_prealloc_count);
809     + order, lg_prealloc_count);
810     return;
811     }
812     return ;
813     diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
814     index e88748e..e712a8c 100644
815     --- a/fs/ext4/xattr.c
816     +++ b/fs/ext4/xattr.c
817     @@ -495,7 +495,7 @@ ext4_xattr_release_block(handle_t *handle, struct inode *inode,
818     error = ext4_handle_dirty_metadata(handle, inode, bh);
819     if (IS_SYNC(inode))
820     ext4_handle_sync(handle);
821     - dquot_free_block(inode, 1);
822     + dquot_free_block(inode, EXT4_C2B(EXT4_SB(inode->i_sb), 1));
823     ea_bdebug(bh, "refcount now=%d; releasing",
824     le32_to_cpu(BHDR(bh)->h_refcount));
825     }
826     @@ -784,7 +784,8 @@ inserted:
827     else {
828     /* The old block is released after updating
829     the inode. */
830     - error = dquot_alloc_block(inode, 1);
831     + error = dquot_alloc_block(inode,
832     + EXT4_C2B(EXT4_SB(sb), 1));
833     if (error)
834     goto cleanup;
835     error = ext4_journal_get_write_access(handle,
836     @@ -880,7 +881,7 @@ cleanup:
837     return error;
838    
839     cleanup_dquot:
840     - dquot_free_block(inode, 1);
841     + dquot_free_block(inode, EXT4_C2B(EXT4_SB(sb), 1));
842     goto cleanup;
843    
844     bad_block:
845     diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
846     index bc43832..d48478a 100644
847     --- a/fs/fuse/dir.c
848     +++ b/fs/fuse/dir.c
849     @@ -645,7 +645,14 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
850    
851     spin_lock(&fc->lock);
852     fi->attr_version = ++fc->attr_version;
853     - drop_nlink(inode);
854     + /*
855     + * If i_nlink == 0 then unlink doesn't make sense, yet this can
856     + * happen if userspace filesystem is careless. It would be
857     + * difficult to enforce correct nlink usage so just ignore this
858     + * condition here
859     + */
860     + if (inode->i_nlink > 0)
861     + drop_nlink(inode);
862     spin_unlock(&fc->lock);
863     fuse_invalidate_attr(inode);
864     fuse_invalidate_attr(dir);
865     diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
866     index 537731e..abd785e 100644
867     --- a/fs/nfsd/nfs4state.c
868     +++ b/fs/nfsd/nfs4state.c
869     @@ -1053,6 +1053,8 @@ free_client(struct nfs4_client *clp)
870     put_group_info(clp->cl_cred.cr_group_info);
871     kfree(clp->cl_principal);
872     kfree(clp->cl_name.data);
873     + idr_remove_all(&clp->cl_stateids);
874     + idr_destroy(&clp->cl_stateids);
875     kfree(clp);
876     }
877    
878     diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
879     index 6577432..340bd02 100644
880     --- a/fs/ocfs2/aops.c
881     +++ b/fs/ocfs2/aops.c
882     @@ -593,9 +593,9 @@ static void ocfs2_dio_end_io(struct kiocb *iocb,
883     level = ocfs2_iocb_rw_locked_level(iocb);
884     ocfs2_rw_unlock(inode, level);
885    
886     + inode_dio_done(inode);
887     if (is_async)
888     aio_complete(iocb, ret, 0);
889     - inode_dio_done(inode);
890     }
891    
892     /*
893     diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
894     index f169da4..b7e74b5 100644
895     --- a/fs/ocfs2/suballoc.c
896     +++ b/fs/ocfs2/suballoc.c
897     @@ -642,7 +642,7 @@ ocfs2_block_group_alloc_discontig(handle_t *handle,
898     * cluster groups will be staying in cache for the duration of
899     * this operation.
900     */
901     - ac->ac_allow_chain_relink = 0;
902     + ac->ac_disable_chain_relink = 1;
903    
904     /* Claim the first region */
905     status = ocfs2_block_group_claim_bits(osb, handle, ac, min_bits,
906     @@ -1823,7 +1823,7 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
907     * Do this *after* figuring out how many bits we're taking out
908     * of our target group.
909     */
910     - if (ac->ac_allow_chain_relink &&
911     + if (!ac->ac_disable_chain_relink &&
912     (prev_group_bh) &&
913     (ocfs2_block_group_reasonably_empty(bg, res->sr_bits))) {
914     status = ocfs2_relink_block_group(handle, alloc_inode,
915     @@ -1928,7 +1928,6 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
916    
917     victim = ocfs2_find_victim_chain(cl);
918     ac->ac_chain = victim;
919     - ac->ac_allow_chain_relink = 1;
920    
921     status = ocfs2_search_chain(ac, handle, bits_wanted, min_bits,
922     res, &bits_left);
923     @@ -1947,7 +1946,7 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac,
924     * searching each chain in order. Don't allow chain relinking
925     * because we only calculate enough journal credits for one
926     * relink per alloc. */
927     - ac->ac_allow_chain_relink = 0;
928     + ac->ac_disable_chain_relink = 1;
929     for (i = 0; i < le16_to_cpu(cl->cl_next_free_rec); i ++) {
930     if (i == victim)
931     continue;
932     diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h
933     index b8afabf..a36d0aa 100644
934     --- a/fs/ocfs2/suballoc.h
935     +++ b/fs/ocfs2/suballoc.h
936     @@ -49,7 +49,7 @@ struct ocfs2_alloc_context {
937    
938     /* these are used by the chain search */
939     u16 ac_chain;
940     - int ac_allow_chain_relink;
941     + int ac_disable_chain_relink;
942     group_search_t *ac_group_search;
943    
944     u64 ac_last_group;
945     diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
946     index 0ba9ea1..2e3ea30 100644
947     --- a/fs/ocfs2/xattr.c
948     +++ b/fs/ocfs2/xattr.c
949     @@ -7189,7 +7189,7 @@ int ocfs2_init_security_and_acl(struct inode *dir,
950     struct buffer_head *dir_bh = NULL;
951    
952     ret = ocfs2_init_security_get(inode, dir, qstr, NULL);
953     - if (!ret) {
954     + if (ret) {
955     mlog_errno(ret);
956     goto leave;
957     }
958     diff --git a/fs/pstore/platform.c b/fs/pstore/platform.c
959     index 82c585f..4a66a5c 100644
960     --- a/fs/pstore/platform.c
961     +++ b/fs/pstore/platform.c
962     @@ -88,6 +88,27 @@ static const char *get_reason_str(enum kmsg_dump_reason reason)
963     }
964     }
965    
966     +bool pstore_cannot_block_path(enum kmsg_dump_reason reason)
967     +{
968     + /*
969     + * In case of NMI path, pstore shouldn't be blocked
970     + * regardless of reason.
971     + */
972     + if (in_nmi())
973     + return true;
974     +
975     + switch (reason) {
976     + /* In panic case, other cpus are stopped by smp_send_stop(). */
977     + case KMSG_DUMP_PANIC:
978     + /* Emergency restart shouldn't be blocked by spin lock. */
979     + case KMSG_DUMP_EMERG:
980     + return true;
981     + default:
982     + return false;
983     + }
984     +}
985     +EXPORT_SYMBOL_GPL(pstore_cannot_block_path);
986     +
987     /*
988     * callback from kmsg_dump. (s2,l2) has the most recently
989     * written bytes, older bytes are in (s1,l1). Save as much
990     @@ -111,10 +132,12 @@ static void pstore_dump(struct kmsg_dumper *dumper,
991    
992     why = get_reason_str(reason);
993    
994     - if (in_nmi()) {
995     - is_locked = spin_trylock(&psinfo->buf_lock);
996     - if (!is_locked)
997     - pr_err("pstore dump routine blocked in NMI, may corrupt error record\n");
998     + if (pstore_cannot_block_path(reason)) {
999     + is_locked = spin_trylock_irqsave(&psinfo->buf_lock, flags);
1000     + if (!is_locked) {
1001     + pr_err("pstore dump routine blocked in %s path, may corrupt error record\n"
1002     + , in_nmi() ? "NMI" : why);
1003     + }
1004     } else
1005     spin_lock_irqsave(&psinfo->buf_lock, flags);
1006     oopscount++;
1007     @@ -145,9 +168,9 @@ static void pstore_dump(struct kmsg_dumper *dumper,
1008     total += l1_cpy + l2_cpy;
1009     part++;
1010     }
1011     - if (in_nmi()) {
1012     + if (pstore_cannot_block_path(reason)) {
1013     if (is_locked)
1014     - spin_unlock(&psinfo->buf_lock);
1015     + spin_unlock_irqrestore(&psinfo->buf_lock, flags);
1016     } else
1017     spin_unlock_irqrestore(&psinfo->buf_lock, flags);
1018     }
1019     diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h
1020     index da64e15..6cdabb4 100644
1021     --- a/include/linux/auto_fs.h
1022     +++ b/include/linux/auto_fs.h
1023     @@ -31,25 +31,16 @@
1024     #define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
1025    
1026     /*
1027     - * Architectures where both 32- and 64-bit binaries can be executed
1028     - * on 64-bit kernels need this. This keeps the structure format
1029     - * uniform, and makes sure the wait_queue_token isn't too big to be
1030     - * passed back down to the kernel.
1031     - *
1032     - * This assumes that on these architectures:
1033     - * mode 32 bit 64 bit
1034     - * -------------------------
1035     - * int 32 bit 32 bit
1036     - * long 32 bit 64 bit
1037     - *
1038     - * If so, 32-bit user-space code should be backwards compatible.
1039     + * The wait_queue_token (autofs_wqt_t) is part of a structure which is passed
1040     + * back to the kernel via ioctl from userspace. On architectures where 32- and
1041     + * 64-bit userspace binaries can be executed it's important that the size of
1042     + * autofs_wqt_t stays constant between 32- and 64-bit Linux kernels so that we
1043     + * do not break the binary ABI interface by changing the structure size.
1044     */
1045     -
1046     -#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
1047     - || defined(__powerpc__) || defined(__s390__)
1048     -typedef unsigned int autofs_wqt_t;
1049     -#else
1050     +#if defined(__ia64__) || defined(__alpha__) /* pure 64bit architectures */
1051     typedef unsigned long autofs_wqt_t;
1052     +#else
1053     +typedef unsigned int autofs_wqt_t;
1054     #endif
1055    
1056     /* Packet types */
1057     diff --git a/include/linux/pstore.h b/include/linux/pstore.h
1058     index e1461e1..318cca1 100644
1059     --- a/include/linux/pstore.h
1060     +++ b/include/linux/pstore.h
1061     @@ -54,12 +54,18 @@ struct pstore_info {
1062    
1063     #ifdef CONFIG_PSTORE
1064     extern int pstore_register(struct pstore_info *);
1065     +extern bool pstore_cannot_block_path(enum kmsg_dump_reason reason);
1066     #else
1067     static inline int
1068     pstore_register(struct pstore_info *psi)
1069     {
1070     return -ENODEV;
1071     }
1072     +static inline bool
1073     +pstore_cannot_block_path(enum kmsg_dump_reason reason)
1074     +{
1075     + return false;
1076     +}
1077     #endif
1078    
1079     #endif /*_LINUX_PSTORE_H*/
1080     diff --git a/include/linux/quota.h b/include/linux/quota.h
1081     index c09fa04..ffd8607 100644
1082     --- a/include/linux/quota.h
1083     +++ b/include/linux/quota.h
1084     @@ -417,6 +417,7 @@ struct quota_module_name {
1085     #define INIT_QUOTA_MODULE_NAMES {\
1086     {QFMT_VFS_OLD, "quota_v1"},\
1087     {QFMT_VFS_V0, "quota_v2"},\
1088     + {QFMT_VFS_V1, "quota_v2"},\
1089     {0, NULL}}
1090    
1091     #endif /* __KERNEL__ */
1092     diff --git a/kernel/cgroup.c b/kernel/cgroup.c
1093     index a5dccd4..a4c47d1b 100644
1094     --- a/kernel/cgroup.c
1095     +++ b/kernel/cgroup.c
1096     @@ -378,12 +378,20 @@ static void __put_css_set(struct css_set *cg, int taskexit)
1097     struct cgroup *cgrp = link->cgrp;
1098     list_del(&link->cg_link_list);
1099     list_del(&link->cgrp_link_list);
1100     +
1101     + /*
1102     + * We may not be holding cgroup_mutex, and if cgrp->count is
1103     + * dropped to 0 the cgroup can be destroyed at any time, hence
1104     + * rcu_read_lock is used to keep it alive.
1105     + */
1106     + rcu_read_lock();
1107     if (atomic_dec_and_test(&cgrp->count) &&
1108     notify_on_release(cgrp)) {
1109     if (taskexit)
1110     set_bit(CGRP_RELEASABLE, &cgrp->flags);
1111     check_for_release(cgrp);
1112     }
1113     + rcu_read_unlock();
1114    
1115     kfree(link);
1116     }
1117     diff --git a/kernel/cpuset.c b/kernel/cpuset.c
1118     index 5fc1570..8fe6f6b6 100644
1119     --- a/kernel/cpuset.c
1120     +++ b/kernel/cpuset.c
1121     @@ -2479,8 +2479,16 @@ void cpuset_print_task_mems_allowed(struct task_struct *tsk)
1122    
1123     dentry = task_cs(tsk)->css.cgroup->dentry;
1124     spin_lock(&cpuset_buffer_lock);
1125     - snprintf(cpuset_name, CPUSET_NAME_LEN,
1126     - dentry ? (const char *)dentry->d_name.name : "/");
1127     +
1128     + if (!dentry) {
1129     + strcpy(cpuset_name, "/");
1130     + } else {
1131     + spin_lock(&dentry->d_lock);
1132     + strlcpy(cpuset_name, (const char *)dentry->d_name.name,
1133     + CPUSET_NAME_LEN);
1134     + spin_unlock(&dentry->d_lock);
1135     + }
1136     +
1137     nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN,
1138     tsk->mems_allowed);
1139     printk(KERN_INFO "%s cpuset=%s mems_allowed=%s\n",
1140     diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
1141     index 69185ae..e885be1 100644
1142     --- a/kernel/posix-timers.c
1143     +++ b/kernel/posix-timers.c
1144     @@ -639,6 +639,13 @@ static struct k_itimer *__lock_timer(timer_t timer_id, unsigned long *flags)
1145     {
1146     struct k_itimer *timr;
1147    
1148     + /*
1149     + * timer_t could be any type >= int and we want to make sure any
1150     + * @timer_id outside positive int range fails lookup.
1151     + */
1152     + if ((unsigned long long)timer_id > INT_MAX)
1153     + return NULL;
1154     +
1155     rcu_read_lock();
1156     timr = idr_find(&posix_timers_id, (int)timer_id);
1157     if (timr) {
1158     diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
1159     index a650694..9f9aa32 100644
1160     --- a/kernel/sysctl_binary.c
1161     +++ b/kernel/sysctl_binary.c
1162     @@ -1194,9 +1194,10 @@ static ssize_t bin_dn_node_address(struct file *file,
1163    
1164     /* Convert the decnet address to binary */
1165     result = -EIO;
1166     - nodep = strchr(buf, '.') + 1;
1167     + nodep = strchr(buf, '.');
1168     if (!nodep)
1169     goto out;
1170     + ++nodep;
1171    
1172     area = simple_strtoul(buf, NULL, 10);
1173     node = simple_strtoul(nodep, NULL, 10);
1174     diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1175     index 6b194d8..4a86e64 100644
1176     --- a/kernel/trace/ftrace.c
1177     +++ b/kernel/trace/ftrace.c
1178     @@ -3841,37 +3841,51 @@ static void ftrace_init_module(struct module *mod,
1179     ftrace_process_locs(mod, start, end);
1180     }
1181    
1182     -static int ftrace_module_notify(struct notifier_block *self,
1183     - unsigned long val, void *data)
1184     +static int ftrace_module_notify_enter(struct notifier_block *self,
1185     + unsigned long val, void *data)
1186     {
1187     struct module *mod = data;
1188    
1189     - switch (val) {
1190     - case MODULE_STATE_COMING:
1191     + if (val == MODULE_STATE_COMING)
1192     ftrace_init_module(mod, mod->ftrace_callsites,
1193     mod->ftrace_callsites +
1194     mod->num_ftrace_callsites);
1195     - break;
1196     - case MODULE_STATE_GOING:
1197     + return 0;
1198     +}
1199     +
1200     +static int ftrace_module_notify_exit(struct notifier_block *self,
1201     + unsigned long val, void *data)
1202     +{
1203     + struct module *mod = data;
1204     +
1205     + if (val == MODULE_STATE_GOING)
1206     ftrace_release_mod(mod);
1207     - break;
1208     - }
1209    
1210     return 0;
1211     }
1212     #else
1213     -static int ftrace_module_notify(struct notifier_block *self,
1214     - unsigned long val, void *data)
1215     +static int ftrace_module_notify_enter(struct notifier_block *self,
1216     + unsigned long val, void *data)
1217     +{
1218     + return 0;
1219     +}
1220     +static int ftrace_module_notify_exit(struct notifier_block *self,
1221     + unsigned long val, void *data)
1222     {
1223     return 0;
1224     }
1225     #endif /* CONFIG_MODULES */
1226    
1227     -struct notifier_block ftrace_module_nb = {
1228     - .notifier_call = ftrace_module_notify,
1229     +struct notifier_block ftrace_module_enter_nb = {
1230     + .notifier_call = ftrace_module_notify_enter,
1231     .priority = INT_MAX, /* Run before anything that can use kprobes */
1232     };
1233    
1234     +struct notifier_block ftrace_module_exit_nb = {
1235     + .notifier_call = ftrace_module_notify_exit,
1236     + .priority = INT_MIN, /* Run after anything that can remove kprobes */
1237     +};
1238     +
1239     extern unsigned long __start_mcount_loc[];
1240     extern unsigned long __stop_mcount_loc[];
1241    
1242     @@ -3903,9 +3917,13 @@ void __init ftrace_init(void)
1243     __start_mcount_loc,
1244     __stop_mcount_loc);
1245    
1246     - ret = register_module_notifier(&ftrace_module_nb);
1247     + ret = register_module_notifier(&ftrace_module_enter_nb);
1248     + if (ret)
1249     + pr_warning("Failed to register trace ftrace module enter notifier\n");
1250     +
1251     + ret = register_module_notifier(&ftrace_module_exit_nb);
1252     if (ret)
1253     - pr_warning("Failed to register trace ftrace module notifier\n");
1254     + pr_warning("Failed to register trace ftrace module exit notifier\n");
1255    
1256     set_ftrace_early_filters();
1257    
1258     diff --git a/lib/idr.c b/lib/idr.c
1259     index 4046e29..e90d2d0 100644
1260     --- a/lib/idr.c
1261     +++ b/lib/idr.c
1262     @@ -625,7 +625,14 @@ void *idr_get_next(struct idr *idp, int *nextidp)
1263     return p;
1264     }
1265    
1266     - id += 1 << n;
1267     + /*
1268     + * Proceed to the next layer at the current level. Unlike
1269     + * idr_for_each(), @id isn't guaranteed to be aligned to
1270     + * layer boundary at this point and adding 1 << n may
1271     + * incorrectly skip IDs. Make sure we jump to the
1272     + * beginning of the next layer using round_up().
1273     + */
1274     + id = round_up(id + 1, 1 << n);
1275     while (n < fls(id)) {
1276     n += IDR_BITS;
1277     p = *--paa;
1278     diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
1279     index fd9b288..aec7dbb 100644
1280     --- a/net/sunrpc/svc_xprt.c
1281     +++ b/net/sunrpc/svc_xprt.c
1282     @@ -817,7 +817,6 @@ static void svc_age_temp_xprts(unsigned long closure)
1283     struct svc_serv *serv = (struct svc_serv *)closure;
1284     struct svc_xprt *xprt;
1285     struct list_head *le, *next;
1286     - LIST_HEAD(to_be_aged);
1287    
1288     dprintk("svc_age_temp_xprts\n");
1289    
1290     @@ -838,25 +837,15 @@ static void svc_age_temp_xprts(unsigned long closure)
1291     if (atomic_read(&xprt->xpt_ref.refcount) > 1 ||
1292     test_bit(XPT_BUSY, &xprt->xpt_flags))
1293     continue;
1294     - svc_xprt_get(xprt);
1295     - list_move(le, &to_be_aged);
1296     + list_del_init(le);
1297     set_bit(XPT_CLOSE, &xprt->xpt_flags);
1298     set_bit(XPT_DETACHED, &xprt->xpt_flags);
1299     - }
1300     - spin_unlock_bh(&serv->sv_lock);
1301     -
1302     - while (!list_empty(&to_be_aged)) {
1303     - le = to_be_aged.next;
1304     - /* fiddling the xpt_list node is safe 'cos we're XPT_DETACHED */
1305     - list_del_init(le);
1306     - xprt = list_entry(le, struct svc_xprt, xpt_list);
1307     -
1308     dprintk("queuing xprt %p for closing\n", xprt);
1309    
1310     /* a thread will dequeue and close it soon */
1311     svc_xprt_enqueue(xprt);
1312     - svc_xprt_put(xprt);
1313     }
1314     + spin_unlock_bh(&serv->sv_lock);
1315    
1316     mod_timer(&serv->sv_temptimer, jiffies + svc_conn_age_period * HZ);
1317     }
1318     diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
1319     index 02a6e3f..fa2ce0c 100644
1320     --- a/sound/pci/hda/patch_hdmi.c
1321     +++ b/sound/pci/hda/patch_hdmi.c
1322     @@ -1244,6 +1244,9 @@ static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
1323    
1324     if (pcmdev > 0)
1325     sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
1326     + if (!is_jack_detectable(codec, per_pin->pin_nid))
1327     + strncat(hdmi_str, " Phantom",
1328     + sizeof(hdmi_str) - strlen(hdmi_str) - 1);
1329    
1330     return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0);
1331     }
1332     diff --git a/tools/perf/Makefile b/tools/perf/Makefile
1333     index c3dd3d4..2db7ba0 100644
1334     --- a/tools/perf/Makefile
1335     +++ b/tools/perf/Makefile
1336     @@ -241,13 +241,13 @@ $(OUTPUT)util/parse-events-flex.c: util/parse-events.l
1337     $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
1338    
1339     $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
1340     - $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
1341     + $(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
1342    
1343     $(OUTPUT)util/pmu-flex.c: util/pmu.l
1344     $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
1345    
1346     $(OUTPUT)util/pmu-bison.c: util/pmu.y
1347     - $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
1348     + $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
1349    
1350     $(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
1351     $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
1352     diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
1353     index d9637da..3f35ea3 100644
1354     --- a/tools/perf/util/parse-events.y
1355     +++ b/tools/perf/util/parse-events.y
1356     @@ -1,5 +1,4 @@
1357    
1358     -%name-prefix "parse_events_"
1359     %parse-param {struct list_head *list_all}
1360     %parse-param {struct list_head *list_event}
1361     %parse-param {int *idx}
1362     diff --git a/tools/perf/util/pmu.y b/tools/perf/util/pmu.y
1363     index 20ea77e..522943f 100644
1364     --- a/tools/perf/util/pmu.y
1365     +++ b/tools/perf/util/pmu.y
1366     @@ -1,5 +1,4 @@
1367    
1368     -%name-prefix "perf_pmu_"
1369     %parse-param {struct list_head *format}
1370     %parse-param {char *name}
1371