Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r2606 - genpatches-2.6/trunk/3.4
Date: Sat, 07 Dec 2013 01:35:13
Message-Id: 20131207013505.DE5092004B@flycatcher.gentoo.org
1 Author: mpagano
2 Date: 2013-12-07 01:35:05 +0000 (Sat, 07 Dec 2013)
3 New Revision: 2606
4
5 Added:
6 genpatches-2.6/trunk/3.4/1071_linux-3.4.72.patch
7 Modified:
8 genpatches-2.6/trunk/3.4/0000_README
9 Log:
10 Linux patch 3.4.72
11
12 Modified: genpatches-2.6/trunk/3.4/0000_README
13 ===================================================================
14 --- genpatches-2.6/trunk/3.4/0000_README 2013-12-07 00:57:33 UTC (rev 2605)
15 +++ genpatches-2.6/trunk/3.4/0000_README 2013-12-07 01:35:05 UTC (rev 2606)
16 @@ -323,6 +323,10 @@
17 From: http://www.kernel.org
18 Desc: Linux 3.4.71
19
20 +Patch: 1071_linux-3.4.72.patch
21 +From: http://www.kernel.org
22 +Desc: Linux 3.4.72
23 +
24 Patch: 1500_XATTR_USER_PREFIX.patch
25 From: https://bugs.gentoo.org/show_bug.cgi?id=470644
26 Desc: Support for namespace user.pax.* on tmpfs.
27
28 Added: genpatches-2.6/trunk/3.4/1071_linux-3.4.72.patch
29 ===================================================================
30 --- genpatches-2.6/trunk/3.4/1071_linux-3.4.72.patch (rev 0)
31 +++ genpatches-2.6/trunk/3.4/1071_linux-3.4.72.patch 2013-12-07 01:35:05 UTC (rev 2606)
32 @@ -0,0 +1,1614 @@
33 +diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt
34 +index 6d78841f..99d8ab9d 100644
35 +--- a/Documentation/sysctl/kernel.txt
36 ++++ b/Documentation/sysctl/kernel.txt
37 +@@ -284,13 +284,24 @@ Default value is "/sbin/hotplug".
38 + kptr_restrict:
39 +
40 + This toggle indicates whether restrictions are placed on
41 +-exposing kernel addresses via /proc and other interfaces. When
42 +-kptr_restrict is set to (0), there are no restrictions. When
43 +-kptr_restrict is set to (1), the default, kernel pointers
44 +-printed using the %pK format specifier will be replaced with 0's
45 +-unless the user has CAP_SYSLOG. When kptr_restrict is set to
46 +-(2), kernel pointers printed using %pK will be replaced with 0's
47 +-regardless of privileges.
48 ++exposing kernel addresses via /proc and other interfaces.
49 ++
50 ++When kptr_restrict is set to (0), the default, there are no restrictions.
51 ++
52 ++When kptr_restrict is set to (1), kernel pointers printed using the %pK
53 ++format specifier will be replaced with 0's unless the user has CAP_SYSLOG
54 ++and effective user and group ids are equal to the real ids. This is
55 ++because %pK checks are done at read() time rather than open() time, so
56 ++if permissions are elevated between the open() and the read() (e.g via
57 ++a setuid binary) then %pK will not leak kernel pointers to unprivileged
58 ++users. Note, this is a temporary solution only. The correct long-term
59 ++solution is to do the permission checks at open() time. Consider removing
60 ++world read permissions from files that use %pK, and using dmesg_restrict
61 ++to protect against uses of %pK in dmesg(8) if leaking kernel pointer
62 ++values to unprivileged users is a concern.
63 ++
64 ++When kptr_restrict is set to (2), kernel pointers printed using
65 ++%pK will be replaced with 0's regardless of privileges.
66 +
67 + ==============================================================
68 +
69 +diff --git a/Makefile b/Makefile
70 +index 05ace570..242e6dfb 100644
71 +--- a/Makefile
72 ++++ b/Makefile
73 +@@ -1,6 +1,6 @@
74 + VERSION = 3
75 + PATCHLEVEL = 4
76 +-SUBLEVEL = 71
77 ++SUBLEVEL = 72
78 + EXTRAVERSION =
79 + NAME = Saber-toothed Squirrel
80 +
81 +diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
82 +index 48a115a9..ecc33bc4 100644
83 +--- a/arch/arm/mach-integrator/integrator_cp.c
84 ++++ b/arch/arm/mach-integrator/integrator_cp.c
85 +@@ -366,7 +366,8 @@ static AMBA_APB_DEVICE(aaci, "mb:1d", 0, INTEGRATOR_CP_AACI_BASE,
86 + static void cp_clcd_enable(struct clcd_fb *fb)
87 + {
88 + struct fb_var_screeninfo *var = &fb->fb.var;
89 +- u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2;
90 ++ u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2
91 ++ | CM_CTRL_LCDEN0 | CM_CTRL_LCDEN1;
92 +
93 + if (var->bits_per_pixel <= 8 ||
94 + (var->bits_per_pixel == 16 && var->green.length == 5))
95 +diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
96 +index 375d3f77..82636701 100644
97 +--- a/arch/arm/mach-sa1100/assabet.c
98 ++++ b/arch/arm/mach-sa1100/assabet.c
99 +@@ -509,6 +509,9 @@ static void __init assabet_map_io(void)
100 + * Its called GPCLKR0 in my SA1110 manual.
101 + */
102 + Ser1SDCR0 |= SDCR0_SUS;
103 ++ MSC1 = (MSC1 & ~0xffff) |
104 ++ MSC_NonBrst | MSC_32BitStMem |
105 ++ MSC_RdAcc(2) | MSC_WrAcc(2) | MSC_Rec(0);
106 +
107 + if (!machine_has_neponset())
108 + sa1100_register_uart_fns(&assabet_port_fns);
109 +diff --git a/arch/avr32/boot/u-boot/head.S b/arch/avr32/boot/u-boot/head.S
110 +index 4488fa27..2ffc298f 100644
111 +--- a/arch/avr32/boot/u-boot/head.S
112 ++++ b/arch/avr32/boot/u-boot/head.S
113 +@@ -8,6 +8,8 @@
114 + * published by the Free Software Foundation.
115 + */
116 + #include <asm/setup.h>
117 ++#include <asm/thread_info.h>
118 ++#include <asm/sysreg.h>
119 +
120 + /*
121 + * The kernel is loaded where we want it to be and all caches
122 +@@ -20,11 +22,6 @@
123 + .section .init.text,"ax"
124 + .global _start
125 + _start:
126 +- /* Check if the boot loader actually provided a tag table */
127 +- lddpc r0, magic_number
128 +- cp.w r12, r0
129 +- brne no_tag_table
130 +-
131 + /* Initialize .bss */
132 + lddpc r2, bss_start_addr
133 + lddpc r3, end_addr
134 +@@ -34,6 +31,25 @@ _start:
135 + cp r2, r3
136 + brlo 1b
137 +
138 ++ /* Initialize status register */
139 ++ lddpc r0, init_sr
140 ++ mtsr SYSREG_SR, r0
141 ++
142 ++ /* Set initial stack pointer */
143 ++ lddpc sp, stack_addr
144 ++ sub sp, -THREAD_SIZE
145 ++
146 ++#ifdef CONFIG_FRAME_POINTER
147 ++ /* Mark last stack frame */
148 ++ mov lr, 0
149 ++ mov r7, 0
150 ++#endif
151 ++
152 ++ /* Check if the boot loader actually provided a tag table */
153 ++ lddpc r0, magic_number
154 ++ cp.w r12, r0
155 ++ brne no_tag_table
156 ++
157 + /*
158 + * Save the tag table address for later use. This must be done
159 + * _after_ .bss has been initialized...
160 +@@ -53,8 +69,15 @@ bss_start_addr:
161 + .long __bss_start
162 + end_addr:
163 + .long _end
164 ++init_sr:
165 ++ .long 0x007f0000 /* Supervisor mode, everything masked */
166 ++stack_addr:
167 ++ .long init_thread_union
168 ++panic_addr:
169 ++ .long panic
170 +
171 + no_tag_table:
172 + sub r12, pc, (. - 2f)
173 +- bral panic
174 ++ /* branch to panic() which can be far away with that construct */
175 ++ lddpc pc, panic_addr
176 + 2: .asciz "Boot loader didn't provide correct magic number\n"
177 +diff --git a/arch/avr32/kernel/entry-avr32b.S b/arch/avr32/kernel/entry-avr32b.S
178 +index 169268c4..a91e8980 100644
179 +--- a/arch/avr32/kernel/entry-avr32b.S
180 ++++ b/arch/avr32/kernel/entry-avr32b.S
181 +@@ -399,9 +399,10 @@ handle_critical:
182 + /* We should never get here... */
183 + bad_return:
184 + sub r12, pc, (. - 1f)
185 +- bral panic
186 ++ lddpc pc, 2f
187 + .align 2
188 + 1: .asciz "Return from critical exception!"
189 ++2: .long panic
190 +
191 + .align 1
192 + do_bus_error_write:
193 +diff --git a/arch/avr32/kernel/head.S b/arch/avr32/kernel/head.S
194 +index 6163bd0a..59eae6df 100644
195 +--- a/arch/avr32/kernel/head.S
196 ++++ b/arch/avr32/kernel/head.S
197 +@@ -10,33 +10,13 @@
198 + #include <linux/linkage.h>
199 +
200 + #include <asm/page.h>
201 +-#include <asm/thread_info.h>
202 +-#include <asm/sysreg.h>
203 +
204 + .section .init.text,"ax"
205 + .global kernel_entry
206 + kernel_entry:
207 +- /* Initialize status register */
208 +- lddpc r0, init_sr
209 +- mtsr SYSREG_SR, r0
210 +-
211 +- /* Set initial stack pointer */
212 +- lddpc sp, stack_addr
213 +- sub sp, -THREAD_SIZE
214 +-
215 +-#ifdef CONFIG_FRAME_POINTER
216 +- /* Mark last stack frame */
217 +- mov lr, 0
218 +- mov r7, 0
219 +-#endif
220 +-
221 + /* Start the show */
222 + lddpc pc, kernel_start_addr
223 +
224 + .align 2
225 +-init_sr:
226 +- .long 0x007f0000 /* Supervisor mode, everything masked */
227 +-stack_addr:
228 +- .long init_thread_union
229 + kernel_start_addr:
230 + .long start_kernel
231 +diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
232 +index e6de7879..32e2c811 100644
233 +--- a/arch/powerpc/kernel/signal_32.c
234 ++++ b/arch/powerpc/kernel/signal_32.c
235 +@@ -447,6 +447,12 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
236 + #endif /* CONFIG_ALTIVEC */
237 + if (copy_fpr_to_user(&frame->mc_fregs, current))
238 + return 1;
239 ++
240 ++ /*
241 ++ * Clear the MSR VSX bit to indicate there is no valid state attached
242 ++ * to this context, except in the specific case below where we set it.
243 ++ */
244 ++ msr &= ~MSR_VSX;
245 + #ifdef CONFIG_VSX
246 + /*
247 + * Copy VSR 0-31 upper half from thread_struct to local
248 +@@ -459,15 +465,7 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
249 + if (copy_vsx_to_user(&frame->mc_vsregs, current))
250 + return 1;
251 + msr |= MSR_VSX;
252 +- } else if (!ctx_has_vsx_region)
253 +- /*
254 +- * With a small context structure we can't hold the VSX
255 +- * registers, hence clear the MSR value to indicate the state
256 +- * was not saved.
257 +- */
258 +- msr &= ~MSR_VSX;
259 +-
260 +-
261 ++ }
262 + #endif /* CONFIG_VSX */
263 + #ifdef CONFIG_SPE
264 + /* save spe registers */
265 +diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
266 +index 2692efdb..3ad1b508 100644
267 +--- a/arch/powerpc/kernel/signal_64.c
268 ++++ b/arch/powerpc/kernel/signal_64.c
269 +@@ -117,6 +117,12 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
270 + flush_fp_to_thread(current);
271 + /* copy fpr regs and fpscr */
272 + err |= copy_fpr_to_user(&sc->fp_regs, current);
273 ++
274 ++ /*
275 ++ * Clear the MSR VSX bit to indicate there is no valid state attached
276 ++ * to this context, except in the specific case below where we set it.
277 ++ */
278 ++ msr &= ~MSR_VSX;
279 + #ifdef CONFIG_VSX
280 + /*
281 + * Copy VSX low doubleword to local buffer for formatting,
282 +diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
283 +index aeb82200..60662545 100644
284 +--- a/drivers/ata/ahci.c
285 ++++ b/drivers/ata/ahci.c
286 +@@ -402,6 +402,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
287 + .driver_data = board_ahci_yes_fbs }, /* 88se9172 on some Gigabyte */
288 + { PCI_DEVICE(0x1b4b, 0x91a3),
289 + .driver_data = board_ahci_yes_fbs },
290 ++ { PCI_DEVICE(0x1b4b, 0x9230),
291 ++ .driver_data = board_ahci_yes_fbs },
292 +
293 + /* Promise */
294 + { PCI_VDEVICE(PROMISE, 0x3f20), board_ahci }, /* PDC42819 */
295 +diff --git a/drivers/ata/libahci.c b/drivers/ata/libahci.c
296 +index 47a1fb85..60f41cd2 100644
297 +--- a/drivers/ata/libahci.c
298 ++++ b/drivers/ata/libahci.c
299 +@@ -1249,9 +1249,11 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
300 + {
301 + struct ata_port *ap = link->ap;
302 + struct ahci_host_priv *hpriv = ap->host->private_data;
303 ++ struct ahci_port_priv *pp = ap->private_data;
304 + const char *reason = NULL;
305 + unsigned long now, msecs;
306 + struct ata_taskfile tf;
307 ++ bool fbs_disabled = false;
308 + int rc;
309 +
310 + DPRINTK("ENTER\n");
311 +@@ -1261,6 +1263,16 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
312 + if (rc && rc != -EOPNOTSUPP)
313 + ata_link_warn(link, "failed to reset engine (errno=%d)\n", rc);
314 +
315 ++ /*
316 ++ * According to AHCI-1.2 9.3.9: if FBS is enable, software shall
317 ++ * clear PxFBS.EN to '0' prior to issuing software reset to devices
318 ++ * that is attached to port multiplier.
319 ++ */
320 ++ if (!ata_is_host_link(link) && pp->fbs_enabled) {
321 ++ ahci_disable_fbs(ap);
322 ++ fbs_disabled = true;
323 ++ }
324 ++
325 + ata_tf_init(link->device, &tf);
326 +
327 + /* issue the first D2H Register FIS */
328 +@@ -1301,6 +1313,10 @@ int ahci_do_softreset(struct ata_link *link, unsigned int *class,
329 + } else
330 + *class = ahci_dev_classify(ap);
331 +
332 ++ /* re-enable FBS if disabled before */
333 ++ if (fbs_disabled)
334 ++ ahci_enable_fbs(ap);
335 ++
336 + DPRINTK("EXIT, class=%u\n", *class);
337 + return 0;
338 +
339 +diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
340 +index 9cf09ae8..cd20cf1e 100644
341 +--- a/drivers/ata/libata-core.c
342 ++++ b/drivers/ata/libata-core.c
343 +@@ -4074,6 +4074,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
344 + { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
345 + { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA },
346 + { "Slimtype DVD A DS8A8SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
347 ++ { "Slimtype DVD A DS8A9SH", NULL, ATA_HORKAGE_MAX_SEC_LBA48 },
348 +
349 + /* Devices we expect to fail diagnostics */
350 +
351 +diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
352 +index c3419048..92156774 100644
353 +--- a/drivers/ata/libata-transport.c
354 ++++ b/drivers/ata/libata-transport.c
355 +@@ -319,25 +319,25 @@ int ata_tport_add(struct device *parent,
356 + /*
357 + * ATA link attributes
358 + */
359 ++static int noop(int x) { return x; }
360 +
361 +-
362 +-#define ata_link_show_linkspeed(field) \
363 ++#define ata_link_show_linkspeed(field, format) \
364 + static ssize_t \
365 + show_ata_link_##field(struct device *dev, \
366 + struct device_attribute *attr, char *buf) \
367 + { \
368 + struct ata_link *link = transport_class_to_link(dev); \
369 + \
370 +- return sprintf(buf,"%s\n", sata_spd_string(fls(link->field))); \
371 ++ return sprintf(buf, "%s\n", sata_spd_string(format(link->field))); \
372 + }
373 +
374 +-#define ata_link_linkspeed_attr(field) \
375 +- ata_link_show_linkspeed(field) \
376 ++#define ata_link_linkspeed_attr(field, format) \
377 ++ ata_link_show_linkspeed(field, format) \
378 + static DEVICE_ATTR(field, S_IRUGO, show_ata_link_##field, NULL)
379 +
380 +-ata_link_linkspeed_attr(hw_sata_spd_limit);
381 +-ata_link_linkspeed_attr(sata_spd_limit);
382 +-ata_link_linkspeed_attr(sata_spd);
383 ++ata_link_linkspeed_attr(hw_sata_spd_limit, fls);
384 ++ata_link_linkspeed_attr(sata_spd_limit, fls);
385 ++ata_link_linkspeed_attr(sata_spd, noop);
386 +
387 +
388 + static DECLARE_TRANSPORT_CLASS(ata_link_class,
389 +diff --git a/drivers/block/loop.c b/drivers/block/loop.c
390 +index a4ddbae2..462fd182 100644
391 +--- a/drivers/block/loop.c
392 ++++ b/drivers/block/loop.c
393 +@@ -1636,7 +1636,7 @@ static int loop_add(struct loop_device **l, int i)
394 +
395 + lo->lo_queue = blk_alloc_queue(GFP_KERNEL);
396 + if (!lo->lo_queue)
397 +- goto out_free_dev;
398 ++ goto out_free_idr;
399 +
400 + disk = lo->lo_disk = alloc_disk(1 << part_shift);
401 + if (!disk)
402 +@@ -1680,6 +1680,8 @@ static int loop_add(struct loop_device **l, int i)
403 +
404 + out_free_queue:
405 + blk_cleanup_queue(lo->lo_queue);
406 ++out_free_idr:
407 ++ idr_remove(&loop_index_idr, i);
408 + out_free_dev:
409 + kfree(lo);
410 + out:
411 +diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
412 +index 4ed7bf9b..0ed5df4d 100644
413 +--- a/drivers/block/xen-blkback/blkback.c
414 ++++ b/drivers/block/xen-blkback/blkback.c
415 +@@ -401,6 +401,8 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
416 + unsigned long secure;
417 + struct phys_req preq;
418 +
419 ++ xen_blkif_get(blkif);
420 ++
421 + preq.sector_number = req->u.discard.sector_number;
422 + preq.nr_sects = req->u.discard.nr_sectors;
423 +
424 +@@ -413,7 +415,6 @@ static int dispatch_discard_io(struct xen_blkif *blkif,
425 + }
426 + blkif->st_ds_req++;
427 +
428 +- xen_blkif_get(blkif);
429 + secure = (blkif->vbd.discard_secure &&
430 + (req->u.discard.flag & BLKIF_DISCARD_SECURE)) ?
431 + BLKDEV_DISCARD_SECURE : 0;
432 +diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
433 +index 0e359225..5647ce4b 100644
434 +--- a/drivers/gpu/drm/i915/intel_display.c
435 ++++ b/drivers/gpu/drm/i915/intel_display.c
436 +@@ -6377,7 +6377,9 @@ static void i9xx_update_cursor(struct drm_crtc *crtc, u32 base)
437 + intel_crtc->cursor_visible = visible;
438 + }
439 + /* and commit changes on next vblank */
440 ++ POSTING_READ(CURCNTR(pipe));
441 + I915_WRITE(CURBASE(pipe), base);
442 ++ POSTING_READ(CURBASE(pipe));
443 + }
444 +
445 + static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
446 +@@ -6402,7 +6404,9 @@ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
447 + intel_crtc->cursor_visible = visible;
448 + }
449 + /* and commit changes on next vblank */
450 ++ POSTING_READ(CURCNTR_IVB(pipe));
451 + I915_WRITE(CURBASE_IVB(pipe), base);
452 ++ POSTING_READ(CURBASE_IVB(pipe));
453 + }
454 +
455 + /* If no-part of the cursor is visible on the framebuffer, then the GPU may hang... */
456 +diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c
457 +index ed52a6f4..2f46bbfb 100644
458 +--- a/drivers/gpu/drm/nouveau/nouveau_gem.c
459 ++++ b/drivers/gpu/drm/nouveau/nouveau_gem.c
460 +@@ -281,7 +281,8 @@ validate_fini_list(struct list_head *list, struct nouveau_fence *fence)
461 + list_for_each_safe(entry, tmp, list) {
462 + nvbo = list_entry(entry, struct nouveau_bo, entry);
463 +
464 +- nouveau_bo_fence(nvbo, fence);
465 ++ if (likely(fence))
466 ++ nouveau_bo_fence(nvbo, fence);
467 +
468 + if (unlikely(nvbo->validate_mapped)) {
469 + ttm_bo_kunmap(&nvbo->kmap);
470 +diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
471 +index 9760e5ad..b44bbf50 100644
472 +--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
473 ++++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
474 +@@ -416,6 +416,7 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,
475 + /* Pin framebuffer & get tilling informations */
476 + obj = radeon_fb->obj;
477 + rbo = gem_to_radeon_bo(obj);
478 ++retry:
479 + r = radeon_bo_reserve(rbo, false);
480 + if (unlikely(r != 0))
481 + return r;
482 +@@ -424,6 +425,33 @@ int radeon_crtc_do_set_base(struct drm_crtc *crtc,
483 + &base);
484 + if (unlikely(r != 0)) {
485 + radeon_bo_unreserve(rbo);
486 ++
487 ++ /* On old GPU like RN50 with little vram pining can fails because
488 ++ * current fb is taking all space needed. So instead of unpining
489 ++ * the old buffer after pining the new one, first unpin old one
490 ++ * and then retry pining new one.
491 ++ *
492 ++ * As only master can set mode only master can pin and it is
493 ++ * unlikely the master client will race with itself especialy
494 ++ * on those old gpu with single crtc.
495 ++ *
496 ++ * We don't shutdown the display controller because new buffer
497 ++ * will end up in same spot.
498 ++ */
499 ++ if (!atomic && fb && fb != crtc->fb) {
500 ++ struct radeon_bo *old_rbo;
501 ++ unsigned long nsize, osize;
502 ++
503 ++ old_rbo = gem_to_radeon_bo(to_radeon_framebuffer(fb)->obj);
504 ++ osize = radeon_bo_size(old_rbo);
505 ++ nsize = radeon_bo_size(rbo);
506 ++ if (nsize <= osize && !radeon_bo_reserve(old_rbo, false)) {
507 ++ radeon_bo_unpin(old_rbo);
508 ++ radeon_bo_unreserve(old_rbo);
509 ++ fb = NULL;
510 ++ goto retry;
511 ++ }
512 ++ }
513 + return -EINVAL;
514 + }
515 + radeon_bo_get_tiling_flags(rbo, &tiling_flags, NULL);
516 +diff --git a/drivers/gpu/drm/radeon/sid.h b/drivers/gpu/drm/radeon/sid.h
517 +index 1767ae7f..a9fcbe44 100644
518 +--- a/drivers/gpu/drm/radeon/sid.h
519 ++++ b/drivers/gpu/drm/radeon/sid.h
520 +@@ -165,7 +165,7 @@
521 + #define NOOFGROUPS_SHIFT 12
522 + #define NOOFGROUPS_MASK 0x00001000
523 +
524 +-#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x2808
525 ++#define MC_SEQ_TRAIN_WAKEUP_CNTL 0x28e8
526 + #define TRAIN_DONE_D0 (1 << 30)
527 + #define TRAIN_DONE_D1 (1 << 31)
528 +
529 +diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
530 +index f8187ead..2d692626 100644
531 +--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
532 ++++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
533 +@@ -342,7 +342,9 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
534 + if (old_iomap == NULL && ttm == NULL)
535 + goto out2;
536 +
537 +- if (ttm->state == tt_unpopulated) {
538 ++ /* TTM might be null for moves within the same region.
539 ++ */
540 ++ if (ttm && ttm->state == tt_unpopulated) {
541 + ret = ttm->bdev->driver->ttm_tt_populate(ttm);
542 + if (ret)
543 + goto out1;
544 +diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
545 +index 899c7120..9421f643 100644
546 +--- a/drivers/hid/hid-apple.c
547 ++++ b/drivers/hid/hid-apple.c
548 +@@ -48,6 +48,12 @@ module_param(iso_layout, uint, 0644);
549 + MODULE_PARM_DESC(iso_layout, "Enable/Disable hardcoded ISO-layout of the keyboard. "
550 + "(0 = disabled, [1] = enabled)");
551 +
552 ++static unsigned int swap_opt_cmd = 0;
553 ++module_param(swap_opt_cmd, uint, 0644);
554 ++MODULE_PARM_DESC(swap_opt_cmd, "Swap the Option (\"Alt\") and Command (\"Flag\") keys. "
555 ++ "(For people who want to keep Windows PC keyboard muscle memory. "
556 ++ "[0] = as-is, Mac layout. 1 = swapped, Windows layout.)");
557 ++
558 + struct apple_sc {
559 + unsigned long quirks;
560 + unsigned int fn_on;
561 +@@ -152,6 +158,14 @@ static const struct apple_key_translation apple_iso_keyboard[] = {
562 + { }
563 + };
564 +
565 ++static const struct apple_key_translation swapped_option_cmd_keys[] = {
566 ++ { KEY_LEFTALT, KEY_LEFTMETA },
567 ++ { KEY_LEFTMETA, KEY_LEFTALT },
568 ++ { KEY_RIGHTALT, KEY_RIGHTMETA },
569 ++ { KEY_RIGHTMETA,KEY_RIGHTALT },
570 ++ { }
571 ++};
572 ++
573 + static const struct apple_key_translation *apple_find_translation(
574 + const struct apple_key_translation *table, u16 from)
575 + {
576 +@@ -244,6 +258,14 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
577 + }
578 + }
579 +
580 ++ if (swap_opt_cmd) {
581 ++ trans = apple_find_translation(swapped_option_cmd_keys, usage->code);
582 ++ if (trans) {
583 ++ input_event(input, usage->type, trans->to, value);
584 ++ return 1;
585 ++ }
586 ++ }
587 ++
588 + return 0;
589 + }
590 +
591 +diff --git a/drivers/hid/hid-roccat-kovaplus.c b/drivers/hid/hid-roccat-kovaplus.c
592 +index 112d9341..1973cff8 100644
593 +--- a/drivers/hid/hid-roccat-kovaplus.c
594 ++++ b/drivers/hid/hid-roccat-kovaplus.c
595 +@@ -623,9 +623,13 @@ static void kovaplus_keep_values_up_to_date(struct kovaplus_device *kovaplus,
596 + break;
597 + case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI:
598 + kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1);
599 ++ break;
600 + case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY:
601 + kovaplus->actual_x_sensitivity = button_report->data1;
602 + kovaplus->actual_y_sensitivity = button_report->data2;
603 ++ break;
604 ++ default:
605 ++ break;
606 + }
607 + }
608 +
609 +diff --git a/drivers/infiniband/hw/ipath/ipath_user_sdma.c b/drivers/infiniband/hw/ipath/ipath_user_sdma.c
610 +index f5cb13b2..cc04b7ba 100644
611 +--- a/drivers/infiniband/hw/ipath/ipath_user_sdma.c
612 ++++ b/drivers/infiniband/hw/ipath/ipath_user_sdma.c
613 +@@ -280,9 +280,7 @@ static int ipath_user_sdma_pin_pages(const struct ipath_devdata *dd,
614 + int j;
615 + int ret;
616 +
617 +- ret = get_user_pages(current, current->mm, addr,
618 +- npages, 0, 1, pages, NULL);
619 +-
620 ++ ret = get_user_pages_fast(addr, npages, 0, pages);
621 + if (ret != npages) {
622 + int i;
623 +
624 +@@ -811,10 +809,7 @@ int ipath_user_sdma_writev(struct ipath_devdata *dd,
625 + while (dim) {
626 + const int mxp = 8;
627 +
628 +- down_write(&current->mm->mmap_sem);
629 + ret = ipath_user_sdma_queue_pkts(dd, pq, &list, iov, dim, mxp);
630 +- up_write(&current->mm->mmap_sem);
631 +-
632 + if (ret <= 0)
633 + goto done_unlock;
634 + else {
635 +diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
636 +index 5f306f79..0ec9abbe 100644
637 +--- a/drivers/input/serio/i8042-x86ia64io.h
638 ++++ b/drivers/input/serio/i8042-x86ia64io.h
639 +@@ -765,6 +765,7 @@ static struct pnp_device_id pnp_kbd_devids[] = {
640 + { .id = "CPQA0D7", .driver_data = 0 },
641 + { .id = "", },
642 + };
643 ++MODULE_DEVICE_TABLE(pnp, pnp_kbd_devids);
644 +
645 + static struct pnp_driver i8042_pnp_kbd_driver = {
646 + .name = "i8042 kbd",
647 +@@ -786,6 +787,7 @@ static struct pnp_device_id pnp_aux_devids[] = {
648 + { .id = "SYN0801", .driver_data = 0 },
649 + { .id = "", },
650 + };
651 ++MODULE_DEVICE_TABLE(pnp, pnp_aux_devids);
652 +
653 + static struct pnp_driver i8042_pnp_aux_driver = {
654 + .name = "i8042 aux",
655 +diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
656 +index f220a695..d509f236 100644
657 +--- a/drivers/md/dm-table.c
658 ++++ b/drivers/md/dm-table.c
659 +@@ -581,14 +581,28 @@ static int adjoin(struct dm_table *table, struct dm_target *ti)
660 +
661 + /*
662 + * Used to dynamically allocate the arg array.
663 ++ *
664 ++ * We do first allocation with GFP_NOIO because dm-mpath and dm-thin must
665 ++ * process messages even if some device is suspended. These messages have a
666 ++ * small fixed number of arguments.
667 ++ *
668 ++ * On the other hand, dm-switch needs to process bulk data using messages and
669 ++ * excessive use of GFP_NOIO could cause trouble.
670 + */
671 + static char **realloc_argv(unsigned *array_size, char **old_argv)
672 + {
673 + char **argv;
674 + unsigned new_size;
675 ++ gfp_t gfp;
676 +
677 +- new_size = *array_size ? *array_size * 2 : 64;
678 +- argv = kmalloc(new_size * sizeof(*argv), GFP_KERNEL);
679 ++ if (*array_size) {
680 ++ new_size = *array_size * 2;
681 ++ gfp = GFP_KERNEL;
682 ++ } else {
683 ++ new_size = 8;
684 ++ gfp = GFP_NOIO;
685 ++ }
686 ++ argv = kmalloc(new_size * sizeof(*argv), gfp);
687 + if (argv) {
688 + memcpy(argv, old_argv, *array_size * sizeof(*argv));
689 + *array_size = new_size;
690 +diff --git a/drivers/md/md.c b/drivers/md/md.c
691 +index 7b45b5e1..e63ca864 100644
692 +--- a/drivers/md/md.c
693 ++++ b/drivers/md/md.c
694 +@@ -3507,6 +3507,7 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
695 + mddev->in_sync = 1;
696 + del_timer_sync(&mddev->safemode_timer);
697 + }
698 ++ blk_set_stacking_limits(&mddev->queue->limits);
699 + pers->run(mddev);
700 + mddev_resume(mddev);
701 + set_bit(MD_CHANGE_DEVS, &mddev->flags);
702 +diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
703 +index 9ec51cec..0f000e60 100644
704 +--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
705 ++++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
706 +@@ -227,8 +227,6 @@ static void dma_irq_callback(void *param)
707 + struct gpmi_nand_data *this = param;
708 + struct completion *dma_c = &this->dma_done;
709 +
710 +- complete(dma_c);
711 +-
712 + switch (this->dma_type) {
713 + case DMA_FOR_COMMAND:
714 + dma_unmap_sg(this->dev, &this->cmd_sgl, 1, DMA_TO_DEVICE);
715 +@@ -253,6 +251,8 @@ static void dma_irq_callback(void *param)
716 + default:
717 + pr_err("in wrong DMA operation.\n");
718 + }
719 ++
720 ++ complete(dma_c);
721 + }
722 +
723 + int start_dma_without_bch_irq(struct gpmi_nand_data *this,
724 +diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
725 +index eb9f5fb0..e50a0b48 100644
726 +--- a/drivers/mtd/nand/nand_base.c
727 ++++ b/drivers/mtd/nand/nand_base.c
728 +@@ -2888,10 +2888,21 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
729 + sanitize_string(p->model, sizeof(p->model));
730 + if (!mtd->name)
731 + mtd->name = p->model;
732 ++
733 + mtd->writesize = le32_to_cpu(p->byte_per_page);
734 +- mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
735 ++
736 ++ /*
737 ++ * pages_per_block and blocks_per_lun may not be a power-of-2 size
738 ++ * (don't ask me who thought of this...). MTD assumes that these
739 ++ * dimensions will be power-of-2, so just truncate the remaining area.
740 ++ */
741 ++ mtd->erasesize = 1 << (fls(le32_to_cpu(p->pages_per_block)) - 1);
742 ++ mtd->erasesize *= mtd->writesize;
743 ++
744 + mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
745 +- chip->chipsize = le32_to_cpu(p->blocks_per_lun);
746 ++
747 ++ /* See erasesize comment */
748 ++ chip->chipsize = 1 << (fls(le32_to_cpu(p->blocks_per_lun)) - 1);
749 + chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count;
750 + *busw = 0;
751 + if (le16_to_cpu(p->features) & 1)
752 +diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
753 +index e2131ca6..eb4014a2 100644
754 +--- a/drivers/net/can/flexcan.c
755 ++++ b/drivers/net/can/flexcan.c
756 +@@ -667,7 +667,6 @@ static int flexcan_chip_start(struct net_device *dev)
757 + {
758 + struct flexcan_priv *priv = netdev_priv(dev);
759 + struct flexcan_regs __iomem *regs = priv->base;
760 +- unsigned int i;
761 + int err;
762 + u32 reg_mcr, reg_ctrl;
763 +
764 +@@ -735,17 +734,6 @@ static int flexcan_chip_start(struct net_device *dev)
765 + netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
766 + flexcan_write(reg_ctrl, &regs->ctrl);
767 +
768 +- for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
769 +- flexcan_write(0, &regs->cantxfg[i].can_ctrl);
770 +- flexcan_write(0, &regs->cantxfg[i].can_id);
771 +- flexcan_write(0, &regs->cantxfg[i].data[0]);
772 +- flexcan_write(0, &regs->cantxfg[i].data[1]);
773 +-
774 +- /* put MB into rx queue */
775 +- flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
776 +- &regs->cantxfg[i].can_ctrl);
777 +- }
778 +-
779 + /* Abort any pending TX, mark Mailbox as INACTIVE */
780 + flexcan_write(FLEXCAN_MB_CNT_CODE(0x4),
781 + &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
782 +diff --git a/drivers/net/wireless/mwifiex/sdio.c b/drivers/net/wireless/mwifiex/sdio.c
783 +index 4be8ccc8..daf55ba8 100644
784 +--- a/drivers/net/wireless/mwifiex/sdio.c
785 ++++ b/drivers/net/wireless/mwifiex/sdio.c
786 +@@ -938,7 +938,10 @@ static int mwifiex_decode_rx_packet(struct mwifiex_adapter *adapter,
787 + struct sk_buff *skb, u32 upld_typ)
788 + {
789 + u8 *cmd_buf;
790 ++ __le16 *curr_ptr = (__le16 *)skb->data;
791 ++ u16 pkt_len = le16_to_cpu(*curr_ptr);
792 +
793 ++ skb_trim(skb, pkt_len);
794 + skb_pull(skb, INTF_HEADER_LEN);
795 +
796 + switch (upld_typ) {
797 +diff --git a/drivers/net/wireless/prism54/islpci_dev.c b/drivers/net/wireless/prism54/islpci_dev.c
798 +index 5970ff6f..d498b02f 100644
799 +--- a/drivers/net/wireless/prism54/islpci_dev.c
800 ++++ b/drivers/net/wireless/prism54/islpci_dev.c
801 +@@ -811,6 +811,10 @@ static const struct net_device_ops islpci_netdev_ops = {
802 + .ndo_validate_addr = eth_validate_addr,
803 + };
804 +
805 ++static struct device_type wlan_type = {
806 ++ .name = "wlan",
807 ++};
808 ++
809 + struct net_device *
810 + islpci_setup(struct pci_dev *pdev)
811 + {
812 +@@ -821,9 +825,8 @@ islpci_setup(struct pci_dev *pdev)
813 + return ndev;
814 +
815 + pci_set_drvdata(pdev, ndev);
816 +-#if defined(SET_NETDEV_DEV)
817 + SET_NETDEV_DEV(ndev, &pdev->dev);
818 +-#endif
819 ++ SET_NETDEV_DEVTYPE(ndev, &wlan_type);
820 +
821 + /* setup the structure members */
822 + ndev->base_addr = pci_resource_start(pdev, 0);
823 +diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
824 +index 0ea85f46..131b22b8 100644
825 +--- a/drivers/net/wireless/rt2x00/rt2400pci.c
826 ++++ b/drivers/net/wireless/rt2x00/rt2400pci.c
827 +@@ -1253,7 +1253,7 @@ static void rt2400pci_fill_rxdone(struct queue_entry *entry,
828 + */
829 + rxdesc->timestamp = ((u64)rx_high << 32) | rx_low;
830 + rxdesc->signal = rt2x00_get_field32(word2, RXD_W2_SIGNAL) & ~0x08;
831 +- rxdesc->rssi = rt2x00_get_field32(word2, RXD_W3_RSSI) -
832 ++ rxdesc->rssi = rt2x00_get_field32(word3, RXD_W3_RSSI) -
833 + entry->queue->rt2x00dev->rssi_offset;
834 + rxdesc->size = rt2x00_get_field32(word0, RXD_W0_DATABYTE_COUNT);
835 +
836 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
837 +index 025bdc2e..4f7f822b 100644
838 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
839 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/mac.c
840 +@@ -762,7 +762,7 @@ static long _rtl92c_signal_scale_mapping(struct ieee80211_hw *hw,
841 +
842 + static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw,
843 + struct rtl_stats *pstats,
844 +- struct rx_desc_92c *pdesc,
845 ++ struct rx_desc_92c *p_desc,
846 + struct rx_fwinfo_92c *p_drvinfo,
847 + bool packet_match_bssid,
848 + bool packet_toself,
849 +@@ -777,11 +777,11 @@ static void _rtl92c_query_rxphystatus(struct ieee80211_hw *hw,
850 + u32 rssi, total_rssi = 0;
851 + bool in_powersavemode = false;
852 + bool is_cck_rate;
853 ++ u8 *pdesc = (u8 *)p_desc;
854 +
855 +- is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc);
856 ++ is_cck_rate = RX_HAL_IS_CCK_RATE(p_desc);
857 + pstats->packet_matchbssid = packet_match_bssid;
858 + pstats->packet_toself = packet_toself;
859 +- pstats->is_cck = is_cck_rate;
860 + pstats->packet_beacon = packet_beacon;
861 + pstats->is_cck = is_cck_rate;
862 + pstats->RX_SIGQ[0] = -1;
863 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
864 +index 9adb21a1..2fd82970 100644
865 +--- a/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
866 ++++ b/drivers/net/wireless/rtlwifi/rtl8192cu/trx.c
867 +@@ -303,10 +303,10 @@ out:
868 + bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
869 + struct rtl_stats *stats,
870 + struct ieee80211_rx_status *rx_status,
871 +- u8 *p_desc, struct sk_buff *skb)
872 ++ u8 *pdesc, struct sk_buff *skb)
873 + {
874 + struct rx_fwinfo_92c *p_drvinfo;
875 +- struct rx_desc_92c *pdesc = (struct rx_desc_92c *)p_desc;
876 ++ struct rx_desc_92c *p_desc = (struct rx_desc_92c *)pdesc;
877 + u32 phystatus = GET_RX_DESC_PHY_STATUS(pdesc);
878 +
879 + stats->length = (u16) GET_RX_DESC_PKT_LEN(pdesc);
880 +@@ -345,11 +345,11 @@ bool rtl92cu_rx_query_desc(struct ieee80211_hw *hw,
881 + if (phystatus) {
882 + p_drvinfo = (struct rx_fwinfo_92c *)(skb->data +
883 + stats->rx_bufshift);
884 +- rtl92c_translate_rx_signal_stuff(hw, skb, stats, pdesc,
885 ++ rtl92c_translate_rx_signal_stuff(hw, skb, stats, p_desc,
886 + p_drvinfo);
887 + }
888 + /*rx_status->qual = stats->signal; */
889 +- rx_status->signal = stats->rssi + 10;
890 ++ rx_status->signal = stats->recvsignalpower + 10;
891 + /*rx_status->noise = -stats->noise; */
892 + return true;
893 + }
894 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
895 +index a7f6126e..1a2bbc2b 100644
896 +--- a/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
897 ++++ b/drivers/net/wireless/rtlwifi/rtl8192de/trx.c
898 +@@ -529,7 +529,7 @@ bool rtl92de_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
899 + p_drvinfo);
900 + }
901 + /*rx_status->qual = stats->signal; */
902 +- rx_status->signal = stats->rssi + 10;
903 ++ rx_status->signal = stats->recvsignalpower + 10;
904 + /*rx_status->noise = -stats->noise; */
905 + return true;
906 + }
907 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
908 +index 08c2f562..c405f967 100644
909 +--- a/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
910 ++++ b/drivers/net/wireless/rtlwifi/rtl8192se/rf.c
911 +@@ -268,7 +268,7 @@ static void _rtl92s_get_txpower_writeval_byregulatory(struct ieee80211_hw *hw,
912 + rtlefuse->pwrgroup_ht40
913 + [RF90_PATH_A][chnl - 1]) {
914 + pwrdiff_limit[i] =
915 +- rtlefuse->pwrgroup_ht20
916 ++ rtlefuse->pwrgroup_ht40
917 + [RF90_PATH_A][chnl - 1];
918 + }
919 + } else {
920 +diff --git a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
921 +index 2fd3d13b..94bbce82 100644
922 +--- a/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
923 ++++ b/drivers/net/wireless/rtlwifi/rtl8192se/trx.c
924 +@@ -582,7 +582,7 @@ bool rtl92se_rx_query_desc(struct ieee80211_hw *hw, struct rtl_stats *stats,
925 + }
926 +
927 + /*rx_status->qual = stats->signal; */
928 +- rx_status->signal = stats->rssi + 10;
929 ++ rx_status->signal = stats->recvsignalpower + 10;
930 + /*rx_status->noise = -stats->noise; */
931 +
932 + return true;
933 +diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
934 +index e0610bda..7e41b70a 100644
935 +--- a/drivers/pci/pcie/portdrv_pci.c
936 ++++ b/drivers/pci/pcie/portdrv_pci.c
937 +@@ -151,7 +151,6 @@ static int __devinit pcie_portdrv_probe(struct pci_dev *dev,
938 + static void pcie_portdrv_remove(struct pci_dev *dev)
939 + {
940 + pcie_port_device_remove(dev);
941 +- pci_disable_device(dev);
942 + }
943 +
944 + static int error_detected_iter(struct device *device, void *data)
945 +diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
946 +index 8334dadc..be56590b 100644
947 +--- a/drivers/s390/net/qeth_core_main.c
948 ++++ b/drivers/s390/net/qeth_core_main.c
949 +@@ -4357,7 +4357,7 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
950 + struct qeth_cmd_buffer *iob;
951 + struct qeth_ipa_cmd *cmd;
952 + struct qeth_snmp_ureq *ureq;
953 +- int req_len;
954 ++ unsigned int req_len;
955 + struct qeth_arp_query_info qinfo = {0, };
956 + int rc = 0;
957 +
958 +@@ -4373,6 +4373,10 @@ int qeth_snmp_command(struct qeth_card *card, char __user *udata)
959 + /* skip 4 bytes (data_len struct member) to get req_len */
960 + if (copy_from_user(&req_len, udata + sizeof(int), sizeof(int)))
961 + return -EFAULT;
962 ++ if (req_len > (QETH_BUFSIZE - IPA_PDU_HEADER_SIZE -
963 ++ sizeof(struct qeth_ipacmd_hdr) -
964 ++ sizeof(struct qeth_ipacmd_setadpparms_hdr)))
965 ++ return -EINVAL;
966 + ureq = memdup_user(udata, req_len + sizeof(struct qeth_snmp_ureq_hdr));
967 + if (IS_ERR(ureq)) {
968 + QETH_CARD_TEXT(card, 2, "snmpnome");
969 +diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c
970 +index 76ea4a8f..56a96d32 100644
971 +--- a/drivers/staging/media/lirc/lirc_zilog.c
972 ++++ b/drivers/staging/media/lirc/lirc_zilog.c
973 +@@ -61,6 +61,9 @@
974 + #include <media/lirc_dev.h>
975 + #include <media/lirc.h>
976 +
977 ++/* Max transfer size done by I2C transfer functions */
978 ++#define MAX_XFER_SIZE 64
979 ++
980 + struct IR;
981 +
982 + struct IR_rx {
983 +@@ -942,7 +945,14 @@ static ssize_t read(struct file *filep, char *outbuf, size_t n, loff_t *ppos)
984 + schedule();
985 + set_current_state(TASK_INTERRUPTIBLE);
986 + } else {
987 +- unsigned char buf[rbuf->chunk_size];
988 ++ unsigned char buf[MAX_XFER_SIZE];
989 ++
990 ++ if (rbuf->chunk_size > sizeof(buf)) {
991 ++ zilog_error("chunk_size is too big (%d)!\n",
992 ++ rbuf->chunk_size);
993 ++ ret = -EINVAL;
994 ++ break;
995 ++ }
996 + m = lirc_buffer_read(rbuf, buf);
997 + if (m == rbuf->chunk_size) {
998 + ret = copy_to_user((void *)outbuf+written, buf,
999 +diff --git a/drivers/staging/tidspbridge/Kconfig b/drivers/staging/tidspbridge/Kconfig
1000 +index 0dd479f5..f67c78e5 100644
1001 +--- a/drivers/staging/tidspbridge/Kconfig
1002 ++++ b/drivers/staging/tidspbridge/Kconfig
1003 +@@ -4,7 +4,7 @@
1004 +
1005 + menuconfig TIDSPBRIDGE
1006 + tristate "DSP Bridge driver"
1007 +- depends on ARCH_OMAP3
1008 ++ depends on ARCH_OMAP3 && BROKEN
1009 + select OMAP_MBOX_FWK
1010 + help
1011 + DSP/BIOS Bridge is designed for platforms that contain a GPP and
1012 +diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c
1013 +index 06f27f62..858e2a8e 100644
1014 +--- a/drivers/staging/vt6656/baseband.c
1015 ++++ b/drivers/staging/vt6656/baseband.c
1016 +@@ -976,6 +976,7 @@ BOOL BBbVT3184Init(PSDevice pDevice)
1017 + PBYTE pbyAgc;
1018 + WORD wLengthAgc;
1019 + BYTE abyArray[256];
1020 ++ u8 data;
1021 +
1022 + ntStatus = CONTROLnsRequestIn(pDevice,
1023 + MESSAGE_TYPE_READ,
1024 +@@ -1144,6 +1145,16 @@ else {
1025 + ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
1026 +
1027 + RFbRFTableDownload(pDevice);
1028 ++
1029 ++ /* Fix for TX USB resets from vendors driver */
1030 ++ CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4,
1031 ++ MESSAGE_REQUEST_MEM, sizeof(data), &data);
1032 ++
1033 ++ data |= 0x2;
1034 ++
1035 ++ CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4,
1036 ++ MESSAGE_REQUEST_MEM, sizeof(data), &data);
1037 ++
1038 + return TRUE;//ntStatus;
1039 + }
1040 +
1041 +diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h
1042 +index fccf7e98..dcf7bf54 100644
1043 +--- a/drivers/staging/vt6656/rndis.h
1044 ++++ b/drivers/staging/vt6656/rndis.h
1045 +@@ -69,6 +69,7 @@
1046 +
1047 + #define VIAUSB20_PACKET_HEADER 0x04
1048 +
1049 ++#define USB_REG4 0x604
1050 +
1051 + /*--------------------- Export Classes ----------------------------*/
1052 +
1053 +diff --git a/drivers/target/iscsi/iscsi_target_auth.c b/drivers/target/iscsi/iscsi_target_auth.c
1054 +index a0fc7b9e..b54f6ecf 100644
1055 +--- a/drivers/target/iscsi/iscsi_target_auth.c
1056 ++++ b/drivers/target/iscsi/iscsi_target_auth.c
1057 +@@ -174,6 +174,7 @@ static int chap_server_compute_md5(
1058 + unsigned char client_digest[MD5_SIGNATURE_SIZE];
1059 + unsigned char server_digest[MD5_SIGNATURE_SIZE];
1060 + unsigned char chap_n[MAX_CHAP_N_SIZE], chap_r[MAX_RESPONSE_LENGTH];
1061 ++ size_t compare_len;
1062 + struct iscsi_chap *chap = conn->auth_protocol;
1063 + struct crypto_hash *tfm;
1064 + struct hash_desc desc;
1065 +@@ -212,7 +213,9 @@ static int chap_server_compute_md5(
1066 + goto out;
1067 + }
1068 +
1069 +- if (memcmp(chap_n, auth->userid, strlen(auth->userid)) != 0) {
1070 ++ /* Include the terminating NULL in the compare */
1071 ++ compare_len = strlen(auth->userid) + 1;
1072 ++ if (strncmp(chap_n, auth->userid, compare_len) != 0) {
1073 + pr_err("CHAP_N values do not match!\n");
1074 + goto out;
1075 + }
1076 +diff --git a/drivers/target/iscsi/iscsi_target_nego.c b/drivers/target/iscsi/iscsi_target_nego.c
1077 +index 2dba448c..60470ee9 100644
1078 +--- a/drivers/target/iscsi/iscsi_target_nego.c
1079 ++++ b/drivers/target/iscsi/iscsi_target_nego.c
1080 +@@ -89,7 +89,7 @@ int extract_param(
1081 + if (len < 0)
1082 + return -1;
1083 +
1084 +- if (len > max_length) {
1085 ++ if (len >= max_length) {
1086 + pr_err("Length of input: %d exceeds max_length:"
1087 + " %d\n", len, max_length);
1088 + return -1;
1089 +diff --git a/drivers/video/backlight/atmel-pwm-bl.c b/drivers/video/backlight/atmel-pwm-bl.c
1090 +index 0443a4f7..4d2bbd89 100644
1091 +--- a/drivers/video/backlight/atmel-pwm-bl.c
1092 ++++ b/drivers/video/backlight/atmel-pwm-bl.c
1093 +@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(struct backlight_device *bd)
1094 + static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)
1095 + {
1096 + struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
1097 +- u8 intensity;
1098 ++ u32 intensity;
1099 +
1100 + if (pwmbl->pdata->pwm_active_low) {
1101 + intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
1102 +@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)
1103 + pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY);
1104 + }
1105 +
1106 +- return intensity;
1107 ++ return intensity & 0xffff;
1108 + }
1109 +
1110 + static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
1111 +diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
1112 +index 10f5e0b4..901c3d74 100644
1113 +--- a/fs/devpts/inode.c
1114 ++++ b/fs/devpts/inode.c
1115 +@@ -475,6 +475,7 @@ static void devpts_kill_sb(struct super_block *sb)
1116 + {
1117 + struct pts_fs_info *fsi = DEVPTS_SB(sb);
1118 +
1119 ++ ida_destroy(&fsi->allocated_ptys);
1120 + kfree(fsi);
1121 + kill_litter_super(sb);
1122 + }
1123 +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
1124 +index b1aa7fd4..01f2cf34 100644
1125 +--- a/fs/ext4/xattr.c
1126 ++++ b/fs/ext4/xattr.c
1127 +@@ -1270,6 +1270,7 @@ retry:
1128 + new_extra_isize = s_min_extra_isize;
1129 + kfree(is); is = NULL;
1130 + kfree(bs); bs = NULL;
1131 ++ brelse(bh);
1132 + goto retry;
1133 + }
1134 + error = -1;
1135 +diff --git a/include/linux/mtd/map.h b/include/linux/mtd/map.h
1136 +index 3595a023..292645fc 100644
1137 +--- a/include/linux/mtd/map.h
1138 ++++ b/include/linux/mtd/map.h
1139 +@@ -362,7 +362,7 @@ static inline map_word map_word_load_partial(struct map_info *map, map_word orig
1140 + bitpos = (map_bankwidth(map)-1-i)*8;
1141 + #endif
1142 + orig.x[0] &= ~(0xff << bitpos);
1143 +- orig.x[0] |= buf[i-start] << bitpos;
1144 ++ orig.x[0] |= (unsigned long)buf[i-start] << bitpos;
1145 + }
1146 + }
1147 + return orig;
1148 +@@ -381,7 +381,7 @@ static inline map_word map_word_ff(struct map_info *map)
1149 +
1150 + if (map_bankwidth(map) < MAP_FF_LIMIT) {
1151 + int bw = 8 * map_bankwidth(map);
1152 +- r.x[0] = (1 << bw) - 1;
1153 ++ r.x[0] = (1UL << bw) - 1;
1154 + } else {
1155 + for (i=0; i<map_words(map); i++)
1156 + r.x[i] = ~0UL;
1157 +diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
1158 +index 76972494..763bf05c 100644
1159 +--- a/include/trace/ftrace.h
1160 ++++ b/include/trace/ftrace.h
1161 +@@ -379,7 +379,8 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
1162 + __data_size += (len) * sizeof(type);
1163 +
1164 + #undef __string
1165 +-#define __string(item, src) __dynamic_array(char, item, strlen(src) + 1)
1166 ++#define __string(item, src) __dynamic_array(char, item, \
1167 ++ strlen((src) ? (const char *)(src) : "(null)") + 1)
1168 +
1169 + #undef DECLARE_EVENT_CLASS
1170 + #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
1171 +@@ -504,7 +505,7 @@ static inline notrace int ftrace_get_offsets_##call( \
1172 +
1173 + #undef __assign_str
1174 + #define __assign_str(dst, src) \
1175 +- strcpy(__get_str(dst), src);
1176 ++ strcpy(__get_str(dst), (src) ? (const char *)(src) : "(null)");
1177 +
1178 + #undef TP_fast_assign
1179 + #define TP_fast_assign(args...) args
1180 +diff --git a/kernel/audit.c b/kernel/audit.c
1181 +index 1c7f2c61..4478f7b2 100644
1182 +--- a/kernel/audit.c
1183 ++++ b/kernel/audit.c
1184 +@@ -625,7 +625,7 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type,
1185 + char *ctx = NULL;
1186 + u32 len;
1187 +
1188 +- if (!audit_enabled) {
1189 ++ if (!audit_enabled && msg_type != AUDIT_USER_AVC) {
1190 + *ab = NULL;
1191 + return rc;
1192 + }
1193 +@@ -684,6 +684,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1194 +
1195 + switch (msg_type) {
1196 + case AUDIT_GET:
1197 ++ status_set.mask = 0;
1198 + status_set.enabled = audit_enabled;
1199 + status_set.failure = audit_failure;
1200 + status_set.pid = audit_pid;
1201 +@@ -695,7 +696,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
1202 + &status_set, sizeof(status_set));
1203 + break;
1204 + case AUDIT_SET:
1205 +- if (nlh->nlmsg_len < sizeof(struct audit_status))
1206 ++ if (nlmsg_len(nlh) < sizeof(struct audit_status))
1207 + return -EINVAL;
1208 + status_get = (struct audit_status *)data;
1209 + if (status_get->mask & AUDIT_STATUS_ENABLED) {
1210 +diff --git a/kernel/cpuset.c b/kernel/cpuset.c
1211 +index 8fe6f6b6..e372d949 100644
1212 +--- a/kernel/cpuset.c
1213 ++++ b/kernel/cpuset.c
1214 +@@ -983,8 +983,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
1215 + need_loop = task_has_mempolicy(tsk) ||
1216 + !nodes_intersects(*newmems, tsk->mems_allowed);
1217 +
1218 +- if (need_loop)
1219 ++ if (need_loop) {
1220 ++ local_irq_disable();
1221 + write_seqcount_begin(&tsk->mems_allowed_seq);
1222 ++ }
1223 +
1224 + nodes_or(tsk->mems_allowed, tsk->mems_allowed, *newmems);
1225 + mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP1);
1226 +@@ -992,8 +994,10 @@ static void cpuset_change_task_nodemask(struct task_struct *tsk,
1227 + mpol_rebind_task(tsk, newmems, MPOL_REBIND_STEP2);
1228 + tsk->mems_allowed = *newmems;
1229 +
1230 +- if (need_loop)
1231 ++ if (need_loop) {
1232 + write_seqcount_end(&tsk->mems_allowed_seq);
1233 ++ local_irq_enable();
1234 ++ }
1235 +
1236 + task_unlock(tsk);
1237 + }
1238 +diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
1239 +index 0de28576..91c04f16 100644
1240 +--- a/kernel/power/snapshot.c
1241 ++++ b/kernel/power/snapshot.c
1242 +@@ -1398,7 +1398,11 @@ int hibernate_preallocate_memory(void)
1243 + * highmem and non-highmem zones separately.
1244 + */
1245 + pages_highmem = preallocate_image_highmem(highmem / 2);
1246 +- alloc = (count - max_size) - pages_highmem;
1247 ++ alloc = count - max_size;
1248 ++ if (alloc > pages_highmem)
1249 ++ alloc -= pages_highmem;
1250 ++ else
1251 ++ alloc = 0;
1252 + pages = preallocate_image_memory(alloc, avail_normal);
1253 + if (pages < alloc) {
1254 + /* We have exhausted non-highmem pages, try highmem. */
1255 +diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
1256 +index 8a538c55..877aa733 100644
1257 +--- a/kernel/time/alarmtimer.c
1258 ++++ b/kernel/time/alarmtimer.c
1259 +@@ -474,7 +474,7 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp)
1260 + clockid_t baseid = alarm_bases[clock2alarm(which_clock)].base_clockid;
1261 +
1262 + if (!alarmtimer_get_rtcdev())
1263 +- return -ENOTSUPP;
1264 ++ return -EINVAL;
1265 +
1266 + return hrtimer_get_res(baseid, tp);
1267 + }
1268 +@@ -491,7 +491,7 @@ static int alarm_clock_get(clockid_t which_clock, struct timespec *tp)
1269 + struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)];
1270 +
1271 + if (!alarmtimer_get_rtcdev())
1272 +- return -ENOTSUPP;
1273 ++ return -EINVAL;
1274 +
1275 + *tp = ktime_to_timespec(base->gettime());
1276 + return 0;
1277 +diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
1278 +index e101cf9a..8c8169bf 100644
1279 +--- a/kernel/trace/ftrace.c
1280 ++++ b/kernel/trace/ftrace.c
1281 +@@ -312,9 +312,6 @@ static int remove_ftrace_list_ops(struct ftrace_ops **list,
1282 +
1283 + static int __register_ftrace_function(struct ftrace_ops *ops)
1284 + {
1285 +- if (ftrace_disabled)
1286 +- return -ENODEV;
1287 +-
1288 + if (FTRACE_WARN_ON(ops == &global_ops))
1289 + return -EINVAL;
1290 +
1291 +@@ -348,9 +345,6 @@ static int __unregister_ftrace_function(struct ftrace_ops *ops)
1292 + {
1293 + int ret;
1294 +
1295 +- if (ftrace_disabled)
1296 +- return -ENODEV;
1297 +-
1298 + if (WARN_ON(!(ops->flags & FTRACE_OPS_FL_ENABLED)))
1299 + return -EBUSY;
1300 +
1301 +@@ -1940,10 +1934,15 @@ static void ftrace_startup_enable(int command)
1302 + static int ftrace_startup(struct ftrace_ops *ops, int command)
1303 + {
1304 + bool hash_enable = true;
1305 ++ int ret;
1306 +
1307 + if (unlikely(ftrace_disabled))
1308 + return -ENODEV;
1309 +
1310 ++ ret = __register_ftrace_function(ops);
1311 ++ if (ret)
1312 ++ return ret;
1313 ++
1314 + ftrace_start_up++;
1315 + command |= FTRACE_UPDATE_CALLS;
1316 +
1317 +@@ -1965,12 +1964,17 @@ static int ftrace_startup(struct ftrace_ops *ops, int command)
1318 + return 0;
1319 + }
1320 +
1321 +-static void ftrace_shutdown(struct ftrace_ops *ops, int command)
1322 ++static int ftrace_shutdown(struct ftrace_ops *ops, int command)
1323 + {
1324 + bool hash_disable = true;
1325 ++ int ret;
1326 +
1327 + if (unlikely(ftrace_disabled))
1328 +- return;
1329 ++ return -ENODEV;
1330 ++
1331 ++ ret = __unregister_ftrace_function(ops);
1332 ++ if (ret)
1333 ++ return ret;
1334 +
1335 + ftrace_start_up--;
1336 + /*
1337 +@@ -2005,9 +2009,10 @@ static void ftrace_shutdown(struct ftrace_ops *ops, int command)
1338 + }
1339 +
1340 + if (!command || !ftrace_enabled)
1341 +- return;
1342 ++ return 0;
1343 +
1344 + ftrace_run_update_code(command);
1345 ++ return 0;
1346 + }
1347 +
1348 + static void ftrace_startup_sysctl(void)
1349 +@@ -2873,16 +2878,13 @@ static void __enable_ftrace_function_probe(void)
1350 + if (i == FTRACE_FUNC_HASHSIZE)
1351 + return;
1352 +
1353 +- ret = __register_ftrace_function(&trace_probe_ops);
1354 +- if (!ret)
1355 +- ret = ftrace_startup(&trace_probe_ops, 0);
1356 ++ ret = ftrace_startup(&trace_probe_ops, 0);
1357 +
1358 + ftrace_probe_registered = 1;
1359 + }
1360 +
1361 + static void __disable_ftrace_function_probe(void)
1362 + {
1363 +- int ret;
1364 + int i;
1365 +
1366 + if (!ftrace_probe_registered)
1367 +@@ -2895,9 +2897,7 @@ static void __disable_ftrace_function_probe(void)
1368 + }
1369 +
1370 + /* no more funcs left */
1371 +- ret = __unregister_ftrace_function(&trace_probe_ops);
1372 +- if (!ret)
1373 +- ftrace_shutdown(&trace_probe_ops, 0);
1374 ++ ftrace_shutdown(&trace_probe_ops, 0);
1375 +
1376 + ftrace_probe_registered = 0;
1377 + }
1378 +@@ -3948,12 +3948,15 @@ device_initcall(ftrace_nodyn_init);
1379 + static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; }
1380 + static inline void ftrace_startup_enable(int command) { }
1381 + /* Keep as macros so we do not need to define the commands */
1382 +-# define ftrace_startup(ops, command) \
1383 +- ({ \
1384 +- (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
1385 +- 0; \
1386 ++# define ftrace_startup(ops, command) \
1387 ++ ({ \
1388 ++ int ___ret = __register_ftrace_function(ops); \
1389 ++ if (!___ret) \
1390 ++ (ops)->flags |= FTRACE_OPS_FL_ENABLED; \
1391 ++ ___ret; \
1392 + })
1393 +-# define ftrace_shutdown(ops, command) do { } while (0)
1394 ++# define ftrace_shutdown(ops, command) __unregister_ftrace_function(ops)
1395 ++
1396 + # define ftrace_startup_sysctl() do { } while (0)
1397 + # define ftrace_shutdown_sysctl() do { } while (0)
1398 +
1399 +@@ -4323,15 +4326,8 @@ int register_ftrace_function(struct ftrace_ops *ops)
1400 +
1401 + mutex_lock(&ftrace_lock);
1402 +
1403 +- if (unlikely(ftrace_disabled))
1404 +- goto out_unlock;
1405 +-
1406 +- ret = __register_ftrace_function(ops);
1407 +- if (!ret)
1408 +- ret = ftrace_startup(ops, 0);
1409 +-
1410 ++ ret = ftrace_startup(ops, 0);
1411 +
1412 +- out_unlock:
1413 + mutex_unlock(&ftrace_lock);
1414 + return ret;
1415 + }
1416 +@@ -4348,9 +4344,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
1417 + int ret;
1418 +
1419 + mutex_lock(&ftrace_lock);
1420 +- ret = __unregister_ftrace_function(ops);
1421 +- if (!ret)
1422 +- ftrace_shutdown(ops, 0);
1423 ++ ret = ftrace_shutdown(ops, 0);
1424 + mutex_unlock(&ftrace_lock);
1425 +
1426 + return ret;
1427 +@@ -4544,6 +4538,12 @@ ftrace_suspend_notifier_call(struct notifier_block *bl, unsigned long state,
1428 + return NOTIFY_DONE;
1429 + }
1430 +
1431 ++/* Just a place holder for function graph */
1432 ++static struct ftrace_ops fgraph_ops __read_mostly = {
1433 ++ .func = ftrace_stub,
1434 ++ .flags = FTRACE_OPS_FL_GLOBAL,
1435 ++};
1436 ++
1437 + int register_ftrace_graph(trace_func_graph_ret_t retfunc,
1438 + trace_func_graph_ent_t entryfunc)
1439 + {
1440 +@@ -4570,7 +4570,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc,
1441 + ftrace_graph_return = retfunc;
1442 + ftrace_graph_entry = entryfunc;
1443 +
1444 +- ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET);
1445 ++ ret = ftrace_startup(&fgraph_ops, FTRACE_START_FUNC_RET);
1446 +
1447 + out:
1448 + mutex_unlock(&ftrace_lock);
1449 +@@ -4587,7 +4587,7 @@ void unregister_ftrace_graph(void)
1450 + ftrace_graph_active--;
1451 + ftrace_graph_return = (trace_func_graph_ret_t)ftrace_stub;
1452 + ftrace_graph_entry = ftrace_graph_entry_stub;
1453 +- ftrace_shutdown(&global_ops, FTRACE_STOP_FUNC_RET);
1454 ++ ftrace_shutdown(&fgraph_ops, FTRACE_STOP_FUNC_RET);
1455 + unregister_pm_notifier(&ftrace_suspend_notifier);
1456 + unregister_trace_sched_switch(ftrace_graph_probe_sched_switch, NULL);
1457 +
1458 +diff --git a/lib/vsprintf.c b/lib/vsprintf.c
1459 +index abbabec9..73e2c45a 100644
1460 +--- a/lib/vsprintf.c
1461 ++++ b/lib/vsprintf.c
1462 +@@ -25,6 +25,7 @@
1463 + #include <linux/kallsyms.h>
1464 + #include <linux/uaccess.h>
1465 + #include <linux/ioport.h>
1466 ++#include <linux/cred.h>
1467 + #include <net/addrconf.h>
1468 +
1469 + #include <asm/page.h> /* for PAGE_SIZE */
1470 +@@ -930,11 +931,37 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
1471 + spec.field_width = 2 * sizeof(void *);
1472 + return string(buf, end, "pK-error", spec);
1473 + }
1474 +- if (!((kptr_restrict == 0) ||
1475 +- (kptr_restrict == 1 &&
1476 +- has_capability_noaudit(current, CAP_SYSLOG))))
1477 ++
1478 ++ switch (kptr_restrict) {
1479 ++ case 0:
1480 ++ /* Always print %pK values */
1481 ++ break;
1482 ++ case 1: {
1483 ++ /*
1484 ++ * Only print the real pointer value if the current
1485 ++ * process has CAP_SYSLOG and is running with the
1486 ++ * same credentials it started with. This is because
1487 ++ * access to files is checked at open() time, but %pK
1488 ++ * checks permission at read() time. We don't want to
1489 ++ * leak pointer values if a binary opens a file using
1490 ++ * %pK and then elevates privileges before reading it.
1491 ++ */
1492 ++ const struct cred *cred = current_cred();
1493 ++
1494 ++ if (!has_capability_noaudit(current, CAP_SYSLOG) ||
1495 ++ (cred->euid != cred->uid) ||
1496 ++ (cred->egid != cred->gid))
1497 ++ ptr = NULL;
1498 ++ break;
1499 ++ }
1500 ++ case 2:
1501 ++ default:
1502 ++ /* Always print 0's for %pK */
1503 + ptr = NULL;
1504 ++ break;
1505 ++ }
1506 + break;
1507 ++
1508 + case 'N':
1509 + switch (fmt[1]) {
1510 + case 'F':
1511 +diff --git a/security/selinux/netlabel.c b/security/selinux/netlabel.c
1512 +index da4b8b23..6235d052 100644
1513 +--- a/security/selinux/netlabel.c
1514 ++++ b/security/selinux/netlabel.c
1515 +@@ -442,8 +442,7 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr)
1516 + sksec->nlbl_state != NLBL_CONNLABELED)
1517 + return 0;
1518 +
1519 +- local_bh_disable();
1520 +- bh_lock_sock_nested(sk);
1521 ++ lock_sock(sk);
1522 +
1523 + /* connected sockets are allowed to disconnect when the address family
1524 + * is set to AF_UNSPEC, if that is what is happening we want to reset
1525 +@@ -464,7 +463,6 @@ int selinux_netlbl_socket_connect(struct sock *sk, struct sockaddr *addr)
1526 + sksec->nlbl_state = NLBL_CONNLABELED;
1527 +
1528 + socket_connect_return:
1529 +- bh_unlock_sock(sk);
1530 +- local_bh_enable();
1531 ++ release_sock(sk);
1532 + return rc;
1533 + }
1534 +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
1535 +index 810f1fc2..c32ae4d5 100644
1536 +--- a/sound/pci/hda/patch_realtek.c
1537 ++++ b/sound/pci/hda/patch_realtek.c
1538 +@@ -6969,6 +6969,7 @@ static int patch_alc662(struct hda_codec *codec)
1539 + case 0x10ec0272:
1540 + case 0x10ec0663:
1541 + case 0x10ec0665:
1542 ++ case 0x10ec0668:
1543 + set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
1544 + break;
1545 + case 0x10ec0273:
1546 +diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c
1547 +index 4dccf037..f59a961b 100644
1548 +--- a/sound/soc/blackfin/bf5xx-i2s.c
1549 ++++ b/sound/soc/blackfin/bf5xx-i2s.c
1550 +@@ -111,6 +111,7 @@ static int bf5xx_i2s_hw_params(struct snd_pcm_substream *substream,
1551 + bf5xx_i2s->tcr2 |= 7;
1552 + bf5xx_i2s->rcr2 |= 7;
1553 + sport_handle->wdsize = 1;
1554 ++ break;
1555 + case SNDRV_PCM_FORMAT_S16_LE:
1556 + bf5xx_i2s->tcr2 |= 15;
1557 + bf5xx_i2s->rcr2 |= 15;
1558 +diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
1559 +index b3e24f28..7e4245f1 100644
1560 +--- a/sound/soc/codecs/ak4642.c
1561 ++++ b/sound/soc/codecs/ak4642.c
1562 +@@ -262,7 +262,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream,
1563 + * This operation came from example code of
1564 + * "ASAHI KASEI AK4642" (japanese) manual p94.
1565 + */
1566 +- snd_soc_write(codec, SG_SL1, PMMP | MGAIN0);
1567 ++ snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0);
1568 + snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3));
1569 + snd_soc_write(codec, ALC_CTL1, ALC | LMTH0);
1570 + snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL);
1571 +diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
1572 +index e96c6ede..0b5132f7 100644
1573 +--- a/sound/soc/codecs/wm8962.c
1574 ++++ b/sound/soc/codecs/wm8962.c
1575 +@@ -3675,6 +3675,8 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
1576 + if (ret < 0)
1577 + goto err_regmap;
1578 +
1579 ++ regcache_cache_only(wm8962->regmap, true);
1580 ++
1581 + /* The drivers should power up as needed */
1582 + regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
1583 +
1584 +diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
1585 +index bdfbc1be..91a0a2f8 100644
1586 +--- a/virt/kvm/kvm_main.c
1587 ++++ b/virt/kvm/kvm_main.c
1588 +@@ -774,7 +774,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
1589 + /* destroy any largepage mappings for dirty tracking */
1590 + }
1591 +
1592 +- if (!npages) {
1593 ++ if (!npages || base_gfn != old.base_gfn) {
1594 + struct kvm_memory_slot *slot;
1595 +
1596 + r = -ENOMEM;
1597 +@@ -790,8 +790,10 @@ int __kvm_set_memory_region(struct kvm *kvm,
1598 + old_memslots = kvm->memslots;
1599 + rcu_assign_pointer(kvm->memslots, slots);
1600 + synchronize_srcu_expedited(&kvm->srcu);
1601 +- /* From this point no new shadow pages pointing to a deleted
1602 +- * memslot will be created.
1603 ++ /* slot was deleted or moved, clear iommu mapping */
1604 ++ kvm_iommu_unmap_pages(kvm, &old);
1605 ++ /* From this point no new shadow pages pointing to a deleted,
1606 ++ * or moved, memslot will be created.
1607 + *
1608 + * validation of sp->gfn happens in:
1609 + * - gfn_to_hva (kvm_read_guest, gfn_to_pfn)
1610 +@@ -805,20 +807,19 @@ int __kvm_set_memory_region(struct kvm *kvm,
1611 + if (r)
1612 + goto out_free;
1613 +
1614 +- /* map/unmap the pages in iommu page table */
1615 +- if (npages) {
1616 +- r = kvm_iommu_map_pages(kvm, &new);
1617 +- if (r)
1618 +- goto out_free;
1619 +- } else
1620 +- kvm_iommu_unmap_pages(kvm, &old);
1621 +-
1622 + r = -ENOMEM;
1623 + slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
1624 + GFP_KERNEL);
1625 + if (!slots)
1626 + goto out_free;
1627 +
1628 ++ /* map new memory slot into the iommu */
1629 ++ if (npages) {
1630 ++ r = kvm_iommu_map_pages(kvm, &new);
1631 ++ if (r)
1632 ++ goto out_slots;
1633 ++ }
1634 ++
1635 + /* actual memory is freed via old in kvm_free_physmem_slot below */
1636 + if (!npages) {
1637 + new.rmap = NULL;
1638 +@@ -845,6 +846,8 @@ int __kvm_set_memory_region(struct kvm *kvm,
1639 +
1640 + return 0;
1641 +
1642 ++out_slots:
1643 ++ kfree(slots);
1644 + out_free:
1645 + kvm_free_physmem_slot(&new, &old);
1646 + out: