/[linux-patches]/genpatches-2.6/tags/3.0-30/1032_linux-3.0.33.patch
Gentoo

Contents of /genpatches-2.6/tags/3.0-30/1032_linux-3.0.33.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2206 - (show annotations) (download)
Mon Sep 17 18:58:14 2012 UTC (2 years, 3 months ago) by mpagano
File size: 59292 byte(s)
3.0-30 release
1 diff --git a/Documentation/HOWTO b/Documentation/HOWTO
2 index f7ade3b..59c080f 100644
3 --- a/Documentation/HOWTO
4 +++ b/Documentation/HOWTO
5 @@ -218,16 +218,16 @@ The development process
6 Linux kernel development process currently consists of a few different
7 main kernel "branches" and lots of different subsystem-specific kernel
8 branches. These different branches are:
9 - - main 2.6.x kernel tree
10 - - 2.6.x.y -stable kernel tree
11 - - 2.6.x -git kernel patches
12 + - main 3.x kernel tree
13 + - 3.x.y -stable kernel tree
14 + - 3.x -git kernel patches
15 - subsystem specific kernel trees and patches
16 - - the 2.6.x -next kernel tree for integration tests
17 + - the 3.x -next kernel tree for integration tests
18
19 -2.6.x kernel tree
20 +3.x kernel tree
21 -----------------
22 -2.6.x kernels are maintained by Linus Torvalds, and can be found on
23 -kernel.org in the pub/linux/kernel/v2.6/ directory. Its development
24 +3.x kernels are maintained by Linus Torvalds, and can be found on
25 +kernel.org in the pub/linux/kernel/v3.x/ directory. Its development
26 process is as follows:
27 - As soon as a new kernel is released a two weeks window is open,
28 during this period of time maintainers can submit big diffs to
29 @@ -262,20 +262,20 @@ mailing list about kernel releases:
30 released according to perceived bug status, not according to a
31 preconceived timeline."
32
33 -2.6.x.y -stable kernel tree
34 +3.x.y -stable kernel tree
35 ---------------------------
36 -Kernels with 4-part versions are -stable kernels. They contain
37 +Kernels with 3-part versions are -stable kernels. They contain
38 relatively small and critical fixes for security problems or significant
39 -regressions discovered in a given 2.6.x kernel.
40 +regressions discovered in a given 3.x kernel.
41
42 This is the recommended branch for users who want the most recent stable
43 kernel and are not interested in helping test development/experimental
44 versions.
45
46 -If no 2.6.x.y kernel is available, then the highest numbered 2.6.x
47 +If no 3.x.y kernel is available, then the highest numbered 3.x
48 kernel is the current stable kernel.
49
50 -2.6.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
51 +3.x.y are maintained by the "stable" team <stable@vger.kernel.org>, and
52 are released as needs dictate. The normal release period is approximately
53 two weeks, but it can be longer if there are no pressing problems. A
54 security-related problem, instead, can cause a release to happen almost
55 @@ -285,7 +285,7 @@ The file Documentation/stable_kernel_rules.txt in the kernel tree
56 documents what kinds of changes are acceptable for the -stable tree, and
57 how the release process works.
58
59 -2.6.x -git patches
60 +3.x -git patches
61 ------------------
62 These are daily snapshots of Linus' kernel tree which are managed in a
63 git repository (hence the name.) These patches are usually released
64 @@ -317,13 +317,13 @@ revisions to it, and maintainers can mark patches as under review,
65 accepted, or rejected. Most of these patchwork sites are listed at
66 http://patchwork.kernel.org/.
67
68 -2.6.x -next kernel tree for integration tests
69 +3.x -next kernel tree for integration tests
70 ---------------------------------------------
71 -Before updates from subsystem trees are merged into the mainline 2.6.x
72 +Before updates from subsystem trees are merged into the mainline 3.x
73 tree, they need to be integration-tested. For this purpose, a special
74 testing repository exists into which virtually all subsystem trees are
75 pulled on an almost daily basis:
76 - http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git
77 + http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git
78 http://linux.f-seidel.de/linux-next/pmwiki/
79
80 This way, the -next kernel gives a summary outlook onto what will be
81 diff --git a/Makefile b/Makefile
82 index 16b9abf..c621c70 100644
83 --- a/Makefile
84 +++ b/Makefile
85 @@ -1,6 +1,6 @@
86 VERSION = 3
87 PATCHLEVEL = 0
88 -SUBLEVEL = 32
89 +SUBLEVEL = 33
90 EXTRAVERSION =
91 NAME = Sneaky Weasel
92
93 diff --git a/arch/arm/include/asm/cacheflush.h b/arch/arm/include/asm/cacheflush.h
94 index d5d8d5c..1252a26 100644
95 --- a/arch/arm/include/asm/cacheflush.h
96 +++ b/arch/arm/include/asm/cacheflush.h
97 @@ -249,7 +249,7 @@ extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr
98 * Harvard caches are synchronised for the user space address range.
99 * This is used for the ARM private sys_cacheflush system call.
100 */
101 -#define flush_cache_user_range(vma,start,end) \
102 +#define flush_cache_user_range(start,end) \
103 __cpuc_coherent_user_range((start) & PAGE_MASK, PAGE_ALIGN(end))
104
105 /*
106 diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
107 index 6807cb1..56b2715 100644
108 --- a/arch/arm/kernel/traps.c
109 +++ b/arch/arm/kernel/traps.c
110 @@ -451,7 +451,9 @@ do_cache_op(unsigned long start, unsigned long end, int flags)
111 if (end > vma->vm_end)
112 end = vma->vm_end;
113
114 - flush_cache_user_range(vma, start, end);
115 + up_read(&mm->mmap_sem);
116 + flush_cache_user_range(start, end);
117 + return;
118 }
119 up_read(&mm->mmap_sem);
120 }
121 diff --git a/arch/parisc/include/asm/prefetch.h b/arch/parisc/include/asm/prefetch.h
122 index c5edc60..1ee7c82 100644
123 --- a/arch/parisc/include/asm/prefetch.h
124 +++ b/arch/parisc/include/asm/prefetch.h
125 @@ -21,7 +21,12 @@
126 #define ARCH_HAS_PREFETCH
127 static inline void prefetch(const void *addr)
128 {
129 - __asm__("ldw 0(%0), %%r0" : : "r" (addr));
130 + __asm__(
131 +#ifndef CONFIG_PA20
132 + /* Need to avoid prefetch of NULL on PA7300LC */
133 + " extrw,u,= %0,31,32,%%r0\n"
134 +#endif
135 + " ldw 0(%0), %%r0" : : "r" (addr));
136 }
137
138 /* LDD is a PA2.0 addition. */
139 diff --git a/arch/parisc/kernel/entry.S b/arch/parisc/kernel/entry.S
140 index 6f05944..5350342 100644
141 --- a/arch/parisc/kernel/entry.S
142 +++ b/arch/parisc/kernel/entry.S
143 @@ -581,7 +581,11 @@
144 */
145 cmpiclr,= 0x01,\tmp,%r0
146 ldi (_PAGE_DIRTY|_PAGE_READ|_PAGE_WRITE),\prot
147 +#ifdef CONFIG_64BIT
148 depd,z \prot,8,7,\prot
149 +#else
150 + depw,z \prot,8,7,\prot
151 +#endif
152 /*
153 * OK, it is in the temp alias region, check whether "from" or "to".
154 * Check "subtle" note in pacache.S re: r23/r26.
155 diff --git a/arch/parisc/kernel/pacache.S b/arch/parisc/kernel/pacache.S
156 index 93ff3d9..5d7218a 100644
157 --- a/arch/parisc/kernel/pacache.S
158 +++ b/arch/parisc/kernel/pacache.S
159 @@ -692,7 +692,7 @@ ENTRY(flush_icache_page_asm)
160
161 /* Purge any old translation */
162
163 - pitlb (%sr0,%r28)
164 + pitlb (%sr4,%r28)
165
166 ldil L%icache_stride, %r1
167 ldw R%icache_stride(%r1), %r1
168 @@ -706,27 +706,29 @@ ENTRY(flush_icache_page_asm)
169 sub %r25, %r1, %r25
170
171
172 -1: fic,m %r1(%r28)
173 - fic,m %r1(%r28)
174 - fic,m %r1(%r28)
175 - fic,m %r1(%r28)
176 - fic,m %r1(%r28)
177 - fic,m %r1(%r28)
178 - fic,m %r1(%r28)
179 - fic,m %r1(%r28)
180 - fic,m %r1(%r28)
181 - fic,m %r1(%r28)
182 - fic,m %r1(%r28)
183 - fic,m %r1(%r28)
184 - fic,m %r1(%r28)
185 - fic,m %r1(%r28)
186 - fic,m %r1(%r28)
187 + /* fic only has the type 26 form on PA1.1, requiring an
188 + * explicit space specification, so use %sr4 */
189 +1: fic,m %r1(%sr4,%r28)
190 + fic,m %r1(%sr4,%r28)
191 + fic,m %r1(%sr4,%r28)
192 + fic,m %r1(%sr4,%r28)
193 + fic,m %r1(%sr4,%r28)
194 + fic,m %r1(%sr4,%r28)
195 + fic,m %r1(%sr4,%r28)
196 + fic,m %r1(%sr4,%r28)
197 + fic,m %r1(%sr4,%r28)
198 + fic,m %r1(%sr4,%r28)
199 + fic,m %r1(%sr4,%r28)
200 + fic,m %r1(%sr4,%r28)
201 + fic,m %r1(%sr4,%r28)
202 + fic,m %r1(%sr4,%r28)
203 + fic,m %r1(%sr4,%r28)
204 cmpb,COND(<<) %r28, %r25,1b
205 - fic,m %r1(%r28)
206 + fic,m %r1(%sr4,%r28)
207
208 sync
209 bv %r0(%r2)
210 - pitlb (%sr0,%r25)
211 + pitlb (%sr4,%r25)
212 .exit
213
214 .procend
215 diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
216 index d814f79..6903d44 100644
217 --- a/arch/s390/mm/fault.c
218 +++ b/arch/s390/mm/fault.c
219 @@ -567,6 +567,7 @@ static void pfault_interrupt(unsigned int ext_int_code,
220 tsk->thread.pfault_wait = 0;
221 list_del(&tsk->thread.list);
222 wake_up_process(tsk);
223 + put_task_struct(tsk);
224 } else {
225 /* Completion interrupt was faster than initial
226 * interrupt. Set pfault_wait to -1 so the initial
227 @@ -576,14 +577,22 @@ static void pfault_interrupt(unsigned int ext_int_code,
228 put_task_struct(tsk);
229 } else {
230 /* signal bit not set -> a real page is missing. */
231 - if (tsk->thread.pfault_wait == -1) {
232 + if (tsk->thread.pfault_wait == 1) {
233 + /* Already on the list with a reference: put to sleep */
234 + set_task_state(tsk, TASK_UNINTERRUPTIBLE);
235 + set_tsk_need_resched(tsk);
236 + } else if (tsk->thread.pfault_wait == -1) {
237 /* Completion interrupt was faster than the initial
238 * interrupt (pfault_wait == -1). Set pfault_wait
239 * back to zero and exit. */
240 tsk->thread.pfault_wait = 0;
241 } else {
242 /* Initial interrupt arrived before completion
243 - * interrupt. Let the task sleep. */
244 + * interrupt. Let the task sleep.
245 + * An extra task reference is needed since a different
246 + * cpu may set the task state to TASK_RUNNING again
247 + * before the scheduler is reached. */
248 + get_task_struct(tsk);
249 tsk->thread.pfault_wait = 1;
250 list_add(&tsk->thread.list, &pfault_list);
251 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
252 @@ -608,6 +617,7 @@ static int __cpuinit pfault_cpu_notify(struct notifier_block *self,
253 list_del(&thread->list);
254 tsk = container_of(thread, struct task_struct, thread);
255 wake_up_process(tsk);
256 + put_task_struct(tsk);
257 }
258 spin_unlock_irq(&pfault_lock);
259 break;
260 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
261 index 2e79419..9e70257 100644
262 --- a/arch/sparc/Kconfig
263 +++ b/arch/sparc/Kconfig
264 @@ -590,6 +590,9 @@ config SYSVIPC_COMPAT
265 depends on COMPAT && SYSVIPC
266 default y
267
268 +config KEYS_COMPAT
269 + def_bool y if COMPAT && KEYS
270 +
271 endmenu
272
273 source "net/Kconfig"
274 diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
275 index f566518..248fb67 100644
276 --- a/arch/sparc/kernel/systbls_64.S
277 +++ b/arch/sparc/kernel/systbls_64.S
278 @@ -74,7 +74,7 @@ sys_call_table32:
279 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
280 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
281 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
282 -/*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
283 +/*280*/ .word sys32_tee, sys_add_key, sys_request_key, compat_sys_keyctl, compat_sys_openat
284 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_fstatat64
285 /*290*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
286 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare
287 diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
288 index 0249b8b..532a2a4 100644
289 --- a/arch/tile/Kconfig
290 +++ b/arch/tile/Kconfig
291 @@ -11,6 +11,7 @@ config TILE
292 select GENERIC_IRQ_PROBE
293 select GENERIC_PENDING_IRQ if SMP
294 select GENERIC_IRQ_SHOW
295 + select HAVE_SYSCALL_WRAPPERS if TILEGX
296 select SYS_HYPERVISOR
297
298 # FIXME: investigate whether we need/want these options.
299 diff --git a/arch/tile/include/asm/bitops.h b/arch/tile/include/asm/bitops.h
300 index 16f1fa5..bd186c4 100644
301 --- a/arch/tile/include/asm/bitops.h
302 +++ b/arch/tile/include/asm/bitops.h
303 @@ -77,6 +77,11 @@ static inline int ffs(int x)
304 return __builtin_ffs(x);
305 }
306
307 +static inline int fls64(__u64 w)
308 +{
309 + return (sizeof(__u64) * 8) - __builtin_clzll(w);
310 +}
311 +
312 /**
313 * fls - find last set bit in word
314 * @x: the word to search
315 @@ -90,12 +95,7 @@ static inline int ffs(int x)
316 */
317 static inline int fls(int x)
318 {
319 - return (sizeof(int) * 8) - __builtin_clz(x);
320 -}
321 -
322 -static inline int fls64(__u64 w)
323 -{
324 - return (sizeof(__u64) * 8) - __builtin_clzll(w);
325 + return fls64((unsigned int) x);
326 }
327
328 static inline unsigned int __arch_hweight32(unsigned int w)
329 diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
330 index 41474fb..aa365c5 100644
331 --- a/arch/um/include/asm/pgtable.h
332 +++ b/arch/um/include/asm/pgtable.h
333 @@ -271,6 +271,12 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
334 }
335 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
336
337 +#define __HAVE_ARCH_PTE_SAME
338 +static inline int pte_same(pte_t pte_a, pte_t pte_b)
339 +{
340 + return !((pte_val(pte_a) ^ pte_val(pte_b)) & ~_PAGE_NEWPAGE);
341 +}
342 +
343 /*
344 * Conversion functions: convert a page and protection to a page entry,
345 * and a page entry and page directory to the page they refer to.
346 @@ -346,11 +352,11 @@ extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
347 #define update_mmu_cache(vma,address,ptep) do ; while (0)
348
349 /* Encode and de-code a swap entry */
350 -#define __swp_type(x) (((x).val >> 4) & 0x3f)
351 +#define __swp_type(x) (((x).val >> 5) & 0x1f)
352 #define __swp_offset(x) ((x).val >> 11)
353
354 #define __swp_entry(type, offset) \
355 - ((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
356 + ((swp_entry_t) { ((type) << 5) | ((offset) << 11) })
357 #define __pte_to_swp_entry(pte) \
358 ((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
359 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
360 diff --git a/arch/x86/kernel/cpu/mcheck/mce-severity.c b/arch/x86/kernel/cpu/mcheck/mce-severity.c
361 index 1e8d66c..362190b 100644
362 --- a/arch/x86/kernel/cpu/mcheck/mce-severity.c
363 +++ b/arch/x86/kernel/cpu/mcheck/mce-severity.c
364 @@ -101,15 +101,19 @@ static struct severity {
365 };
366
367 /*
368 - * If the EIPV bit is set, it means the saved IP is the
369 - * instruction which caused the MCE.
370 + * If mcgstatus indicated that ip/cs on the stack were
371 + * no good, then "m->cs" will be zero and we will have
372 + * to assume the worst case (IN_KERNEL) as we actually
373 + * have no idea what we were executing when the machine
374 + * check hit.
375 + * If we do have a good "m->cs" (or a faked one in the
376 + * case we were executing in VM86 mode) we can use it to
377 + * distinguish an exception taken in user from from one
378 + * taken in the kernel.
379 */
380 static int error_context(struct mce *m)
381 {
382 - if (m->mcgstatus & MCG_STATUS_EIPV)
383 - return (m->ip && (m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
384 - /* Unknown, assume kernel */
385 - return IN_KERNEL;
386 + return ((m->cs & 3) == 3) ? IN_USER : IN_KERNEL;
387 }
388
389 int mce_severity(struct mce *a, int tolerant, char **msg)
390 diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
391 index fe29c1d..4b50c96 100644
392 --- a/arch/x86/kernel/cpu/perf_event_amd.c
393 +++ b/arch/x86/kernel/cpu/perf_event_amd.c
394 @@ -437,6 +437,7 @@ static __initconst const struct x86_pmu amd_pmu = {
395 * 0x023 DE PERF_CTL[2:0]
396 * 0x02D LS PERF_CTL[3]
397 * 0x02E LS PERF_CTL[3,0]
398 + * 0x031 LS PERF_CTL[2:0] (**)
399 * 0x043 CU PERF_CTL[2:0]
400 * 0x045 CU PERF_CTL[2:0]
401 * 0x046 CU PERF_CTL[2:0]
402 @@ -450,10 +451,12 @@ static __initconst const struct x86_pmu amd_pmu = {
403 * 0x0DD LS PERF_CTL[5:0]
404 * 0x0DE LS PERF_CTL[5:0]
405 * 0x0DF LS PERF_CTL[5:0]
406 + * 0x1C0 EX PERF_CTL[5:3]
407 * 0x1D6 EX PERF_CTL[5:0]
408 * 0x1D8 EX PERF_CTL[5:0]
409 *
410 - * (*) depending on the umask all FPU counters may be used
411 + * (*) depending on the umask all FPU counters may be used
412 + * (**) only one unitmask enabled at a time
413 */
414
415 static struct event_constraint amd_f15_PMC0 = EVENT_CONSTRAINT(0, 0x01, 0);
416 @@ -503,6 +506,12 @@ amd_get_event_constraints_f15h(struct cpu_hw_events *cpuc, struct perf_event *ev
417 return &amd_f15_PMC3;
418 case 0x02E:
419 return &amd_f15_PMC30;
420 + case 0x031:
421 + if (hweight_long(hwc->config & ARCH_PERFMON_EVENTSEL_UMASK) <= 1)
422 + return &amd_f15_PMC20;
423 + return &emptyconstraint;
424 + case 0x1C0:
425 + return &amd_f15_PMC53;
426 default:
427 return &amd_f15_PMC50;
428 }
429 diff --git a/block/genhd.c b/block/genhd.c
430 index f6ecddb..d7f7d4e 100644
431 --- a/block/genhd.c
432 +++ b/block/genhd.c
433 @@ -744,7 +744,7 @@ void __init printk_all_partitions(void)
434 struct hd_struct *part;
435 char name_buf[BDEVNAME_SIZE];
436 char devt_buf[BDEVT_SIZE];
437 - u8 uuid[PARTITION_META_INFO_UUIDLTH * 2 + 1];
438 + char uuid_buf[PARTITION_META_INFO_UUIDLTH * 2 + 5];
439
440 /*
441 * Don't show empty devices or things that have been
442 @@ -763,14 +763,16 @@ void __init printk_all_partitions(void)
443 while ((part = disk_part_iter_next(&piter))) {
444 bool is_part0 = part == &disk->part0;
445
446 - uuid[0] = 0;
447 + uuid_buf[0] = '\0';
448 if (part->info)
449 - part_unpack_uuid(part->info->uuid, uuid);
450 + snprintf(uuid_buf, sizeof(uuid_buf), "%pU",
451 + part->info->uuid);
452
453 printk("%s%s %10llu %s %s", is_part0 ? "" : " ",
454 bdevt_str(part_devt(part), devt_buf),
455 (unsigned long long)part->nr_sects >> 1,
456 - disk_name(disk, part->partno, name_buf), uuid);
457 + disk_name(disk, part->partno, name_buf),
458 + uuid_buf);
459 if (is_part0) {
460 if (disk->driverfs_dev != NULL &&
461 disk->driverfs_dev->driver != NULL)
462 diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
463 index 1e9ab9b..abf2f4e 100644
464 --- a/drivers/ata/ahci.c
465 +++ b/drivers/ata/ahci.c
466 @@ -392,6 +392,8 @@ static const struct pci_device_id ahci_pci_tbl[] = {
467 .driver_data = board_ahci_yes_fbs }, /* 88se9128 */
468 { PCI_DEVICE(0x1b4b, 0x9125),
469 .driver_data = board_ahci_yes_fbs }, /* 88se9125 */
470 + { PCI_DEVICE(0x1b4b, 0x917a),
471 + .driver_data = board_ahci_yes_fbs }, /* 88se9172 */
472 { PCI_DEVICE(0x1b4b, 0x91a3),
473 .driver_data = board_ahci_yes_fbs },
474
475 diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
476 index 997db7f..d05f03c 100644
477 --- a/drivers/gpu/drm/i915/i915_irq.c
478 +++ b/drivers/gpu/drm/i915/i915_irq.c
479 @@ -422,14 +422,11 @@ static void gen6_pm_rps_work(struct work_struct *work)
480 mutex_unlock(&dev_priv->dev->struct_mutex);
481 }
482
483 -static void pch_irq_handler(struct drm_device *dev)
484 +static void pch_irq_handler(struct drm_device *dev, u32 pch_iir)
485 {
486 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
487 - u32 pch_iir;
488 int pipe;
489
490 - pch_iir = I915_READ(SDEIIR);
491 -
492 if (pch_iir & SDE_AUDIO_POWER_MASK)
493 DRM_DEBUG_DRIVER("PCH audio power change on port %d\n",
494 (pch_iir & SDE_AUDIO_POWER_MASK) >>
495 @@ -527,7 +524,7 @@ static irqreturn_t ivybridge_irq_handler(DRM_IRQ_ARGS)
496 if (de_iir & DE_PCH_EVENT_IVB) {
497 if (pch_iir & SDE_HOTPLUG_MASK_CPT)
498 queue_work(dev_priv->wq, &dev_priv->hotplug_work);
499 - pch_irq_handler(dev);
500 + pch_irq_handler(dev, pch_iir);
501 }
502
503 if (pm_iir & GEN6_PM_DEFERRED_EVENTS) {
504 @@ -626,7 +623,7 @@ static irqreturn_t ironlake_irq_handler(DRM_IRQ_ARGS)
505 if (de_iir & DE_PCH_EVENT) {
506 if (pch_iir & hotplug_mask)
507 queue_work(dev_priv->wq, &dev_priv->hotplug_work);
508 - pch_irq_handler(dev);
509 + pch_irq_handler(dev, pch_iir);
510 }
511
512 if (de_iir & DE_PCU_EVENT) {
513 diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
514 index b05c256..387b2b3 100644
515 --- a/drivers/gpu/drm/i915/i915_reg.h
516 +++ b/drivers/gpu/drm/i915/i915_reg.h
517 @@ -537,6 +537,21 @@
518
519 #define GEN6_BSD_RNCID 0x12198
520
521 +#define GEN7_FF_THREAD_MODE 0x20a0
522 +#define GEN7_FF_SCHED_MASK 0x0077070
523 +#define GEN7_FF_TS_SCHED_HS1 (0x5<<16)
524 +#define GEN7_FF_TS_SCHED_HS0 (0x3<<16)
525 +#define GEN7_FF_TS_SCHED_LOAD_BALANCE (0x1<<16)
526 +#define GEN7_FF_TS_SCHED_HW (0x0<<16) /* Default */
527 +#define GEN7_FF_VS_SCHED_HS1 (0x5<<12)
528 +#define GEN7_FF_VS_SCHED_HS0 (0x3<<12)
529 +#define GEN7_FF_VS_SCHED_LOAD_BALANCE (0x1<<12) /* Default */
530 +#define GEN7_FF_VS_SCHED_HW (0x0<<12)
531 +#define GEN7_FF_DS_SCHED_HS1 (0x5<<4)
532 +#define GEN7_FF_DS_SCHED_HS0 (0x3<<4)
533 +#define GEN7_FF_DS_SCHED_LOAD_BALANCE (0x1<<4) /* Default */
534 +#define GEN7_FF_DS_SCHED_HW (0x0<<4)
535 +
536 /*
537 * Framebuffer compression (915+ only)
538 */
539 diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
540 index f150a15..4b8e235 100644
541 --- a/drivers/gpu/drm/i915/intel_display.c
542 +++ b/drivers/gpu/drm/i915/intel_display.c
543 @@ -6579,10 +6579,11 @@ static void intel_sanitize_modesetting(struct drm_device *dev,
544 {
545 struct drm_i915_private *dev_priv = dev->dev_private;
546 u32 reg, val;
547 + int i;
548
549 /* Clear any frame start delays used for debugging left by the BIOS */
550 - for_each_pipe(pipe) {
551 - reg = PIPECONF(pipe);
552 + for_each_pipe(i) {
553 + reg = PIPECONF(i);
554 I915_WRITE(reg, I915_READ(reg) & ~PIPECONF_FRAME_START_DELAY_MASK);
555 }
556
557 @@ -7451,6 +7452,18 @@ static void gen6_init_clock_gating(struct drm_device *dev)
558 DISPPLANE_TRICKLE_FEED_DISABLE);
559 }
560
561 +static void gen7_setup_fixed_func_scheduler(struct drm_i915_private *dev_priv)
562 +{
563 + uint32_t reg = I915_READ(GEN7_FF_THREAD_MODE);
564 +
565 + reg &= ~GEN7_FF_SCHED_MASK;
566 + reg |= GEN7_FF_TS_SCHED_HW;
567 + reg |= GEN7_FF_VS_SCHED_HW;
568 + reg |= GEN7_FF_DS_SCHED_HW;
569 +
570 + I915_WRITE(GEN7_FF_THREAD_MODE, reg);
571 +}
572 +
573 static void ivybridge_init_clock_gating(struct drm_device *dev)
574 {
575 struct drm_i915_private *dev_priv = dev->dev_private;
576 @@ -7597,6 +7610,8 @@ static void ironlake_teardown_rc6(struct drm_device *dev)
577 drm_gem_object_unreference(&dev_priv->pwrctx->base);
578 dev_priv->pwrctx = NULL;
579 }
580 +
581 + gen7_setup_fixed_func_scheduler(dev_priv);
582 }
583
584 static void ironlake_disable_rc6(struct drm_device *dev)
585 diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
586 index 2ad49cb..5fb98de 100644
587 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c
588 +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
589 @@ -1075,7 +1075,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
590
591 nvbo->placement.fpfn = 0;
592 nvbo->placement.lpfn = dev_priv->fb_mappable_pages;
593 - nouveau_bo_placement_set(nvbo, TTM_PL_VRAM, 0);
594 + nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
595 return nouveau_bo_validate(nvbo, false, true, false);
596 }
597
598 diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c
599 index a76d85f..79b4bcb 100644
600 --- a/drivers/i2c/busses/i2c-davinci.c
601 +++ b/drivers/i2c/busses/i2c-davinci.c
602 @@ -755,7 +755,7 @@ static int davinci_i2c_remove(struct platform_device *pdev)
603 dev->clk = NULL;
604
605 davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, 0);
606 - free_irq(IRQ_I2C, dev);
607 + free_irq(dev->irq, dev);
608 iounmap(dev->base);
609 kfree(dev);
610
611 diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
612 index daa93e9..267005d 100644
613 --- a/drivers/infiniband/hw/cxgb4/cm.c
614 +++ b/drivers/infiniband/hw/cxgb4/cm.c
615 @@ -2316,6 +2316,12 @@ static int peer_abort_intr(struct c4iw_dev *dev, struct sk_buff *skb)
616 unsigned int tid = GET_TID(req);
617
618 ep = lookup_tid(t, tid);
619 + if (!ep) {
620 + printk(KERN_WARNING MOD
621 + "Abort on non-existent endpoint, tid %d\n", tid);
622 + kfree_skb(skb);
623 + return 0;
624 + }
625 if (is_neg_adv_abort(req->status)) {
626 PDBG("%s neg_adv_abort ep %p tid %u\n", __func__, ep,
627 ep->hwtid);
628 diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
629 index 658e75f..d1dde65 100644
630 --- a/drivers/isdn/gigaset/capi.c
631 +++ b/drivers/isdn/gigaset/capi.c
632 @@ -14,6 +14,7 @@
633 #include "gigaset.h"
634 #include <linux/proc_fs.h>
635 #include <linux/seq_file.h>
636 +#include <linux/ratelimit.h>
637 #include <linux/isdn/capilli.h>
638 #include <linux/isdn/capicmd.h>
639 #include <linux/isdn/capiutil.h>
640 @@ -222,10 +223,14 @@ get_appl(struct gigaset_capi_ctr *iif, u16 appl)
641 static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p)
642 {
643 #ifdef CONFIG_GIGASET_DEBUG
644 + /* dump at most 20 messages in 20 secs */
645 + static DEFINE_RATELIMIT_STATE(msg_dump_ratelimit, 20 * HZ, 20);
646 _cdebbuf *cdb;
647
648 if (!(gigaset_debuglevel & level))
649 return;
650 + if (!___ratelimit(&msg_dump_ratelimit, tag))
651 + return;
652
653 cdb = capi_cmsg2str(p);
654 if (cdb) {
655 @@ -2058,12 +2063,6 @@ static void do_reset_b3_req(struct gigaset_capi_ctr *iif,
656 }
657
658 /*
659 - * dump unsupported/ignored messages at most twice per minute,
660 - * some apps send those very frequently
661 - */
662 -static unsigned long ignored_msg_dump_time;
663 -
664 -/*
665 * unsupported CAPI message handler
666 */
667 static void do_unsupported(struct gigaset_capi_ctr *iif,
668 @@ -2072,8 +2071,7 @@ static void do_unsupported(struct gigaset_capi_ctr *iif,
669 {
670 /* decode message */
671 capi_message2cmsg(&iif->acmsg, skb->data);
672 - if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000))
673 - dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
674 + dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
675 send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState);
676 }
677
678 @@ -2084,11 +2082,9 @@ static void do_nothing(struct gigaset_capi_ctr *iif,
679 struct gigaset_capi_appl *ap,
680 struct sk_buff *skb)
681 {
682 - if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) {
683 - /* decode message */
684 - capi_message2cmsg(&iif->acmsg, skb->data);
685 - dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
686 - }
687 + /* decode message */
688 + capi_message2cmsg(&iif->acmsg, skb->data);
689 + dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
690 dev_kfree_skb_any(skb);
691 }
692
693 diff --git a/drivers/md/md.c b/drivers/md/md.c
694 index a2b3f21..8b04a02 100644
695 --- a/drivers/md/md.c
696 +++ b/drivers/md/md.c
697 @@ -409,7 +409,7 @@ static void submit_flushes(struct work_struct *ws)
698 atomic_inc(&rdev->nr_pending);
699 atomic_inc(&rdev->nr_pending);
700 rcu_read_unlock();
701 - bi = bio_alloc_mddev(GFP_KERNEL, 0, mddev);
702 + bi = bio_alloc_mddev(GFP_NOIO, 0, mddev);
703 bi->bi_end_io = md_end_flush;
704 bi->bi_private = rdev;
705 bi->bi_bdev = rdev->bdev;
706 diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
707 index 0c8164a..d755407 100644
708 --- a/drivers/media/dvb/siano/smsusb.c
709 +++ b/drivers/media/dvb/siano/smsusb.c
710 @@ -541,6 +541,8 @@ static const struct usb_device_id smsusb_id_table[] __devinitconst = {
711 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
712 { USB_DEVICE(0x2040, 0xc090),
713 .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
714 + { USB_DEVICE(0x2040, 0xc0a0),
715 + .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
716 { } /* Terminating entry */
717 };
718
719 diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
720 index dbefdb0..5afdbb7 100644
721 --- a/drivers/media/video/uvc/uvc_v4l2.c
722 +++ b/drivers/media/video/uvc/uvc_v4l2.c
723 @@ -710,7 +710,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
724 break;
725 }
726 pin = iterm->id;
727 - } else if (pin < selector->bNrInPins) {
728 + } else if (index < selector->bNrInPins) {
729 pin = selector->baSourceID[index];
730 list_for_each_entry(iterm, &chain->entities, chain) {
731 if (!UVC_ENTITY_IS_ITERM(iterm))
732 diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
733 index ac492ac..9b18b54 100644
734 --- a/drivers/mmc/core/sdio.c
735 +++ b/drivers/mmc/core/sdio.c
736 @@ -665,7 +665,7 @@ static int mmc_sdio_resume(struct mmc_host *host)
737 }
738
739 if (!err && host->sdio_irqs)
740 - mmc_signal_sdio_irq(host);
741 + wake_up_process(host->sdio_irq_thread);
742 mmc_release_host(host);
743
744 /*
745 diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c
746 index 03ead02..d58ae91 100644
747 --- a/drivers/mmc/core/sdio_irq.c
748 +++ b/drivers/mmc/core/sdio_irq.c
749 @@ -27,18 +27,20 @@
750
751 #include "sdio_ops.h"
752
753 -static int process_sdio_pending_irqs(struct mmc_card *card)
754 +static int process_sdio_pending_irqs(struct mmc_host *host)
755 {
756 + struct mmc_card *card = host->card;
757 int i, ret, count;
758 unsigned char pending;
759 struct sdio_func *func;
760
761 /*
762 * Optimization, if there is only 1 function interrupt registered
763 - * call irq handler directly
764 + * and we know an IRQ was signaled then call irq handler directly.
765 + * Otherwise do the full probe.
766 */
767 func = card->sdio_single_irq;
768 - if (func) {
769 + if (func && host->sdio_irq_pending) {
770 func->irq_handler(func);
771 return 1;
772 }
773 @@ -115,7 +117,8 @@ static int sdio_irq_thread(void *_host)
774 ret = __mmc_claim_host(host, &host->sdio_irq_thread_abort);
775 if (ret)
776 break;
777 - ret = process_sdio_pending_irqs(host->card);
778 + ret = process_sdio_pending_irqs(host);
779 + host->sdio_irq_pending = false;
780 mmc_release_host(host);
781
782 /*
783 diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c
784 index ed3d6cd..0e34d56 100644
785 --- a/drivers/mtd/sm_ftl.c
786 +++ b/drivers/mtd/sm_ftl.c
787 @@ -1256,7 +1256,7 @@ static void sm_remove_dev(struct mtd_blktrans_dev *dev)
788
789 static struct mtd_blktrans_ops sm_ftl_ops = {
790 .name = "smblk",
791 - .major = -1,
792 + .major = 0,
793 .part_bits = SM_FTL_PARTN_BITS,
794 .blksize = SM_SECTOR_SIZE,
795 .getgeo = sm_getgeo,
796 diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
797 index e86edfc..1e80a48 100644
798 --- a/drivers/rtc/rtc-pl031.c
799 +++ b/drivers/rtc/rtc-pl031.c
800 @@ -312,6 +312,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
801 int ret;
802 struct pl031_local *ldata;
803 struct rtc_class_ops *ops = id->data;
804 + unsigned long time;
805
806 ret = amba_request_regions(adev, NULL);
807 if (ret)
808 @@ -343,6 +344,23 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
809 writel(readl(ldata->base + RTC_CR) | RTC_CR_CWEN,
810 ldata->base + RTC_CR);
811
812 + /*
813 + * On ST PL031 variants, the RTC reset value does not provide correct
814 + * weekday for 2000-01-01. Correct the erroneous sunday to saturday.
815 + */
816 + if (ldata->hw_designer == AMBA_VENDOR_ST) {
817 + if (readl(ldata->base + RTC_YDR) == 0x2000) {
818 + time = readl(ldata->base + RTC_DR);
819 + if ((time &
820 + (RTC_MON_MASK | RTC_MDAY_MASK | RTC_WDAY_MASK))
821 + == 0x02120000) {
822 + time = time | (0x7 << RTC_WDAY_SHIFT);
823 + writel(0x2000, ldata->base + RTC_YLR);
824 + writel(time, ldata->base + RTC_LR);
825 + }
826 + }
827 + }
828 +
829 ldata->rtc = rtc_device_register("pl031", &adev->dev, ops,
830 THIS_MODULE);
831 if (IS_ERR(ldata->rtc)) {
832 diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
833 index 168e67f..58f99f4 100644
834 --- a/drivers/scsi/hpsa.c
835 +++ b/drivers/scsi/hpsa.c
836 @@ -1654,30 +1654,26 @@ static void figure_bus_target_lun(struct ctlr_info *h,
837
838 if (is_logical_dev_addr_mode(lunaddrbytes)) {
839 /* logical device */
840 - if (unlikely(is_scsi_rev_5(h))) {
841 - /* p1210m, logical drives lun assignments
842 - * match SCSI REPORT LUNS data.
843 + lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
844 + if (is_msa2xxx(h, device)) {
845 + /* msa2xxx way, put logicals on bus 1
846 + * and match target/lun numbers box
847 + * reports.
848 */
849 - lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
850 - *bus = 0;
851 - *target = 0;
852 - *lun = (lunid & 0x3fff) + 1;
853 + *bus = 1;
854 + *target = (lunid >> 16) & 0x3fff;
855 + *lun = lunid & 0x00ff;
856 } else {
857 - /* not p1210m... */
858 - lunid = le32_to_cpu(*((__le32 *) lunaddrbytes));
859 - if (is_msa2xxx(h, device)) {
860 - /* msa2xxx way, put logicals on bus 1
861 - * and match target/lun numbers box
862 - * reports.
863 - */
864 - *bus = 1;
865 - *target = (lunid >> 16) & 0x3fff;
866 - *lun = lunid & 0x00ff;
867 + if (likely(is_scsi_rev_5(h))) {
868 + /* All current smart arrays (circa 2011) */
869 + *bus = 0;
870 + *target = 0;
871 + *lun = (lunid & 0x3fff) + 1;
872 } else {
873 - /* Traditional smart array way. */
874 + /* Traditional old smart array way. */
875 *bus = 0;
876 - *lun = 0;
877 *target = lunid & 0x3fff;
878 + *lun = 0;
879 }
880 }
881 } else {
882 diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c
883 index 61e0d09..71b57ec 100644
884 --- a/drivers/scsi/isci/init.c
885 +++ b/drivers/scsi/isci/init.c
886 @@ -454,7 +454,7 @@ static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_devic
887 if (!orom)
888 orom = isci_request_oprom(pdev);
889
890 - for (i = 0; orom && i < ARRAY_SIZE(orom->ctrl); i++) {
891 + for (i = 0; orom && i < num_controllers(pdev); i++) {
892 if (sci_oem_parameters_validate(&orom->ctrl[i])) {
893 dev_warn(&pdev->dev,
894 "[%d]: invalid oem parameters detected, falling back to firmware\n", i);
895 diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
896 index 10f16a3..e10639b 100644
897 --- a/drivers/scsi/mpt2sas/mpt2sas_base.c
898 +++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
899 @@ -3056,7 +3056,7 @@ _base_get_port_facts(struct MPT2SAS_ADAPTER *ioc, int port, int sleep_flag)
900 }
901
902 pfacts = &ioc->pfacts[port];
903 - memset(pfacts, 0, sizeof(Mpi2PortFactsReply_t));
904 + memset(pfacts, 0, sizeof(struct mpt2sas_port_facts));
905 pfacts->PortNumber = mpi_reply.PortNumber;
906 pfacts->VP_ID = mpi_reply.VP_ID;
907 pfacts->VF_ID = mpi_reply.VF_ID;
908 @@ -3098,7 +3098,7 @@ _base_get_ioc_facts(struct MPT2SAS_ADAPTER *ioc, int sleep_flag)
909 }
910
911 facts = &ioc->facts;
912 - memset(facts, 0, sizeof(Mpi2IOCFactsReply_t));
913 + memset(facts, 0, sizeof(struct mpt2sas_facts));
914 facts->MsgVersion = le16_to_cpu(mpi_reply.MsgVersion);
915 facts->HeaderVersion = le16_to_cpu(mpi_reply.HeaderVersion);
916 facts->VP_ID = mpi_reply.VP_ID;
917 @@ -3779,7 +3779,7 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
918 goto out_free_resources;
919
920 ioc->pfacts = kcalloc(ioc->facts.NumberOfPorts,
921 - sizeof(Mpi2PortFactsReply_t), GFP_KERNEL);
922 + sizeof(struct mpt2sas_port_facts), GFP_KERNEL);
923 if (!ioc->pfacts) {
924 r = -ENOMEM;
925 goto out_free_resources;
926 diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
927 index 63e50f7..ea8d109 100644
928 --- a/drivers/staging/comedi/comedi_fops.c
929 +++ b/drivers/staging/comedi/comedi_fops.c
930 @@ -280,7 +280,7 @@ static int do_devconfig_ioctl(struct comedi_device *dev,
931 if (ret == 0) {
932 if (!try_module_get(dev->driver->module)) {
933 comedi_device_detach(dev);
934 - return -ENOSYS;
935 + ret = -ENOSYS;
936 }
937 }
938
939 diff --git a/drivers/tty/serial/mxs-auart.c b/drivers/tty/serial/mxs-auart.c
940 index 7e02c9c..5b3d063 100644
941 --- a/drivers/tty/serial/mxs-auart.c
942 +++ b/drivers/tty/serial/mxs-auart.c
943 @@ -368,6 +368,8 @@ static void mxs_auart_settermios(struct uart_port *u,
944
945 writel(ctrl, u->membase + AUART_LINECTRL);
946 writel(ctrl2, u->membase + AUART_CTRL2);
947 +
948 + uart_update_timeout(u, termios->c_cflag, baud);
949 }
950
951 static irqreturn_t mxs_auart_irq_handle(int irq, void *context)
952 diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
953 index 6bc20d7..de5e33f 100644
954 --- a/drivers/tty/serial/serial_core.c
955 +++ b/drivers/tty/serial/serial_core.c
956 @@ -2325,6 +2325,7 @@ void uart_unregister_driver(struct uart_driver *drv)
957 tty_unregister_driver(p);
958 put_tty_driver(p);
959 kfree(drv->state);
960 + drv->state = NULL;
961 drv->tty_driver = NULL;
962 }
963
964 diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
965 index 00b7bf9..5a244cf 100644
966 --- a/drivers/usb/class/cdc-wdm.c
967 +++ b/drivers/usb/class/cdc-wdm.c
968 @@ -511,7 +511,7 @@ static unsigned int wdm_poll(struct file *file, struct poll_table_struct *wait)
969
970 spin_lock_irqsave(&desc->iuspin, flags);
971 if (test_bit(WDM_DISCONNECTING, &desc->flags)) {
972 - mask = POLLERR;
973 + mask = POLLHUP | POLLERR;
974 spin_unlock_irqrestore(&desc->iuspin, flags);
975 goto desc_out;
976 }
977 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
978 index 0ca54e2..ca3c303 100644
979 --- a/drivers/usb/core/devio.c
980 +++ b/drivers/usb/core/devio.c
981 @@ -292,17 +292,14 @@ static struct async *async_getcompleted(struct dev_state *ps)
982 static struct async *async_getpending(struct dev_state *ps,
983 void __user *userurb)
984 {
985 - unsigned long flags;
986 struct async *as;
987
988 - spin_lock_irqsave(&ps->lock, flags);
989 list_for_each_entry(as, &ps->async_pending, asynclist)
990 if (as->userurb == userurb) {
991 list_del_init(&as->asynclist);
992 - spin_unlock_irqrestore(&ps->lock, flags);
993 return as;
994 }
995 - spin_unlock_irqrestore(&ps->lock, flags);
996 +
997 return NULL;
998 }
999
1000 @@ -357,6 +354,7 @@ static void cancel_bulk_urbs(struct dev_state *ps, unsigned bulk_addr)
1001 __releases(ps->lock)
1002 __acquires(ps->lock)
1003 {
1004 + struct urb *urb;
1005 struct async *as;
1006
1007 /* Mark all the pending URBs that match bulk_addr, up to but not
1008 @@ -379,8 +377,11 @@ __acquires(ps->lock)
1009 list_for_each_entry(as, &ps->async_pending, asynclist) {
1010 if (as->bulk_status == AS_UNLINK) {
1011 as->bulk_status = 0; /* Only once */
1012 + urb = as->urb;
1013 + usb_get_urb(urb);
1014 spin_unlock(&ps->lock); /* Allow completions */
1015 - usb_unlink_urb(as->urb);
1016 + usb_unlink_urb(urb);
1017 + usb_put_urb(urb);
1018 spin_lock(&ps->lock);
1019 goto rescan;
1020 }
1021 @@ -433,6 +434,7 @@ static void async_completed(struct urb *urb)
1022
1023 static void destroy_async(struct dev_state *ps, struct list_head *list)
1024 {
1025 + struct urb *urb;
1026 struct async *as;
1027 unsigned long flags;
1028
1029 @@ -440,10 +442,13 @@ static void destroy_async(struct dev_state *ps, struct list_head *list)
1030 while (!list_empty(list)) {
1031 as = list_entry(list->next, struct async, asynclist);
1032 list_del_init(&as->asynclist);
1033 + urb = as->urb;
1034 + usb_get_urb(urb);
1035
1036 /* drop the spinlock so the completion handler can run */
1037 spin_unlock_irqrestore(&ps->lock, flags);
1038 - usb_kill_urb(as->urb);
1039 + usb_kill_urb(urb);
1040 + usb_put_urb(urb);
1041 spin_lock_irqsave(&ps->lock, flags);
1042 }
1043 spin_unlock_irqrestore(&ps->lock, flags);
1044 @@ -1352,12 +1357,24 @@ static int proc_submiturb(struct dev_state *ps, void __user *arg)
1045
1046 static int proc_unlinkurb(struct dev_state *ps, void __user *arg)
1047 {
1048 + struct urb *urb;
1049 struct async *as;
1050 + unsigned long flags;
1051
1052 + spin_lock_irqsave(&ps->lock, flags);
1053 as = async_getpending(ps, arg);
1054 - if (!as)
1055 + if (!as) {
1056 + spin_unlock_irqrestore(&ps->lock, flags);
1057 return -EINVAL;
1058 - usb_kill_urb(as->urb);
1059 + }
1060 +
1061 + urb = as->urb;
1062 + usb_get_urb(urb);
1063 + spin_unlock_irqrestore(&ps->lock, flags);
1064 +
1065 + usb_kill_urb(urb);
1066 + usb_put_urb(urb);
1067 +
1068 return 0;
1069 }
1070
1071 diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
1072 index 4c65eb6..32d3adc 100644
1073 --- a/drivers/usb/core/quirks.c
1074 +++ b/drivers/usb/core/quirks.c
1075 @@ -123,6 +123,9 @@ static const struct usb_device_id usb_quirk_list[] = {
1076 /* Guillemot Webcam Hercules Dualpix Exchange*/
1077 { USB_DEVICE(0x06f8, 0x3005), .driver_info = USB_QUIRK_RESET_RESUME },
1078
1079 + /* Midiman M-Audio Keystation 88es */
1080 + { USB_DEVICE(0x0763, 0x0192), .driver_info = USB_QUIRK_RESET_RESUME },
1081 +
1082 /* M-Systems Flash Disk Pioneers */
1083 { USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
1084
1085 diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
1086 index 5308381..44d789d 100644
1087 --- a/drivers/usb/gadget/fsl_udc_core.c
1088 +++ b/drivers/usb/gadget/fsl_udc_core.c
1089 @@ -717,6 +717,8 @@ static void fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
1090 lastreq = list_entry(ep->queue.prev, struct fsl_req, queue);
1091 lastreq->tail->next_td_ptr =
1092 cpu_to_hc32(req->head->td_dma & DTD_ADDR_MASK);
1093 + /* Ensure dTD's next dtd pointer to be updated */
1094 + wmb();
1095 /* Read prime bit, if 1 goto done */
1096 if (fsl_readl(&dr_regs->endpointprime) & bitmask)
1097 goto out;
1098 diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
1099 index 3940d28..efb9efc 100644
1100 --- a/drivers/usb/host/ehci-pci.c
1101 +++ b/drivers/usb/host/ehci-pci.c
1102 @@ -365,7 +365,9 @@ static bool usb_is_intel_switchable_ehci(struct pci_dev *pdev)
1103 {
1104 return pdev->class == PCI_CLASS_SERIAL_USB_EHCI &&
1105 pdev->vendor == PCI_VENDOR_ID_INTEL &&
1106 - pdev->device == 0x1E26;
1107 + (pdev->device == 0x1E26 ||
1108 + pdev->device == 0x8C2D ||
1109 + pdev->device == 0x8C26);
1110 }
1111
1112 static void ehci_enable_xhci_companion(void)
1113 diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
1114 index 7fec8bd..0757b19 100644
1115 --- a/drivers/usb/host/pci-quirks.c
1116 +++ b/drivers/usb/host/pci-quirks.c
1117 @@ -711,12 +711,28 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,
1118 return -ETIMEDOUT;
1119 }
1120
1121 -bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
1122 +#define PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI 0x8C31
1123 +
1124 +bool usb_is_intel_ppt_switchable_xhci(struct pci_dev *pdev)
1125 {
1126 return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
1127 pdev->vendor == PCI_VENDOR_ID_INTEL &&
1128 pdev->device == PCI_DEVICE_ID_INTEL_PANTHERPOINT_XHCI;
1129 }
1130 +
1131 +/* The Intel Lynx Point chipset also has switchable ports. */
1132 +bool usb_is_intel_lpt_switchable_xhci(struct pci_dev *pdev)
1133 +{
1134 + return pdev->class == PCI_CLASS_SERIAL_USB_XHCI &&
1135 + pdev->vendor == PCI_VENDOR_ID_INTEL &&
1136 + pdev->device == PCI_DEVICE_ID_INTEL_LYNX_POINT_XHCI;
1137 +}
1138 +
1139 +bool usb_is_intel_switchable_xhci(struct pci_dev *pdev)
1140 +{
1141 + return usb_is_intel_ppt_switchable_xhci(pdev) ||
1142 + usb_is_intel_lpt_switchable_xhci(pdev);
1143 +}
1144 EXPORT_SYMBOL_GPL(usb_is_intel_switchable_xhci);
1145
1146 /*
1147 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
1148 index a4468d9..b455f4c 100644
1149 --- a/drivers/usb/host/xhci-mem.c
1150 +++ b/drivers/usb/host/xhci-mem.c
1151 @@ -1520,6 +1520,7 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
1152 xhci->event_ring = NULL;
1153 xhci_dbg(xhci, "Freed event ring\n");
1154
1155 + xhci->cmd_ring_reserved_trbs = 0;
1156 if (xhci->cmd_ring)
1157 xhci_ring_free(xhci, xhci->cmd_ring);
1158 xhci->cmd_ring = NULL;
1159 diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
1160 index 4509f69..39e230f 100644
1161 --- a/drivers/usb/host/xhci-pci.c
1162 +++ b/drivers/usb/host/xhci-pci.c
1163 @@ -123,6 +123,7 @@ static int xhci_pci_setup(struct usb_hcd *hcd)
1164 xhci_dbg(xhci, "QUIRK: Fresco Logic revision %u "
1165 "has broken MSI implementation\n",
1166 pdev->revision);
1167 + xhci->quirks |= XHCI_TRUST_TX_LENGTH;
1168 }
1169
1170 if (pdev->vendor == PCI_VENDOR_ID_NEC)
1171 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
1172 index c42fdff..de3c151 100644
1173 --- a/drivers/usb/host/xhci-ring.c
1174 +++ b/drivers/usb/host/xhci-ring.c
1175 @@ -1739,8 +1739,12 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1176 /* handle completion code */
1177 switch (trb_comp_code) {
1178 case COMP_SUCCESS:
1179 - frame->status = 0;
1180 - break;
1181 + if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0) {
1182 + frame->status = 0;
1183 + break;
1184 + }
1185 + if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
1186 + trb_comp_code = COMP_SHORT_TX;
1187 case COMP_SHORT_TX:
1188 frame->status = td->urb->transfer_flags & URB_SHORT_NOT_OK ?
1189 -EREMOTEIO : 0;
1190 @@ -1756,6 +1760,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
1191 break;
1192 case COMP_DEV_ERR:
1193 case COMP_STALL:
1194 + case COMP_TX_ERR:
1195 frame->status = -EPROTO;
1196 skip_td = true;
1197 break;
1198 @@ -1838,13 +1843,16 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
1199 switch (trb_comp_code) {
1200 case COMP_SUCCESS:
1201 /* Double check that the HW transferred everything. */
1202 - if (event_trb != td->last_trb) {
1203 + if (event_trb != td->last_trb ||
1204 + TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {
1205 xhci_warn(xhci, "WARN Successful completion "
1206 "on short TX\n");
1207 if (td->urb->transfer_flags & URB_SHORT_NOT_OK)
1208 *status = -EREMOTEIO;
1209 else
1210 *status = 0;
1211 + if ((xhci->quirks & XHCI_TRUST_TX_LENGTH))
1212 + trb_comp_code = COMP_SHORT_TX;
1213 } else {
1214 *status = 0;
1215 }
1216 @@ -1985,6 +1993,13 @@ static int handle_tx_event(struct xhci_hcd *xhci,
1217 * transfer type
1218 */
1219 case COMP_SUCCESS:
1220 + if (TRB_LEN(le32_to_cpu(event->transfer_len)) == 0)
1221 + break;
1222 + if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
1223 + trb_comp_code = COMP_SHORT_TX;
1224 + else
1225 + xhci_warn(xhci, "WARN Successful completion on short TX: "
1226 + "needs XHCI_TRUST_TX_LENGTH quirk?\n");
1227 case COMP_SHORT_TX:
1228 break;
1229 case COMP_STOP:
1230 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1231 index dfd260a..25c3e26 100644
1232 --- a/drivers/usb/host/xhci.h
1233 +++ b/drivers/usb/host/xhci.h
1234 @@ -1315,6 +1315,7 @@ struct xhci_hcd {
1235 #define XHCI_BROKEN_MSI (1 << 6)
1236 #define XHCI_RESET_ON_RESUME (1 << 7)
1237 #define XHCI_AMD_0x96_HOST (1 << 9)
1238 +#define XHCI_TRUST_TX_LENGTH (1 << 10)
1239 unsigned int num_active_eps;
1240 unsigned int limit_active_eps;
1241 /* There are two roothubs to keep track of bus suspend info for */
1242 diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c
1243 index bb10846..5707f56 100644
1244 --- a/drivers/usb/misc/usbtest.c
1245 +++ b/drivers/usb/misc/usbtest.c
1246 @@ -1023,7 +1023,10 @@ test_ctrl_queue(struct usbtest_dev *dev, struct usbtest_param *param)
1247 case 13: /* short read, resembling case 10 */
1248 req.wValue = cpu_to_le16((USB_DT_CONFIG << 8) | 0);
1249 /* last data packet "should" be DATA1, not DATA0 */
1250 - len = 1024 - udev->descriptor.bMaxPacketSize0;
1251 + if (udev->speed == USB_SPEED_SUPER)
1252 + len = 1024 - 512;
1253 + else
1254 + len = 1024 - udev->descriptor.bMaxPacketSize0;
1255 expected = -EREMOTEIO;
1256 break;
1257 case 14: /* short read; try to fill the last packet */
1258 @@ -1382,11 +1385,15 @@ static int test_halt(struct usbtest_dev *tdev, int ep, struct urb *urb)
1259
1260 static int halt_simple(struct usbtest_dev *dev)
1261 {
1262 - int ep;
1263 - int retval = 0;
1264 - struct urb *urb;
1265 + int ep;
1266 + int retval = 0;
1267 + struct urb *urb;
1268 + struct usb_device *udev = testdev_to_usbdev(dev);
1269
1270 - urb = simple_alloc_urb(testdev_to_usbdev(dev), 0, 512);
1271 + if (udev->speed == USB_SPEED_SUPER)
1272 + urb = simple_alloc_urb(udev, 0, 1024);
1273 + else
1274 + urb = simple_alloc_urb(udev, 0, 512);
1275 if (urb == NULL)
1276 return -ENOMEM;
1277
1278 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1279 index 60d7b1eb..f08d494 100644
1280 --- a/drivers/usb/serial/ftdi_sio.c
1281 +++ b/drivers/usb/serial/ftdi_sio.c
1282 @@ -807,6 +807,7 @@ static struct usb_device_id id_table_combined [] = {
1283 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1284 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
1285 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
1286 + { USB_DEVICE(PI_VID, PI_E861_PID) },
1287 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
1288 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
1289 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1290 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1291 index c6dd18e..219b199 100644
1292 --- a/drivers/usb/serial/ftdi_sio_ids.h
1293 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1294 @@ -785,6 +785,14 @@
1295 #define RTSYSTEMS_SERIAL_VX7_PID 0x9e52 /* Serial converter for VX-7 Radios using FT232RL */
1296 #define RTSYSTEMS_CT29B_PID 0x9e54 /* CT29B Radio Cable */
1297
1298 +
1299 +/*
1300 + * Physik Instrumente
1301 + * http://www.physikinstrumente.com/en/products/
1302 + */
1303 +#define PI_VID 0x1a72 /* Vendor ID */
1304 +#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */
1305 +
1306 /*
1307 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
1308 * http://winglucofacts.com/cables/
1309 diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
1310 index 21c82b0..2856474 100644
1311 --- a/drivers/usb/serial/ti_usb_3410_5052.c
1312 +++ b/drivers/usb/serial/ti_usb_3410_5052.c
1313 @@ -165,7 +165,7 @@ static unsigned int product_5052_count;
1314 /* the array dimension is the number of default entries plus */
1315 /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
1316 /* null entry */
1317 -static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
1318 +static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
1319 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
1320 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
1321 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
1322 @@ -180,6 +180,7 @@ static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
1323 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
1324 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
1325 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
1326 + { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
1327 };
1328
1329 static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
1330 @@ -189,7 +190,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
1331 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
1332 };
1333
1334 -static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = {
1335 +static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = {
1336 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
1337 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
1338 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
1339 @@ -208,6 +209,7 @@ static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1]
1340 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
1341 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
1342 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
1343 + { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
1344 { }
1345 };
1346
1347 diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h
1348 index f140f1b..b353e7e 100644
1349 --- a/drivers/usb/serial/ti_usb_3410_5052.h
1350 +++ b/drivers/usb/serial/ti_usb_3410_5052.h
1351 @@ -37,6 +37,7 @@
1352 #define TI_5152_BOOT_PRODUCT_ID 0x5152 /* no EEPROM, no firmware */
1353 #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */
1354 #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */
1355 +#define FRI2_PRODUCT_ID 0x5053 /* Fish River Island II */
1356
1357 /* Multi-Tech vendor and product ids */
1358 #define MTS_VENDOR_ID 0x06E0
1359 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1360 index 24caba7..591f57f 100644
1361 --- a/drivers/usb/storage/unusual_devs.h
1362 +++ b/drivers/usb/storage/unusual_devs.h
1363 @@ -1885,6 +1885,13 @@ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
1364 USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1365 US_FL_IGNORE_RESIDUE ),
1366
1367 +/* Reported by Jesse Feddema <jdfeddema@gmail.com> */
1368 +UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x0000,
1369 + "Yarvik",
1370 + "PMP400",
1371 + USB_SC_DEVICE, USB_PR_DEVICE, NULL,
1372 + US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
1373 +
1374 /* Reported by Hans de Goede <hdegoede@redhat.com>
1375 * These Appotech controllers are found in Picture Frames, they provide a
1376 * (buggy) emulation of a cdrom drive which contains the windows software
1377 diff --git a/fs/aio.c b/fs/aio.c
1378 index b4a88cc..278ed7d 100644
1379 --- a/fs/aio.c
1380 +++ b/fs/aio.c
1381 @@ -1395,6 +1395,10 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat)
1382 if (ret < 0)
1383 goto out;
1384
1385 + ret = rw_verify_area(type, kiocb->ki_filp, &kiocb->ki_pos, ret);
1386 + if (ret < 0)
1387 + goto out;
1388 +
1389 kiocb->ki_nr_segs = kiocb->ki_nbytes;
1390 kiocb->ki_cur_seg = 0;
1391 /* ki_nbytes/left now reflect bytes instead of segs */
1392 @@ -1406,11 +1410,17 @@ out:
1393 return ret;
1394 }
1395
1396 -static ssize_t aio_setup_single_vector(struct kiocb *kiocb)
1397 +static ssize_t aio_setup_single_vector(int type, struct file * file, struct kiocb *kiocb)
1398 {
1399 + int bytes;
1400 +
1401 + bytes = rw_verify_area(type, file, &kiocb->ki_pos, kiocb->ki_left);
1402 + if (bytes < 0)
1403 + return bytes;
1404 +
1405 kiocb->ki_iovec = &kiocb->ki_inline_vec;
1406 kiocb->ki_iovec->iov_base = kiocb->ki_buf;
1407 - kiocb->ki_iovec->iov_len = kiocb->ki_left;
1408 + kiocb->ki_iovec->iov_len = bytes;
1409 kiocb->ki_nr_segs = 1;
1410 kiocb->ki_cur_seg = 0;
1411 return 0;
1412 @@ -1435,10 +1445,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
1413 if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf,
1414 kiocb->ki_left)))
1415 break;
1416 - ret = security_file_permission(file, MAY_READ);
1417 - if (unlikely(ret))
1418 - break;
1419 - ret = aio_setup_single_vector(kiocb);
1420 + ret = aio_setup_single_vector(READ, file, kiocb);
1421 if (ret)
1422 break;
1423 ret = -EINVAL;
1424 @@ -1453,10 +1460,7 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
1425 if (unlikely(!access_ok(VERIFY_READ, kiocb->ki_buf,
1426 kiocb->ki_left)))
1427 break;
1428 - ret = security_file_permission(file, MAY_WRITE);
1429 - if (unlikely(ret))
1430 - break;
1431 - ret = aio_setup_single_vector(kiocb);
1432 + ret = aio_setup_single_vector(WRITE, file, kiocb);
1433 if (ret)
1434 break;
1435 ret = -EINVAL;
1436 @@ -1467,9 +1471,6 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
1437 ret = -EBADF;
1438 if (unlikely(!(file->f_mode & FMODE_READ)))
1439 break;
1440 - ret = security_file_permission(file, MAY_READ);
1441 - if (unlikely(ret))
1442 - break;
1443 ret = aio_setup_vectored_rw(READ, kiocb, compat);
1444 if (ret)
1445 break;
1446 @@ -1481,9 +1482,6 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb, bool compat)
1447 ret = -EBADF;
1448 if (unlikely(!(file->f_mode & FMODE_WRITE)))
1449 break;
1450 - ret = security_file_permission(file, MAY_WRITE);
1451 - if (unlikely(ret))
1452 - break;
1453 ret = aio_setup_vectored_rw(WRITE, kiocb, compat);
1454 if (ret)
1455 break;
1456 diff --git a/fs/block_dev.c b/fs/block_dev.c
1457 index 74fc5ed..a580028 100644
1458 --- a/fs/block_dev.c
1459 +++ b/fs/block_dev.c
1460 @@ -64,7 +64,7 @@ static void bdev_inode_switch_bdi(struct inode *inode,
1461 spin_unlock(&inode_wb_list_lock);
1462 }
1463
1464 -static sector_t max_block(struct block_device *bdev)
1465 +sector_t blkdev_max_block(struct block_device *bdev)
1466 {
1467 sector_t retval = ~((sector_t)0);
1468 loff_t sz = i_size_read(bdev->bd_inode);
1469 @@ -135,7 +135,7 @@ static int
1470 blkdev_get_block(struct inode *inode, sector_t iblock,
1471 struct buffer_head *bh, int create)
1472 {
1473 - if (iblock >= max_block(I_BDEV(inode))) {
1474 + if (iblock >= blkdev_max_block(I_BDEV(inode))) {
1475 if (create)
1476 return -EIO;
1477
1478 @@ -157,7 +157,7 @@ static int
1479 blkdev_get_blocks(struct inode *inode, sector_t iblock,
1480 struct buffer_head *bh, int create)
1481 {
1482 - sector_t end_block = max_block(I_BDEV(inode));
1483 + sector_t end_block = blkdev_max_block(I_BDEV(inode));
1484 unsigned long max_blocks = bh->b_size >> inode->i_blkbits;
1485
1486 if ((iblock + max_blocks) > end_block) {
1487 diff --git a/fs/buffer.c b/fs/buffer.c
1488 index 1a80b04..330cbce 100644
1489 --- a/fs/buffer.c
1490 +++ b/fs/buffer.c
1491 @@ -968,6 +968,7 @@ init_page_buffers(struct page *page, struct block_device *bdev,
1492 struct buffer_head *head = page_buffers(page);
1493 struct buffer_head *bh = head;
1494 int uptodate = PageUptodate(page);
1495 + sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode));
1496
1497 do {
1498 if (!buffer_mapped(bh)) {
1499 @@ -976,7 +977,8 @@ init_page_buffers(struct page *page, struct block_device *bdev,
1500 bh->b_blocknr = block;
1501 if (uptodate)
1502 set_buffer_uptodate(bh);
1503 - set_buffer_mapped(bh);
1504 + if (block < end_block)
1505 + set_buffer_mapped(bh);
1506 }
1507 block++;
1508 bh = bh->b_this_page;
1509 diff --git a/include/linux/fs.h b/include/linux/fs.h
1510 index d8ecb01..96b1035 100644
1511 --- a/include/linux/fs.h
1512 +++ b/include/linux/fs.h
1513 @@ -2029,6 +2029,7 @@ extern void unregister_blkdev(unsigned int, const char *);
1514 extern struct block_device *bdget(dev_t);
1515 extern struct block_device *bdgrab(struct block_device *bdev);
1516 extern void bd_set_size(struct block_device *, loff_t size);
1517 +extern sector_t blkdev_max_block(struct block_device *bdev);
1518 extern void bd_forget(struct inode *inode);
1519 extern void bdput(struct block_device *);
1520 extern void invalidate_bdev(struct block_device *);
1521 diff --git a/include/linux/genhd.h b/include/linux/genhd.h
1522 index 6f43b14..7a1ce18 100644
1523 --- a/include/linux/genhd.h
1524 +++ b/include/linux/genhd.h
1525 @@ -221,12 +221,6 @@ static inline void part_pack_uuid(const u8 *uuid_str, u8 *to)
1526 }
1527 }
1528
1529 -static inline char *part_unpack_uuid(const u8 *uuid, char *out)
1530 -{
1531 - sprintf(out, "%pU", uuid);
1532 - return out;
1533 -}
1534 -
1535 static inline int disk_max_parts(struct gendisk *disk)
1536 {
1537 if (disk->flags & GENHD_FL_EXT_DEVT)
1538 diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h
1539 index 1ee4424..f8d1e74 100644
1540 --- a/include/linux/mmc/host.h
1541 +++ b/include/linux/mmc/host.h
1542 @@ -267,6 +267,7 @@ struct mmc_host {
1543
1544 unsigned int sdio_irqs;
1545 struct task_struct *sdio_irq_thread;
1546 + bool sdio_irq_pending;
1547 atomic_t sdio_irq_thread_abort;
1548
1549 mmc_pm_flag_t pm_flags; /* requested pm features */
1550 @@ -312,6 +313,7 @@ extern void mmc_request_done(struct mmc_host *, struct mmc_request *);
1551 static inline void mmc_signal_sdio_irq(struct mmc_host *host)
1552 {
1553 host->ops->enable_sdio_irq(host, 0);
1554 + host->sdio_irq_pending = true;
1555 wake_up_process(host->sdio_irq_thread);
1556 }
1557
1558 diff --git a/init/main.c b/init/main.c
1559 index d7211fa..841e344 100644
1560 --- a/init/main.c
1561 +++ b/init/main.c
1562 @@ -549,9 +549,6 @@ asmlinkage void __init start_kernel(void)
1563 early_boot_irqs_disabled = false;
1564 local_irq_enable();
1565
1566 - /* Interrupts are enabled now so all GFP allocations are safe. */
1567 - gfp_allowed_mask = __GFP_BITS_MASK;
1568 -
1569 kmem_cache_init_late();
1570
1571 /*
1572 @@ -783,6 +780,10 @@ static int __init kernel_init(void * unused)
1573 * Wait until kthreadd is all set-up.
1574 */
1575 wait_for_completion(&kthreadd_done);
1576 +
1577 + /* Now the scheduler is fully set up and can do blocking allocations */
1578 + gfp_allowed_mask = __GFP_BITS_MASK;
1579 +
1580 /*
1581 * init can allocate pages on any node
1582 */
1583 diff --git a/kernel/workqueue.c b/kernel/workqueue.c
1584 index 1456dab..ee1845b 100644
1585 --- a/kernel/workqueue.c
1586 +++ b/kernel/workqueue.c
1587 @@ -1214,8 +1214,13 @@ static void worker_enter_idle(struct worker *worker)
1588 } else
1589 wake_up_all(&gcwq->trustee_wait);
1590
1591 - /* sanity check nr_running */
1592 - WARN_ON_ONCE(gcwq->nr_workers == gcwq->nr_idle &&
1593 + /*
1594 + * Sanity check nr_running. Because trustee releases gcwq->lock
1595 + * between setting %WORKER_ROGUE and zapping nr_running, the
1596 + * warning may trigger spuriously. Check iff trustee is idle.
1597 + */
1598 + WARN_ON_ONCE(gcwq->trustee_state == TRUSTEE_DONE &&
1599 + gcwq->nr_workers == gcwq->nr_idle &&
1600 atomic_read(get_gcwq_nr_running(gcwq->cpu)));
1601 }
1602
1603 diff --git a/mm/mempolicy.c b/mm/mempolicy.c
1604 index a85171d..3dac2d1 100644
1605 --- a/mm/mempolicy.c
1606 +++ b/mm/mempolicy.c
1607 @@ -606,27 +606,6 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
1608 return first;
1609 }
1610
1611 -/* Apply policy to a single VMA */
1612 -static int policy_vma(struct vm_area_struct *vma, struct mempolicy *new)
1613 -{
1614 - int err = 0;
1615 - struct mempolicy *old = vma->vm_policy;
1616 -
1617 - pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
1618 - vma->vm_start, vma->vm_end, vma->vm_pgoff,
1619 - vma->vm_ops, vma->vm_file,
1620 - vma->vm_ops ? vma->vm_ops->set_policy : NULL);
1621 -
1622 - if (vma->vm_ops && vma->vm_ops->set_policy)
1623 - err = vma->vm_ops->set_policy(vma, new);
1624 - if (!err) {
1625 - mpol_get(new);
1626 - vma->vm_policy = new;
1627 - mpol_put(old);
1628 - }
1629 - return err;
1630 -}
1631 -
1632 /* Step 2: apply policy to a range and do splits. */
1633 static int mbind_range(struct mm_struct *mm, unsigned long start,
1634 unsigned long end, struct mempolicy *new_pol)
1635 @@ -666,9 +645,23 @@ static int mbind_range(struct mm_struct *mm, unsigned long start,
1636 if (err)
1637 goto out;
1638 }
1639 - err = policy_vma(vma, new_pol);
1640 - if (err)
1641 - goto out;
1642 +
1643 + /*
1644 + * Apply policy to a single VMA. The reference counting of
1645 + * policy for vma_policy linkages has already been handled by
1646 + * vma_merge and split_vma as necessary. If this is a shared
1647 + * policy then ->set_policy will increment the reference count
1648 + * for an sp node.
1649 + */
1650 + pr_debug("vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n",
1651 + vma->vm_start, vma->vm_end, vma->vm_pgoff,
1652 + vma->vm_ops, vma->vm_file,
1653 + vma->vm_ops ? vma->vm_ops->set_policy : NULL);
1654 + if (vma->vm_ops && vma->vm_ops->set_policy) {
1655 + err = vma->vm_ops->set_policy(vma, new_pol);
1656 + if (err)
1657 + goto out;
1658 + }
1659 }
1660
1661 out:
1662 diff --git a/net/wireless/reg.c b/net/wireless/reg.c
1663 index ca76d8b..7457697 100644
1664 --- a/net/wireless/reg.c
1665 +++ b/net/wireless/reg.c
1666 @@ -379,7 +379,15 @@ static void reg_regdb_query(const char *alpha2)
1667
1668 schedule_work(&reg_regdb_work);
1669 }
1670 +
1671 +/* Feel free to add any other sanity checks here */
1672 +static void reg_regdb_size_check(void)
1673 +{
1674 + /* We should ideally BUILD_BUG_ON() but then random builds would fail */
1675 + WARN_ONCE(!reg_regdb_size, "db.txt is empty, you should update it...");
1676 +}
1677 #else
1678 +static inline void reg_regdb_size_check(void) {}
1679 static inline void reg_regdb_query(const char *alpha2) {}
1680 #endif /* CONFIG_CFG80211_INTERNAL_REGDB */
1681
1682 @@ -2225,6 +2233,8 @@ int __init regulatory_init(void)
1683 spin_lock_init(&reg_requests_lock);
1684 spin_lock_init(&reg_pending_beacons_lock);
1685
1686 + reg_regdb_size_check();
1687 +
1688 cfg80211_regdomain = cfg80211_world_regdom;
1689
1690 user_alpha2[0] = '9';
1691 diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
1692 index 3545934..27a9673 100644
1693 --- a/security/selinux/selinuxfs.c
1694 +++ b/security/selinux/selinuxfs.c
1695 @@ -1241,6 +1241,7 @@ static int sel_make_bools(void)
1696 kfree(bool_pending_names[i]);
1697 kfree(bool_pending_names);
1698 kfree(bool_pending_values);
1699 + bool_num = 0;
1700 bool_pending_names = NULL;
1701 bool_pending_values = NULL;
1702
1703 diff --git a/tools/usb/ffs-test.c b/tools/usb/ffs-test.c
1704 index b9c7986..f17dfee 100644
1705 --- a/tools/usb/ffs-test.c
1706 +++ b/tools/usb/ffs-test.c
1707 @@ -324,7 +324,7 @@ static void *start_thread_helper(void *arg)
1708
1709 ret = t->in(t, t->buf, t->buf_size);
1710 if (ret > 0) {
1711 - ret = t->out(t, t->buf, t->buf_size);
1712 + ret = t->out(t, t->buf, ret);
1713 name = out_name;
1714 op = "write";
1715 } else {

  ViewVC Help
Powered by ViewVC 1.1.20