/[linux-patches]/genpatches-2.6/tags/2.6.38-5/1003_linux-2.6.38.4.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.38-5/1003_linux-2.6.38.4.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1910 - (show annotations) (download)
Tue May 3 13:08:58 2011 UTC (3 years, 3 months ago) by mpagano
File size: 114049 byte(s)
2.6.38-5 release
1 diff --git a/MAINTAINERS b/MAINTAINERS
2 index f1bc3dc..80540e3 100644
3 --- a/MAINTAINERS
4 +++ b/MAINTAINERS
5 @@ -5944,7 +5944,6 @@ F: arch/alpha/kernel/srm_env.c
6
7 STABLE BRANCH
8 M: Greg Kroah-Hartman <greg@kroah.com>
9 -M: Chris Wright <chrisw@sous-sol.org>
10 L: stable@kernel.org
11 S: Maintained
12
13 diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
14 index 44b84fe..7e9a0c7 100644
15 --- a/arch/arm/kernel/hw_breakpoint.c
16 +++ b/arch/arm/kernel/hw_breakpoint.c
17 @@ -868,6 +868,13 @@ static void reset_ctrl_regs(void *info)
18 */
19 asm volatile("mcr p14, 0, %0, c1, c0, 4" : : "r" (0));
20 isb();
21 +
22 + /*
23 + * Clear any configured vector-catch events before
24 + * enabling monitor mode.
25 + */
26 + asm volatile("mcr p14, 0, %0, c0, c7, 0" : : "r" (0));
27 + isb();
28 }
29
30 if (enable_monitor_mode())
31 diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
32 index 1753f6a..ff14ab2 100644
33 --- a/arch/ia64/kernel/mca.c
34 +++ b/arch/ia64/kernel/mca.c
35 @@ -1859,7 +1859,8 @@ ia64_mca_cpu_init(void *cpu_data)
36 data = mca_bootmem();
37 first_time = 0;
38 } else
39 - data = __get_free_pages(GFP_KERNEL, get_order(sz));
40 + data = (void *)__get_free_pages(GFP_KERNEL,
41 + get_order(sz));
42 if (!data)
43 panic("Could not allocate MCA memory for cpu %d\n",
44 cpu);
45 diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
46 index 4d4536e..9c271be 100644
47 --- a/arch/ia64/sn/pci/tioca_provider.c
48 +++ b/arch/ia64/sn/pci/tioca_provider.c
49 @@ -509,7 +509,7 @@ tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
50 * use the GART mapped mode.
51 */
52 static u64
53 -tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count, int dma_flags)
54 +tioca_dma_map(struct pci_dev *pdev, unsigned long paddr, size_t byte_count, int dma_flags)
55 {
56 u64 mapaddr;
57
58 diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
59 index 97e0ae4..26e56e3 100644
60 --- a/arch/powerpc/kernel/perf_event.c
61 +++ b/arch/powerpc/kernel/perf_event.c
62 @@ -398,6 +398,25 @@ static int check_excludes(struct perf_event **ctrs, unsigned int cflags[],
63 return 0;
64 }
65
66 +static u64 check_and_compute_delta(u64 prev, u64 val)
67 +{
68 + u64 delta = (val - prev) & 0xfffffffful;
69 +
70 + /*
71 + * POWER7 can roll back counter values, if the new value is smaller
72 + * than the previous value it will cause the delta and the counter to
73 + * have bogus values unless we rolled a counter over. If a coutner is
74 + * rolled back, it will be smaller, but within 256, which is the maximum
75 + * number of events to rollback at once. If we dectect a rollback
76 + * return 0. This can lead to a small lack of precision in the
77 + * counters.
78 + */
79 + if (prev > val && (prev - val) < 256)
80 + delta = 0;
81 +
82 + return delta;
83 +}
84 +
85 static void power_pmu_read(struct perf_event *event)
86 {
87 s64 val, delta, prev;
88 @@ -416,10 +435,11 @@ static void power_pmu_read(struct perf_event *event)
89 prev = local64_read(&event->hw.prev_count);
90 barrier();
91 val = read_pmc(event->hw.idx);
92 + delta = check_and_compute_delta(prev, val);
93 + if (!delta)
94 + return;
95 } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
96
97 - /* The counters are only 32 bits wide */
98 - delta = (val - prev) & 0xfffffffful;
99 local64_add(delta, &event->count);
100 local64_sub(delta, &event->hw.period_left);
101 }
102 @@ -449,8 +469,9 @@ static void freeze_limited_counters(struct cpu_hw_events *cpuhw,
103 val = (event->hw.idx == 5) ? pmc5 : pmc6;
104 prev = local64_read(&event->hw.prev_count);
105 event->hw.idx = 0;
106 - delta = (val - prev) & 0xfffffffful;
107 - local64_add(delta, &event->count);
108 + delta = check_and_compute_delta(prev, val);
109 + if (delta)
110 + local64_add(delta, &event->count);
111 }
112 }
113
114 @@ -458,14 +479,16 @@ static void thaw_limited_counters(struct cpu_hw_events *cpuhw,
115 unsigned long pmc5, unsigned long pmc6)
116 {
117 struct perf_event *event;
118 - u64 val;
119 + u64 val, prev;
120 int i;
121
122 for (i = 0; i < cpuhw->n_limited; ++i) {
123 event = cpuhw->limited_counter[i];
124 event->hw.idx = cpuhw->limited_hwidx[i];
125 val = (event->hw.idx == 5) ? pmc5 : pmc6;
126 - local64_set(&event->hw.prev_count, val);
127 + prev = local64_read(&event->hw.prev_count);
128 + if (check_and_compute_delta(prev, val))
129 + local64_set(&event->hw.prev_count, val);
130 perf_event_update_userpage(event);
131 }
132 }
133 @@ -1197,7 +1220,7 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
134
135 /* we don't have to worry about interrupts here */
136 prev = local64_read(&event->hw.prev_count);
137 - delta = (val - prev) & 0xfffffffful;
138 + delta = check_and_compute_delta(prev, val);
139 local64_add(delta, &event->count);
140
141 /*
142 diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
143 index aa92696..02d54e1 100644
144 --- a/arch/powerpc/kernel/time.c
145 +++ b/arch/powerpc/kernel/time.c
146 @@ -229,6 +229,9 @@ static u64 scan_dispatch_log(u64 stop_tb)
147 u64 stolen = 0;
148 u64 dtb;
149
150 + if (!dtl)
151 + return 0;
152 +
153 if (i == vpa->dtl_idx)
154 return 0;
155 while (i < vpa->dtl_idx) {
156 diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
157 index 1504df8..906ee3e 100644
158 --- a/arch/sparc/kernel/entry.S
159 +++ b/arch/sparc/kernel/entry.S
160 @@ -1283,7 +1283,7 @@ linux_syscall_trace:
161 .globl ret_from_fork
162 ret_from_fork:
163 call schedule_tail
164 - mov %g3, %o0
165 + ld [%g3 + TI_TASK], %o0
166 b ret_sys_call
167 ld [%sp + STACKFRAME_SZ + PT_I0], %o0
168
169 diff --git a/arch/sparc/kernel/iommu.c b/arch/sparc/kernel/iommu.c
170 index 72509d0..6f01e8c 100644
171 --- a/arch/sparc/kernel/iommu.c
172 +++ b/arch/sparc/kernel/iommu.c
173 @@ -333,13 +333,10 @@ static void dma_4u_free_coherent(struct device *dev, size_t size,
174 void *cpu, dma_addr_t dvma)
175 {
176 struct iommu *iommu;
177 - iopte_t *iopte;
178 unsigned long flags, order, npages;
179
180 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
181 iommu = dev->archdata.iommu;
182 - iopte = iommu->page_table +
183 - ((dvma - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
184
185 spin_lock_irqsave(&iommu->lock, flags);
186
187 diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
188 index df39a0f..732b0bc 100644
189 --- a/arch/sparc/kernel/ldc.c
190 +++ b/arch/sparc/kernel/ldc.c
191 @@ -790,16 +790,20 @@ static void send_events(struct ldc_channel *lp, unsigned int event_mask)
192 static irqreturn_t ldc_rx(int irq, void *dev_id)
193 {
194 struct ldc_channel *lp = dev_id;
195 - unsigned long orig_state, hv_err, flags;
196 + unsigned long orig_state, flags;
197 unsigned int event_mask;
198
199 spin_lock_irqsave(&lp->lock, flags);
200
201 orig_state = lp->chan_state;
202 - hv_err = sun4v_ldc_rx_get_state(lp->id,
203 - &lp->rx_head,
204 - &lp->rx_tail,
205 - &lp->chan_state);
206 +
207 + /* We should probably check for hypervisor errors here and
208 + * reset the LDC channel if we get one.
209 + */
210 + sun4v_ldc_rx_get_state(lp->id,
211 + &lp->rx_head,
212 + &lp->rx_tail,
213 + &lp->chan_state);
214
215 ldcdbg(RX, "RX state[0x%02lx:0x%02lx] head[0x%04lx] tail[0x%04lx]\n",
216 orig_state, lp->chan_state, lp->rx_head, lp->rx_tail);
217 @@ -904,16 +908,20 @@ out:
218 static irqreturn_t ldc_tx(int irq, void *dev_id)
219 {
220 struct ldc_channel *lp = dev_id;
221 - unsigned long flags, hv_err, orig_state;
222 + unsigned long flags, orig_state;
223 unsigned int event_mask = 0;
224
225 spin_lock_irqsave(&lp->lock, flags);
226
227 orig_state = lp->chan_state;
228 - hv_err = sun4v_ldc_tx_get_state(lp->id,
229 - &lp->tx_head,
230 - &lp->tx_tail,
231 - &lp->chan_state);
232 +
233 + /* We should probably check for hypervisor errors here and
234 + * reset the LDC channel if we get one.
235 + */
236 + sun4v_ldc_tx_get_state(lp->id,
237 + &lp->tx_head,
238 + &lp->tx_tail,
239 + &lp->chan_state);
240
241 ldcdbg(TX, " TX state[0x%02lx:0x%02lx] head[0x%04lx] tail[0x%04lx]\n",
242 orig_state, lp->chan_state, lp->tx_head, lp->tx_tail);
243 diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
244 index 4137579..f255382 100644
245 --- a/arch/sparc/kernel/pci.c
246 +++ b/arch/sparc/kernel/pci.c
247 @@ -675,6 +675,7 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
248 * humanoid.
249 */
250 err = sysfs_create_file(&dev->dev.kobj, &dev_attr_obppath.attr);
251 + (void) err;
252 }
253 list_for_each_entry(child_bus, &bus->children, node)
254 pci_bus_register_of_sysfs(child_bus);
255 diff --git a/arch/sparc/kernel/pci_common.c b/arch/sparc/kernel/pci_common.c
256 index 6c7a33a..6e3874b 100644
257 --- a/arch/sparc/kernel/pci_common.c
258 +++ b/arch/sparc/kernel/pci_common.c
259 @@ -295,14 +295,17 @@ static int sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
260 unsigned int bus = bus_dev->number;
261 unsigned int device = PCI_SLOT(devfn);
262 unsigned int func = PCI_FUNC(devfn);
263 - unsigned long ret;
264
265 if (config_out_of_range(pbm, bus, devfn, where)) {
266 /* Do nothing. */
267 } else {
268 - ret = pci_sun4v_config_put(devhandle,
269 - HV_PCI_DEVICE_BUILD(bus, device, func),
270 - where, size, value);
271 + /* We don't check for hypervisor errors here, but perhaps
272 + * we should and influence our return value depending upon
273 + * what kind of error is thrown.
274 + */
275 + pci_sun4v_config_put(devhandle,
276 + HV_PCI_DEVICE_BUILD(bus, device, func),
277 + where, size, value);
278 }
279 return PCIBIOS_SUCCESSFUL;
280 }
281 diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
282 index efb896d..75dfeb6 100644
283 --- a/arch/sparc/kernel/pci_fire.c
284 +++ b/arch/sparc/kernel/pci_fire.c
285 @@ -214,11 +214,9 @@ static int pci_fire_msi_setup(struct pci_pbm_info *pbm, unsigned long msiqid,
286
287 static int pci_fire_msi_teardown(struct pci_pbm_info *pbm, unsigned long msi)
288 {
289 - unsigned long msiqid;
290 u64 val;
291
292 val = upa_readq(pbm->pbm_regs + MSI_MAP(msi));
293 - msiqid = (val & MSI_MAP_EQNUM);
294
295 val &= ~MSI_MAP_VALID;
296
297 diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
298 index 445a47a..4620eb7 100644
299 --- a/arch/sparc/kernel/pci_schizo.c
300 +++ b/arch/sparc/kernel/pci_schizo.c
301 @@ -1313,7 +1313,7 @@ static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
302 const struct linux_prom64_registers *regs;
303 struct device_node *dp = op->dev.of_node;
304 const char *chipset_name;
305 - int is_pbm_a, err;
306 + int err;
307
308 switch (chip_type) {
309 case PBM_CHIP_TYPE_TOMATILLO:
310 @@ -1343,8 +1343,6 @@ static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
311 */
312 regs = of_get_property(dp, "reg", NULL);
313
314 - is_pbm_a = ((regs[0].phys_addr & 0x00700000) == 0x00600000);
315 -
316 pbm->next = pci_pbm_root;
317 pci_pbm_root = pbm;
318
319 diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
320 index 743344a..859abfd 100644
321 --- a/arch/sparc/kernel/pci_sun4v.c
322 +++ b/arch/sparc/kernel/pci_sun4v.c
323 @@ -580,7 +580,7 @@ static int __devinit pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
324 {
325 static const u32 vdma_default[] = { 0x80000000, 0x80000000 };
326 struct iommu *iommu = pbm->iommu;
327 - unsigned long num_tsb_entries, sz, tsbsize;
328 + unsigned long num_tsb_entries, sz;
329 u32 dma_mask, dma_offset;
330 const u32 *vdma;
331
332 @@ -596,7 +596,6 @@ static int __devinit pci_sun4v_iommu_init(struct pci_pbm_info *pbm)
333
334 dma_mask = (roundup_pow_of_two(vdma[1]) - 1UL);
335 num_tsb_entries = vdma[1] / IO_PAGE_SIZE;
336 - tsbsize = num_tsb_entries * sizeof(iopte_t);
337
338 dma_offset = vdma[0];
339
340 diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
341 index 7c2ced6..8ac23e6 100644
342 --- a/arch/sparc/kernel/pcr.c
343 +++ b/arch/sparc/kernel/pcr.c
344 @@ -81,7 +81,7 @@ static void n2_pcr_write(u64 val)
345 unsigned long ret;
346
347 ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
348 - if (val != HV_EOK)
349 + if (ret != HV_EOK)
350 write_pcr(val);
351 }
352
353 diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
354 index 9ccc812..96ee50a 100644
355 --- a/arch/sparc/kernel/ptrace_64.c
356 +++ b/arch/sparc/kernel/ptrace_64.c
357 @@ -1086,6 +1086,7 @@ asmlinkage int syscall_trace_enter(struct pt_regs *regs)
358
359 asmlinkage void syscall_trace_leave(struct pt_regs *regs)
360 {
361 +#ifdef CONFIG_AUDITSYSCALL
362 if (unlikely(current->audit_context)) {
363 unsigned long tstate = regs->tstate;
364 int result = AUDITSC_SUCCESS;
365 @@ -1095,7 +1096,7 @@ asmlinkage void syscall_trace_leave(struct pt_regs *regs)
366
367 audit_syscall_exit(result, regs->u_regs[UREG_I0]);
368 }
369 -
370 +#endif
371 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
372 trace_sys_exit(regs, regs->u_regs[UREG_G1]);
373
374 diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
375 index 555a76d..3e94a8c 100644
376 --- a/arch/sparc/kernel/smp_64.c
377 +++ b/arch/sparc/kernel/smp_64.c
378 @@ -189,7 +189,7 @@ static inline long get_delta (long *rt, long *master)
379 void smp_synchronize_tick_client(void)
380 {
381 long i, delta, adj, adjust_latency = 0, done = 0;
382 - unsigned long flags, rt, master_time_stamp, bound;
383 + unsigned long flags, rt, master_time_stamp;
384 #if DEBUG_TICK_SYNC
385 struct {
386 long rt; /* roundtrip time */
387 @@ -208,10 +208,8 @@ void smp_synchronize_tick_client(void)
388 {
389 for (i = 0; i < NUM_ROUNDS; i++) {
390 delta = get_delta(&rt, &master_time_stamp);
391 - if (delta == 0) {
392 + if (delta == 0)
393 done = 1; /* let's lock on to this... */
394 - bound = rt;
395 - }
396
397 if (!done) {
398 if (i > 0) {
399 @@ -933,13 +931,12 @@ void smp_flush_dcache_page_impl(struct page *page, int cpu)
400 void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
401 {
402 void *pg_addr;
403 - int this_cpu;
404 u64 data0;
405
406 if (tlb_type == hypervisor)
407 return;
408
409 - this_cpu = get_cpu();
410 + preempt_disable();
411
412 #ifdef CONFIG_DEBUG_DCFLUSH
413 atomic_inc(&dcpage_flushes);
414 @@ -964,7 +961,7 @@ void flush_dcache_page_all(struct mm_struct *mm, struct page *page)
415 }
416 __local_flush_dcache_page(page);
417
418 - put_cpu();
419 + preempt_enable();
420 }
421
422 void __irq_entry smp_new_mmu_context_version_client(int irq, struct pt_regs *regs)
423 diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
424 index 1e97709..1ed547b 100644
425 --- a/arch/sparc/kernel/traps_64.c
426 +++ b/arch/sparc/kernel/traps_64.c
427 @@ -2152,7 +2152,7 @@ static void user_instruction_dump(unsigned int __user *pc)
428
429 void show_stack(struct task_struct *tsk, unsigned long *_ksp)
430 {
431 - unsigned long fp, thread_base, ksp;
432 + unsigned long fp, ksp;
433 struct thread_info *tp;
434 int count = 0;
435 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
436 @@ -2173,7 +2173,6 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
437 flushw_all();
438
439 fp = ksp + STACK_BIAS;
440 - thread_base = (unsigned long) tp;
441
442 printk("Call Trace:\n");
443 do {
444 diff --git a/arch/sparc/kernel/una_asm_64.S b/arch/sparc/kernel/una_asm_64.S
445 index be183fe..1c8d332 100644
446 --- a/arch/sparc/kernel/una_asm_64.S
447 +++ b/arch/sparc/kernel/una_asm_64.S
448 @@ -127,7 +127,7 @@ do_int_load:
449 wr %o5, 0x0, %asi
450 retl
451 mov 0, %o0
452 - .size __do_int_load, .-__do_int_load
453 + .size do_int_load, .-do_int_load
454
455 .section __ex_table,"a"
456 .word 4b, __retl_efault
457 diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
458 index 5b836f5..b10ac4d 100644
459 --- a/arch/sparc/mm/fault_32.c
460 +++ b/arch/sparc/mm/fault_32.c
461 @@ -240,11 +240,10 @@ asmlinkage void do_sparc_fault(struct pt_regs *regs, int text_fault, int write,
462 * only copy the information from the master page table,
463 * nothing more.
464 */
465 + code = SEGV_MAPERR;
466 if (!ARCH_SUN4C && address >= TASK_SIZE)
467 goto vmalloc_fault;
468
469 - code = SEGV_MAPERR;
470 -
471 /*
472 * If we're in an interrupt or have no user
473 * context, we must not take the fault..
474 diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
475 index 43a18c7..99b402c 100644
476 --- a/arch/x86/include/asm/msr-index.h
477 +++ b/arch/x86/include/asm/msr-index.h
478 @@ -92,11 +92,15 @@
479 #define MSR_IA32_MC0_ADDR 0x00000402
480 #define MSR_IA32_MC0_MISC 0x00000403
481
482 +#define MSR_AMD64_MC0_MASK 0xc0010044
483 +
484 #define MSR_IA32_MCx_CTL(x) (MSR_IA32_MC0_CTL + 4*(x))
485 #define MSR_IA32_MCx_STATUS(x) (MSR_IA32_MC0_STATUS + 4*(x))
486 #define MSR_IA32_MCx_ADDR(x) (MSR_IA32_MC0_ADDR + 4*(x))
487 #define MSR_IA32_MCx_MISC(x) (MSR_IA32_MC0_MISC + 4*(x))
488
489 +#define MSR_AMD64_MCx_MASK(x) (MSR_AMD64_MC0_MASK + (x))
490 +
491 /* These are consecutive and not in the normal 4er MCE bank block */
492 #define MSR_IA32_MC0_CTL2 0x00000280
493 #define MSR_IA32_MCx_CTL2(x) (MSR_IA32_MC0_CTL2 + (x))
494 diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
495 index 7c7bedb..a2b9c7d 100644
496 --- a/arch/x86/kernel/cpu/amd.c
497 +++ b/arch/x86/kernel/cpu/amd.c
498 @@ -594,6 +594,29 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
499 }
500 }
501 #endif
502 +
503 + /* As a rule processors have APIC timer running in deep C states */
504 + if (c->x86 >= 0xf && !cpu_has_amd_erratum(amd_erratum_400))
505 + set_cpu_cap(c, X86_FEATURE_ARAT);
506 +
507 + /*
508 + * Disable GART TLB Walk Errors on Fam10h. We do this here
509 + * because this is always needed when GART is enabled, even in a
510 + * kernel which has no MCE support built in.
511 + */
512 + if (c->x86 == 0x10) {
513 + /*
514 + * BIOS should disable GartTlbWlk Errors themself. If
515 + * it doesn't do it here as suggested by the BKDG.
516 + *
517 + * Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=33012
518 + */
519 + u64 mask;
520 +
521 + rdmsrl(MSR_AMD64_MCx_MASK(4), mask);
522 + mask |= (1 << 10);
523 + wrmsrl(MSR_AMD64_MCx_MASK(4), mask);
524 + }
525 }
526
527 #ifdef CONFIG_X86_32
528 diff --git a/arch/x86/lib/semaphore_32.S b/arch/x86/lib/semaphore_32.S
529 index 648fe47..f35eec7 100644
530 --- a/arch/x86/lib/semaphore_32.S
531 +++ b/arch/x86/lib/semaphore_32.S
532 @@ -36,7 +36,7 @@
533 */
534 #ifdef CONFIG_SMP
535 ENTRY(__write_lock_failed)
536 - CFI_STARTPROC simple
537 + CFI_STARTPROC
538 FRAME
539 2: LOCK_PREFIX
540 addl $ RW_LOCK_BIAS,(%eax)
541 diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
542 index 258fa5e..d71d375 100644
543 --- a/drivers/gpu/drm/radeon/atom.c
544 +++ b/drivers/gpu/drm/radeon/atom.c
545 @@ -32,6 +32,7 @@
546 #include "atom.h"
547 #include "atom-names.h"
548 #include "atom-bits.h"
549 +#include "radeon.h"
550
551 #define ATOM_COND_ABOVE 0
552 #define ATOM_COND_ABOVEOREQUAL 1
553 @@ -101,7 +102,9 @@ static void debug_print_spaces(int n)
554 static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
555 uint32_t index, uint32_t data)
556 {
557 + struct radeon_device *rdev = ctx->card->dev->dev_private;
558 uint32_t temp = 0xCDCDCDCD;
559 +
560 while (1)
561 switch (CU8(base)) {
562 case ATOM_IIO_NOP:
563 @@ -112,7 +115,8 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
564 base += 3;
565 break;
566 case ATOM_IIO_WRITE:
567 - (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
568 + if (rdev->family == CHIP_RV515)
569 + (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
570 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
571 base += 3;
572 break;
573 diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
574 index e967cc8..0861257 100644
575 --- a/drivers/gpu/drm/radeon/atombios_crtc.c
576 +++ b/drivers/gpu/drm/radeon/atombios_crtc.c
577 @@ -531,6 +531,12 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
578 pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
579 else
580 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
581 +
582 + if ((rdev->family == CHIP_R600) ||
583 + (rdev->family == CHIP_RV610) ||
584 + (rdev->family == CHIP_RV630) ||
585 + (rdev->family == CHIP_RV670))
586 + pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
587 } else {
588 pll->flags |= RADEON_PLL_LEGACY;
589
590 diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
591 index 171b0b2..2b0ee62 100644
592 --- a/drivers/gpu/drm/radeon/radeon_fence.c
593 +++ b/drivers/gpu/drm/radeon/radeon_fence.c
594 @@ -80,7 +80,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev)
595 scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base;
596 else
597 scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base;
598 - seq = rdev->wb.wb[scratch_index/4];
599 + seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]);
600 } else
601 seq = RREG32(rdev->fence_drv.scratch_reg);
602 if (seq != rdev->fence_drv.last_seq) {
603 diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
604 index 06e7982..d6edfeb 100644
605 --- a/drivers/gpu/drm/radeon/radeon_ring.c
606 +++ b/drivers/gpu/drm/radeon/radeon_ring.c
607 @@ -248,7 +248,7 @@ void radeon_ib_pool_fini(struct radeon_device *rdev)
608 void radeon_ring_free_size(struct radeon_device *rdev)
609 {
610 if (rdev->wb.enabled)
611 - rdev->cp.rptr = rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4];
612 + rdev->cp.rptr = le32_to_cpu(rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]);
613 else {
614 if (rdev->family >= CHIP_R600)
615 rdev->cp.rptr = RREG32(R600_CP_RB_RPTR);
616 diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c
617 index 38319a6..d6d5868 100644
618 --- a/drivers/i2c/algos/i2c-algo-bit.c
619 +++ b/drivers/i2c/algos/i2c-algo-bit.c
620 @@ -232,9 +232,17 @@ static int i2c_inb(struct i2c_adapter *i2c_adap)
621 * Sanity check for the adapter hardware - check the reaction of
622 * the bus lines only if it seems to be idle.
623 */
624 -static int test_bus(struct i2c_algo_bit_data *adap, char *name)
625 +static int test_bus(struct i2c_adapter *i2c_adap)
626 {
627 - int scl, sda;
628 + struct i2c_algo_bit_data *adap = i2c_adap->algo_data;
629 + const char *name = i2c_adap->name;
630 + int scl, sda, ret;
631 +
632 + if (adap->pre_xfer) {
633 + ret = adap->pre_xfer(i2c_adap);
634 + if (ret < 0)
635 + return -ENODEV;
636 + }
637
638 if (adap->getscl == NULL)
639 pr_info("%s: Testing SDA only, SCL is not readable\n", name);
640 @@ -297,11 +305,19 @@ static int test_bus(struct i2c_algo_bit_data *adap, char *name)
641 "while pulling SCL high!\n", name);
642 goto bailout;
643 }
644 +
645 + if (adap->post_xfer)
646 + adap->post_xfer(i2c_adap);
647 +
648 pr_info("%s: Test OK\n", name);
649 return 0;
650 bailout:
651 sdahi(adap);
652 sclhi(adap);
653 +
654 + if (adap->post_xfer)
655 + adap->post_xfer(i2c_adap);
656 +
657 return -ENODEV;
658 }
659
660 @@ -607,7 +623,7 @@ static int __i2c_bit_add_bus(struct i2c_adapter *adap,
661 int ret;
662
663 if (bit_test) {
664 - ret = test_bus(bit_adap, adap->name);
665 + ret = test_bus(adap);
666 if (ret < 0)
667 return -ENODEV;
668 }
669 diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c
670 index 84984f6..ce56a1c 100644
671 --- a/drivers/media/video/sn9c102/sn9c102_core.c
672 +++ b/drivers/media/video/sn9c102/sn9c102_core.c
673 @@ -1430,9 +1430,9 @@ static DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR,
674 sn9c102_show_i2c_reg, sn9c102_store_i2c_reg);
675 static DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR,
676 sn9c102_show_i2c_val, sn9c102_store_i2c_val);
677 -static DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green);
678 -static DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue);
679 -static DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red);
680 +static DEVICE_ATTR(green, S_IWUSR, NULL, sn9c102_store_green);
681 +static DEVICE_ATTR(blue, S_IWUSR, NULL, sn9c102_store_blue);
682 +static DEVICE_ATTR(red, S_IWUSR, NULL, sn9c102_store_red);
683 static DEVICE_ATTR(frame_header, S_IRUGO, sn9c102_show_frame_header, NULL);
684
685
686 diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
687 index 5ed8f9f..3da19a5 100644
688 --- a/drivers/net/gianfar.c
689 +++ b/drivers/net/gianfar.c
690 @@ -950,6 +950,11 @@ static void gfar_detect_errata(struct gfar_private *priv)
691 (pvr == 0x80861010 && (mod & 0xfff9) == 0x80c0))
692 priv->errata |= GFAR_ERRATA_A002;
693
694 + /* MPC8313 Rev < 2.0, MPC8548 rev 2.0 */
695 + if ((pvr == 0x80850010 && mod == 0x80b0 && rev < 0x0020) ||
696 + (pvr == 0x80210020 && mod == 0x8030 && rev == 0x0020))
697 + priv->errata |= GFAR_ERRATA_12;
698 +
699 if (priv->errata)
700 dev_info(dev, "enabled errata workarounds, flags: 0x%x\n",
701 priv->errata);
702 @@ -2156,8 +2161,15 @@ static int gfar_start_xmit(struct sk_buff *skb, struct net_device *dev)
703 /* Set up checksumming */
704 if (CHECKSUM_PARTIAL == skb->ip_summed) {
705 fcb = gfar_add_fcb(skb);
706 - lstatus |= BD_LFLAG(TXBD_TOE);
707 - gfar_tx_checksum(skb, fcb);
708 + /* as specified by errata */
709 + if (unlikely(gfar_has_errata(priv, GFAR_ERRATA_12)
710 + && ((unsigned long)fcb % 0x20) > 0x18)) {
711 + __skb_pull(skb, GMAC_FCB_LEN);
712 + skb_checksum_help(skb);
713 + } else {
714 + lstatus |= BD_LFLAG(TXBD_TOE);
715 + gfar_tx_checksum(skb, fcb);
716 + }
717 }
718
719 if (vlan_tx_tag_present(skb)) {
720 diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
721 index 54de413..ec5d595 100644
722 --- a/drivers/net/gianfar.h
723 +++ b/drivers/net/gianfar.h
724 @@ -1039,6 +1039,7 @@ enum gfar_errata {
725 GFAR_ERRATA_74 = 0x01,
726 GFAR_ERRATA_76 = 0x02,
727 GFAR_ERRATA_A002 = 0x04,
728 + GFAR_ERRATA_12 = 0x08, /* a.k.a errata eTSEC49 */
729 };
730
731 /* Struct stolen almost completely (and shamelessly) from the FCC enet source
732 diff --git a/drivers/net/pppoe.c b/drivers/net/pppoe.c
733 index 78c0e3c..71b1d8f 100644
734 --- a/drivers/net/pppoe.c
735 +++ b/drivers/net/pppoe.c
736 @@ -317,7 +317,7 @@ static void pppoe_flush_dev(struct net_device *dev)
737 lock_sock(sk);
738
739 if (po->pppoe_dev == dev &&
740 - sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
741 + sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND | PPPOX_ZOMBIE)) {
742 pppox_unbind_sock(sk);
743 sk->sk_state = PPPOX_ZOMBIE;
744 sk->sk_state_change(sk);
745 diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
746 index 109751b..e7ce8af 100644
747 --- a/drivers/net/usb/cdc-phonet.c
748 +++ b/drivers/net/usb/cdc-phonet.c
749 @@ -328,13 +328,13 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
750 {
751 static const char ifname[] = "usbpn%d";
752 const struct usb_cdc_union_desc *union_header = NULL;
753 - const struct usb_cdc_header_desc *phonet_header = NULL;
754 const struct usb_host_interface *data_desc;
755 struct usb_interface *data_intf;
756 struct usb_device *usbdev = interface_to_usbdev(intf);
757 struct net_device *dev;
758 struct usbpn_dev *pnd;
759 u8 *data;
760 + int phonet = 0;
761 int len, err;
762
763 data = intf->altsetting->extra;
764 @@ -355,10 +355,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
765 (struct usb_cdc_union_desc *)data;
766 break;
767 case 0xAB:
768 - if (phonet_header || dlen < 5)
769 - break;
770 - phonet_header =
771 - (struct usb_cdc_header_desc *)data;
772 + phonet = 1;
773 break;
774 }
775 }
776 @@ -366,7 +363,7 @@ int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
777 len -= dlen;
778 }
779
780 - if (!union_header || !phonet_header)
781 + if (!union_header || !phonet)
782 return -EINVAL;
783
784 data_intf = usb_ifnum_to_if(usbdev, union_header->bSlaveInterface0);
785 diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
786 index 17971d9..0e61e2d 100644
787 --- a/drivers/rtc/rtc-bfin.c
788 +++ b/drivers/rtc/rtc-bfin.c
789 @@ -276,6 +276,8 @@ static int bfin_rtc_alarm_irq_enable(struct device *dev, unsigned int enabled)
790 bfin_rtc_int_set_alarm(rtc);
791 else
792 bfin_rtc_int_clear(~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
793 +
794 + return 0;
795 }
796
797 static int bfin_rtc_read_time(struct device *dev, struct rtc_time *tm)
798 diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
799 index a3d2e23..96fdfb8 100644
800 --- a/drivers/usb/core/devices.c
801 +++ b/drivers/usb/core/devices.c
802 @@ -221,7 +221,7 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
803 break;
804 case USB_ENDPOINT_XFER_INT:
805 type = "Int.";
806 - if (speed == USB_SPEED_HIGH)
807 + if (speed == USB_SPEED_HIGH || speed == USB_SPEED_SUPER)
808 interval = 1 << (desc->bInterval - 1);
809 else
810 interval = desc->bInterval;
811 @@ -229,7 +229,8 @@ static char *usb_dump_endpoint_descriptor(int speed, char *start, char *end,
812 default: /* "can't happen" */
813 return start;
814 }
815 - interval *= (speed == USB_SPEED_HIGH) ? 125 : 1000;
816 + interval *= (speed == USB_SPEED_HIGH ||
817 + speed == USB_SPEED_SUPER) ? 125 : 1000;
818 if (interval % 1000)
819 unit = 'u';
820 else {
821 @@ -542,8 +543,9 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
822 if (level == 0) {
823 int max;
824
825 - /* high speed reserves 80%, full/low reserves 90% */
826 - if (usbdev->speed == USB_SPEED_HIGH)
827 + /* super/high speed reserves 80%, full/low reserves 90% */
828 + if (usbdev->speed == USB_SPEED_HIGH ||
829 + usbdev->speed == USB_SPEED_SUPER)
830 max = 800;
831 else
832 max = FRAME_TIME_MAX_USECS_ALLOC;
833 diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
834 index c34a935..fd95b9e 100644
835 --- a/drivers/usb/core/hcd.c
836 +++ b/drivers/usb/core/hcd.c
837 @@ -1885,7 +1885,7 @@ void usb_free_streams(struct usb_interface *interface,
838
839 /* Streams only apply to bulk endpoints. */
840 for (i = 0; i < num_eps; i++)
841 - if (!usb_endpoint_xfer_bulk(&eps[i]->desc))
842 + if (!eps[i] || !usb_endpoint_xfer_bulk(&eps[i]->desc))
843 return;
844
845 hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags);
846 diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
847 index 5add8b5..baf7362 100644
848 --- a/drivers/usb/host/ehci-q.c
849 +++ b/drivers/usb/host/ehci-q.c
850 @@ -1245,24 +1245,27 @@ static void start_unlink_async (struct ehci_hcd *ehci, struct ehci_qh *qh)
851
852 static void scan_async (struct ehci_hcd *ehci)
853 {
854 + bool stopped;
855 struct ehci_qh *qh;
856 enum ehci_timer_action action = TIMER_IO_WATCHDOG;
857
858 ehci->stamp = ehci_readl(ehci, &ehci->regs->frame_index);
859 timer_action_done (ehci, TIMER_ASYNC_SHRINK);
860 rescan:
861 + stopped = !HC_IS_RUNNING(ehci_to_hcd(ehci)->state);
862 qh = ehci->async->qh_next.qh;
863 if (likely (qh != NULL)) {
864 do {
865 /* clean any finished work for this qh */
866 - if (!list_empty (&qh->qtd_list)
867 - && qh->stamp != ehci->stamp) {
868 + if (!list_empty(&qh->qtd_list) && (stopped ||
869 + qh->stamp != ehci->stamp)) {
870 int temp;
871
872 /* unlinks could happen here; completion
873 * reporting drops the lock. rescan using
874 * the latest schedule, but don't rescan
875 - * qhs we already finished (no looping).
876 + * qhs we already finished (no looping)
877 + * unless the controller is stopped.
878 */
879 qh = qh_get (qh);
880 qh->stamp = ehci->stamp;
881 @@ -1283,9 +1286,9 @@ rescan:
882 */
883 if (list_empty(&qh->qtd_list)
884 && qh->qh_state == QH_STATE_LINKED) {
885 - if (!ehci->reclaim
886 - && ((ehci->stamp - qh->stamp) & 0x1fff)
887 - >= (EHCI_SHRINK_FRAMES * 8))
888 + if (!ehci->reclaim && (stopped ||
889 + ((ehci->stamp - qh->stamp) & 0x1fff)
890 + >= EHCI_SHRINK_FRAMES * 8))
891 start_unlink_async(ehci, qh);
892 else
893 action = TIMER_ASYNC_SHRINK;
894 diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
895 index a953439..0de3100 100644
896 --- a/drivers/usb/host/xhci-mem.c
897 +++ b/drivers/usb/host/xhci-mem.c
898 @@ -920,6 +920,47 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
899 return 0;
900 }
901
902 +/*
903 + * Convert interval expressed as 2^(bInterval - 1) == interval into
904 + * straight exponent value 2^n == interval.
905 + *
906 + */
907 +static unsigned int xhci_parse_exponent_interval(struct usb_device *udev,
908 + struct usb_host_endpoint *ep)
909 +{
910 + unsigned int interval;
911 +
912 + interval = clamp_val(ep->desc.bInterval, 1, 16) - 1;
913 + if (interval != ep->desc.bInterval - 1)
914 + dev_warn(&udev->dev,
915 + "ep %#x - rounding interval to %d microframes\n",
916 + ep->desc.bEndpointAddress,
917 + 1 << interval);
918 +
919 + return interval;
920 +}
921 +
922 +/*
923 + * Convert bInterval expressed in frames (in 1-255 range) to exponent of
924 + * microframes, rounded down to nearest power of 2.
925 + */
926 +static unsigned int xhci_parse_frame_interval(struct usb_device *udev,
927 + struct usb_host_endpoint *ep)
928 +{
929 + unsigned int interval;
930 +
931 + interval = fls(8 * ep->desc.bInterval) - 1;
932 + interval = clamp_val(interval, 3, 10);
933 + if ((1 << interval) != 8 * ep->desc.bInterval)
934 + dev_warn(&udev->dev,
935 + "ep %#x - rounding interval to %d microframes, ep desc says %d microframes\n",
936 + ep->desc.bEndpointAddress,
937 + 1 << interval,
938 + 8 * ep->desc.bInterval);
939 +
940 + return interval;
941 +}
942 +
943 /* Return the polling or NAK interval.
944 *
945 * The polling interval is expressed in "microframes". If xHCI's Interval field
946 @@ -937,45 +978,38 @@ static inline unsigned int xhci_get_endpoint_interval(struct usb_device *udev,
947 case USB_SPEED_HIGH:
948 /* Max NAK rate */
949 if (usb_endpoint_xfer_control(&ep->desc) ||
950 - usb_endpoint_xfer_bulk(&ep->desc))
951 + usb_endpoint_xfer_bulk(&ep->desc)) {
952 interval = ep->desc.bInterval;
953 + break;
954 + }
955 /* Fall through - SS and HS isoc/int have same decoding */
956 +
957 case USB_SPEED_SUPER:
958 if (usb_endpoint_xfer_int(&ep->desc) ||
959 - usb_endpoint_xfer_isoc(&ep->desc)) {
960 - if (ep->desc.bInterval == 0)
961 - interval = 0;
962 - else
963 - interval = ep->desc.bInterval - 1;
964 - if (interval > 15)
965 - interval = 15;
966 - if (interval != ep->desc.bInterval + 1)
967 - dev_warn(&udev->dev, "ep %#x - rounding interval to %d microframes\n",
968 - ep->desc.bEndpointAddress, 1 << interval);
969 + usb_endpoint_xfer_isoc(&ep->desc)) {
970 + interval = xhci_parse_exponent_interval(udev, ep);
971 }
972 break;
973 - /* Convert bInterval (in 1-255 frames) to microframes and round down to
974 - * nearest power of 2.
975 - */
976 +
977 case USB_SPEED_FULL:
978 + if (usb_endpoint_xfer_int(&ep->desc)) {
979 + interval = xhci_parse_exponent_interval(udev, ep);
980 + break;
981 + }
982 + /*
983 + * Fall through for isochronous endpoint interval decoding
984 + * since it uses the same rules as low speed interrupt
985 + * endpoints.
986 + */
987 +
988 case USB_SPEED_LOW:
989 if (usb_endpoint_xfer_int(&ep->desc) ||
990 - usb_endpoint_xfer_isoc(&ep->desc)) {
991 - interval = fls(8*ep->desc.bInterval) - 1;
992 - if (interval > 10)
993 - interval = 10;
994 - if (interval < 3)
995 - interval = 3;
996 - if ((1 << interval) != 8*ep->desc.bInterval)
997 - dev_warn(&udev->dev,
998 - "ep %#x - rounding interval"
999 - " to %d microframes, "
1000 - "ep desc says %d microframes\n",
1001 - ep->desc.bEndpointAddress,
1002 - 1 << interval,
1003 - 8*ep->desc.bInterval);
1004 + usb_endpoint_xfer_isoc(&ep->desc)) {
1005 +
1006 + interval = xhci_parse_frame_interval(udev, ep);
1007 }
1008 break;
1009 +
1010 default:
1011 BUG();
1012 }
1013 diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
1014 index 2083fc2..150349d 100644
1015 --- a/drivers/usb/host/xhci.c
1016 +++ b/drivers/usb/host/xhci.c
1017 @@ -2335,10 +2335,18 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
1018 /* Everything but endpoint 0 is disabled, so free or cache the rings. */
1019 last_freed_endpoint = 1;
1020 for (i = 1; i < 31; ++i) {
1021 - if (!virt_dev->eps[i].ring)
1022 - continue;
1023 - xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i);
1024 - last_freed_endpoint = i;
1025 + struct xhci_virt_ep *ep = &virt_dev->eps[i];
1026 +
1027 + if (ep->ep_state & EP_HAS_STREAMS) {
1028 + xhci_free_stream_info(xhci, ep->stream_info);
1029 + ep->stream_info = NULL;
1030 + ep->ep_state &= ~EP_HAS_STREAMS;
1031 + }
1032 +
1033 + if (ep->ring) {
1034 + xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i);
1035 + last_freed_endpoint = i;
1036 + }
1037 }
1038 xhci_dbg(xhci, "Output context after successful reset device cmd:\n");
1039 xhci_dbg_ctx(xhci, virt_dev->out_ctx, last_freed_endpoint);
1040 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
1041 index 62bc1bc..19040c5 100644
1042 --- a/drivers/usb/host/xhci.h
1043 +++ b/drivers/usb/host/xhci.h
1044 @@ -232,7 +232,7 @@ struct xhci_op_regs {
1045 * notification type that matches a bit set in this bit field.
1046 */
1047 #define DEV_NOTE_MASK (0xffff)
1048 -#define ENABLE_DEV_NOTE(x) (1 << x)
1049 +#define ENABLE_DEV_NOTE(x) (1 << (x))
1050 /* Most of the device notification types should only be used for debug.
1051 * SW does need to pay attention to function wake notifications.
1052 */
1053 @@ -601,11 +601,11 @@ struct xhci_ep_ctx {
1054 #define EP_STATE_STOPPED 3
1055 #define EP_STATE_ERROR 4
1056 /* Mult - Max number of burtst within an interval, in EP companion desc. */
1057 -#define EP_MULT(p) ((p & 0x3) << 8)
1058 +#define EP_MULT(p) (((p) & 0x3) << 8)
1059 /* bits 10:14 are Max Primary Streams */
1060 /* bit 15 is Linear Stream Array */
1061 /* Interval - period between requests to an endpoint - 125u increments. */
1062 -#define EP_INTERVAL(p) ((p & 0xff) << 16)
1063 +#define EP_INTERVAL(p) (((p) & 0xff) << 16)
1064 #define EP_INTERVAL_TO_UFRAMES(p) (1 << (((p) >> 16) & 0xff))
1065 #define EP_MAXPSTREAMS_MASK (0x1f << 10)
1066 #define EP_MAXPSTREAMS(p) (((p) << 10) & EP_MAXPSTREAMS_MASK)
1067 diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
1068 index 4cbb7e4..74073b3 100644
1069 --- a/drivers/usb/musb/Kconfig
1070 +++ b/drivers/usb/musb/Kconfig
1071 @@ -14,7 +14,7 @@ config USB_MUSB_HDRC
1072 select TWL4030_USB if MACH_OMAP_3430SDP
1073 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
1074 select USB_OTG_UTILS
1075 - tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
1076 + bool 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
1077 help
1078 Say Y here if your system has a dual role high speed USB
1079 controller based on the Mentor Graphics silicon IP. Then
1080 @@ -30,8 +30,8 @@ config USB_MUSB_HDRC
1081
1082 If you do not know what this is, please say N.
1083
1084 - To compile this driver as a module, choose M here; the
1085 - module will be called "musb-hdrc".
1086 +# To compile this driver as a module, choose M here; the
1087 +# module will be called "musb-hdrc".
1088
1089 choice
1090 prompt "Platform Glue Layer"
1091 diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
1092 index f349a36..31bba6d 100644
1093 --- a/drivers/usb/serial/ftdi_sio.c
1094 +++ b/drivers/usb/serial/ftdi_sio.c
1095 @@ -151,6 +151,8 @@ static struct ftdi_sio_quirk ftdi_stmclite_quirk = {
1096 * /sys/bus/usb/ftdi_sio/new_id, then send patch/report!
1097 */
1098 static struct usb_device_id id_table_combined [] = {
1099 + { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) },
1100 + { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) },
1101 { USB_DEVICE(FTDI_VID, FTDI_AMC232_PID) },
1102 { USB_DEVICE(FTDI_VID, FTDI_CANUSB_PID) },
1103 { USB_DEVICE(FTDI_VID, FTDI_CANDAPTER_PID) },
1104 @@ -525,6 +527,7 @@ static struct usb_device_id id_table_combined [] = {
1105 { USB_DEVICE(SEALEVEL_VID, SEALEVEL_2803_8_PID) },
1106 { USB_DEVICE(IDTECH_VID, IDTECH_IDT1221U_PID) },
1107 { USB_DEVICE(OCT_VID, OCT_US101_PID) },
1108 + { USB_DEVICE(OCT_VID, OCT_DK201_PID) },
1109 { USB_DEVICE(FTDI_VID, FTDI_HE_TIRA1_PID),
1110 .driver_info = (kernel_ulong_t)&ftdi_HE_TIRA1_quirk },
1111 { USB_DEVICE(FTDI_VID, FTDI_USB_UIRT_PID),
1112 @@ -785,6 +788,8 @@ static struct usb_device_id id_table_combined [] = {
1113 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
1114 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
1115 { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) },
1116 + { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) },
1117 + { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
1118 { USB_DEVICE(FTDI_VID, HAMEG_HO870_PID) },
1119 { USB_DEVICE(FTDI_VID, MJSG_GENERIC_PID) },
1120 { USB_DEVICE(FTDI_VID, MJSG_SR_RADIO_PID) },
1121 diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
1122 index 117e8e6..4e873ce 100644
1123 --- a/drivers/usb/serial/ftdi_sio_ids.h
1124 +++ b/drivers/usb/serial/ftdi_sio_ids.h
1125 @@ -300,6 +300,8 @@
1126 * Hameg HO820 and HO870 interface (using VID 0x0403)
1127 */
1128 #define HAMEG_HO820_PID 0xed74
1129 +#define HAMEG_HO730_PID 0xed73
1130 +#define HAMEG_HO720_PID 0xed72
1131 #define HAMEG_HO870_PID 0xed71
1132
1133 /*
1134 @@ -572,6 +574,7 @@
1135 /* Note: OCT US101 is also rebadged as Dick Smith Electronics (NZ) XH6381 */
1136 /* Also rebadged as Dick Smith Electronics (Aus) XH6451 */
1137 /* Also rebadged as SIIG Inc. model US2308 hardware version 1 */
1138 +#define OCT_DK201_PID 0x0103 /* OCT DK201 USB docking station */
1139 #define OCT_US101_PID 0x0421 /* OCT US101 USB to RS-232 */
1140
1141 /*
1142 @@ -1140,3 +1143,12 @@
1143 #define QIHARDWARE_VID 0x20B7
1144 #define MILKYMISTONE_JTAGSERIAL_PID 0x0713
1145
1146 +/*
1147 + * CTI GmbH RS485 Converter http://www.cti-lean.com/
1148 + */
1149 +/* USB-485-Mini*/
1150 +#define FTDI_CTI_MINI_PID 0xF608
1151 +/* USB-Nano-485*/
1152 +#define FTDI_CTI_NANO_PID 0xF60B
1153 +
1154 +
1155 diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
1156 index 75c7f45..d77ff04 100644
1157 --- a/drivers/usb/serial/option.c
1158 +++ b/drivers/usb/serial/option.c
1159 @@ -407,6 +407,10 @@ static void option_instat_callback(struct urb *urb);
1160 /* ONDA MT825UP HSDPA 14.2 modem */
1161 #define ONDA_MT825UP 0x000b
1162
1163 +/* Samsung products */
1164 +#define SAMSUNG_VENDOR_ID 0x04e8
1165 +#define SAMSUNG_PRODUCT_GT_B3730 0x6889
1166 +
1167 /* some devices interfaces need special handling due to a number of reasons */
1168 enum option_blacklist_reason {
1169 OPTION_BLACKLIST_NONE = 0,
1170 @@ -968,6 +972,7 @@ static const struct usb_device_id option_ids[] = {
1171 { USB_DEVICE(OLIVETTI_VENDOR_ID, OLIVETTI_PRODUCT_OLICARD100) },
1172 { USB_DEVICE(CELOT_VENDOR_ID, CELOT_PRODUCT_CT680M) }, /* CT-650 CDMA 450 1xEVDO modem */
1173 { USB_DEVICE(ONDA_VENDOR_ID, ONDA_MT825UP) }, /* ONDA MT825UP modem */
1174 + { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_GT_B3730, USB_CLASS_CDC_DATA, 0x00, 0x00) }, /* Samsung GT-B3730/GT-B3710 LTE USB modem.*/
1175 { } /* Terminating entry */
1176 };
1177 MODULE_DEVICE_TABLE(usb, option_ids);
1178 diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
1179 index 8858201..54a9dab 100644
1180 --- a/drivers/usb/serial/qcserial.c
1181 +++ b/drivers/usb/serial/qcserial.c
1182 @@ -111,7 +111,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1183 ifnum = intf->desc.bInterfaceNumber;
1184 dbg("This Interface = %d", ifnum);
1185
1186 - data = serial->private = kzalloc(sizeof(struct usb_wwan_intf_private),
1187 + data = kzalloc(sizeof(struct usb_wwan_intf_private),
1188 GFP_KERNEL);
1189 if (!data)
1190 return -ENOMEM;
1191 @@ -134,8 +134,10 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1192 usb_endpoint_is_bulk_out(&intf->endpoint[1].desc)) {
1193 dbg("QDL port found");
1194
1195 - if (serial->interface->num_altsetting == 1)
1196 - return 0;
1197 + if (serial->interface->num_altsetting == 1) {
1198 + retval = 0; /* Success */
1199 + break;
1200 + }
1201
1202 retval = usb_set_interface(serial->dev, ifnum, 1);
1203 if (retval < 0) {
1204 @@ -145,7 +147,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1205 retval = -ENODEV;
1206 kfree(data);
1207 }
1208 - return retval;
1209 }
1210 break;
1211
1212 @@ -166,6 +167,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1213 "Could not set interface, error %d\n",
1214 retval);
1215 retval = -ENODEV;
1216 + kfree(data);
1217 }
1218 } else if (ifnum == 2) {
1219 dbg("Modem port found");
1220 @@ -177,7 +179,6 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1221 retval = -ENODEV;
1222 kfree(data);
1223 }
1224 - return retval;
1225 } else if (ifnum==3) {
1226 /*
1227 * NMEA (serial line 9600 8N1)
1228 @@ -191,6 +192,7 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1229 "Could not set interface, error %d\n",
1230 retval);
1231 retval = -ENODEV;
1232 + kfree(data);
1233 }
1234 }
1235 break;
1236 @@ -199,12 +201,27 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
1237 dev_err(&serial->dev->dev,
1238 "unknown number of interfaces: %d\n", nintf);
1239 kfree(data);
1240 - return -ENODEV;
1241 + retval = -ENODEV;
1242 }
1243
1244 + /* Set serial->private if not returning -ENODEV */
1245 + if (retval != -ENODEV)
1246 + usb_set_serial_data(serial, data);
1247 return retval;
1248 }
1249
1250 +static void qc_release(struct usb_serial *serial)
1251 +{
1252 + struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
1253 +
1254 + dbg("%s", __func__);
1255 +
1256 + /* Call usb_wwan release & free the private data allocated in qcprobe */
1257 + usb_wwan_release(serial);
1258 + usb_set_serial_data(serial, NULL);
1259 + kfree(priv);
1260 +}
1261 +
1262 static struct usb_serial_driver qcdevice = {
1263 .driver = {
1264 .owner = THIS_MODULE,
1265 @@ -222,7 +239,7 @@ static struct usb_serial_driver qcdevice = {
1266 .chars_in_buffer = usb_wwan_chars_in_buffer,
1267 .attach = usb_wwan_startup,
1268 .disconnect = usb_wwan_disconnect,
1269 - .release = usb_wwan_release,
1270 + .release = qc_release,
1271 #ifdef CONFIG_PM
1272 .suspend = usb_wwan_suspend,
1273 .resume = usb_wwan_resume,
1274 diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h
1275 index d66f963..137996d 100644
1276 --- a/drivers/video/via/viafbdev.h
1277 +++ b/drivers/video/via/viafbdev.h
1278 @@ -94,9 +94,6 @@ extern int viafb_LCD_ON;
1279 extern int viafb_DVI_ON;
1280 extern int viafb_hotplug;
1281
1282 -extern int strict_strtoul(const char *cp, unsigned int base,
1283 - unsigned long *res);
1284 -
1285 u8 viafb_gpio_i2c_read_lvds(struct lvds_setting_information
1286 *plvds_setting_info, struct lvds_chip_information
1287 *plvds_chip_info, u8 index);
1288 diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
1289 index d5b640b..70470b2 100644
1290 --- a/fs/binfmt_elf.c
1291 +++ b/fs/binfmt_elf.c
1292 @@ -941,9 +941,13 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
1293 current->mm->start_stack = bprm->p;
1294
1295 #ifdef arch_randomize_brk
1296 - if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1))
1297 + if ((current->flags & PF_RANDOMIZE) && (randomize_va_space > 1)) {
1298 current->mm->brk = current->mm->start_brk =
1299 arch_randomize_brk(current->mm);
1300 +#ifdef CONFIG_COMPAT_BRK
1301 + current->brk_randomized = 1;
1302 +#endif
1303 + }
1304 #endif
1305
1306 if (current->personality & MMAP_PAGE_ZERO) {
1307 diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
1308 index a51585f..96b9a34 100644
1309 --- a/fs/cifs/cifsencrypt.c
1310 +++ b/fs/cifs/cifsencrypt.c
1311 @@ -30,12 +30,13 @@
1312 #include <linux/ctype.h>
1313 #include <linux/random.h>
1314
1315 -/* Calculate and return the CIFS signature based on the mac key and SMB PDU */
1316 -/* the 16 byte signature must be allocated by the caller */
1317 -/* Note we only use the 1st eight bytes */
1318 -/* Note that the smb header signature field on input contains the
1319 - sequence number before this function is called */
1320 -
1321 +/*
1322 + * Calculate and return the CIFS signature based on the mac key and SMB PDU.
1323 + * The 16 byte signature must be allocated by the caller. Note we only use the
1324 + * 1st eight bytes and that the smb header signature field on input contains
1325 + * the sequence number before this function is called. Also, this function
1326 + * should be called with the server->srv_mutex held.
1327 + */
1328 static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
1329 struct TCP_Server_Info *server, char *signature)
1330 {
1331 @@ -209,8 +210,10 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu,
1332 cpu_to_le32(expected_sequence_number);
1333 cifs_pdu->Signature.Sequence.Reserved = 0;
1334
1335 + mutex_lock(&server->srv_mutex);
1336 rc = cifs_calculate_signature(cifs_pdu, server,
1337 what_we_think_sig_should_be);
1338 + mutex_unlock(&server->srv_mutex);
1339
1340 if (rc)
1341 return rc;
1342 diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
1343 index f297013..c0def4f 100644
1344 --- a/fs/cifs/cifsfs.c
1345 +++ b/fs/cifs/cifsfs.c
1346 @@ -127,6 +127,7 @@ cifs_read_super(struct super_block *sb, void *data,
1347 kfree(cifs_sb);
1348 return rc;
1349 }
1350 + cifs_sb->bdi.ra_pages = default_backing_dev_info.ra_pages;
1351
1352 #ifdef CONFIG_CIFS_DFS_UPCALL
1353 /* copy mount params to sb for use in submounts */
1354 diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
1355 index 8d6c17a..d3d836d 100644
1356 --- a/fs/cifs/connect.c
1357 +++ b/fs/cifs/connect.c
1358 @@ -2826,7 +2826,7 @@ try_mount_again:
1359
1360 remote_path_check:
1361 /* check if a whole path (including prepath) is not remote */
1362 - if (!rc && cifs_sb->prepathlen && tcon) {
1363 + if (!rc && tcon) {
1364 /* build_path_to_root works only when we have a valid tcon */
1365 full_path = cifs_build_path_to_root(cifs_sb, tcon);
1366 if (full_path == NULL) {
1367 diff --git a/fs/cifs/file.c b/fs/cifs/file.c
1368 index e964b1c..7b2e8ec 100644
1369 --- a/fs/cifs/file.c
1370 +++ b/fs/cifs/file.c
1371 @@ -575,8 +575,10 @@ reopen_error_exit:
1372
1373 int cifs_close(struct inode *inode, struct file *file)
1374 {
1375 - cifsFileInfo_put(file->private_data);
1376 - file->private_data = NULL;
1377 + if (file->private_data != NULL) {
1378 + cifsFileInfo_put(file->private_data);
1379 + file->private_data = NULL;
1380 + }
1381
1382 /* return code from the ->release op is always ignored */
1383 return 0;
1384 diff --git a/fs/namei.c b/fs/namei.c
1385 index a4689eb..3095ca8 100644
1386 --- a/fs/namei.c
1387 +++ b/fs/namei.c
1388 @@ -712,6 +712,7 @@ static __always_inline void set_root_rcu(struct nameidata *nd)
1389 do {
1390 seq = read_seqcount_begin(&fs->seq);
1391 nd->root = fs->root;
1392 + nd->seq = __read_seqcount_begin(&nd->root.dentry->d_seq);
1393 } while (read_seqcount_retry(&fs->seq, seq));
1394 }
1395 }
1396 diff --git a/fs/proc/base.c b/fs/proc/base.c
1397 index d49c4b5..71a85d8 100644
1398 --- a/fs/proc/base.c
1399 +++ b/fs/proc/base.c
1400 @@ -3066,11 +3066,16 @@ static int proc_pid_fill_cache(struct file *filp, void *dirent, filldir_t filldi
1401 /* for the /proc/ directory itself, after non-process stuff has been done */
1402 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
1403 {
1404 - unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
1405 - struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
1406 + unsigned int nr;
1407 + struct task_struct *reaper;
1408 struct tgid_iter iter;
1409 struct pid_namespace *ns;
1410
1411 + if (filp->f_pos >= PID_MAX_LIMIT + TGID_OFFSET)
1412 + goto out_no_task;
1413 + nr = filp->f_pos - FIRST_PROCESS_ENTRY;
1414 +
1415 + reaper = get_proc_task(filp->f_path.dentry->d_inode);
1416 if (!reaper)
1417 goto out_no_task;
1418
1419 diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
1420 index 9eead2c..fbb0b47 100644
1421 --- a/fs/ramfs/file-nommu.c
1422 +++ b/fs/ramfs/file-nommu.c
1423 @@ -112,6 +112,7 @@ int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
1424 SetPageDirty(page);
1425
1426 unlock_page(page);
1427 + put_page(page);
1428 }
1429
1430 return 0;
1431 diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
1432 index 5b9e985..b67ed36 100644
1433 --- a/fs/ubifs/debug.c
1434 +++ b/fs/ubifs/debug.c
1435 @@ -2844,19 +2844,19 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
1436 }
1437
1438 fname = "dump_lprops";
1439 - dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
1440 + dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
1441 if (IS_ERR(dent))
1442 goto out_remove;
1443 d->dfs_dump_lprops = dent;
1444
1445 fname = "dump_budg";
1446 - dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
1447 + dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
1448 if (IS_ERR(dent))
1449 goto out_remove;
1450 d->dfs_dump_budg = dent;
1451
1452 fname = "dump_tnc";
1453 - dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
1454 + dent = debugfs_create_file(fname, S_IWUSR, d->dfs_dir, c, &dfs_fops);
1455 if (IS_ERR(dent))
1456 goto out_remove;
1457 d->dfs_dump_tnc = dent;
1458 diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
1459 index d77db7e..fe14f4d 100644
1460 --- a/fs/ubifs/file.c
1461 +++ b/fs/ubifs/file.c
1462 @@ -1309,6 +1309,9 @@ int ubifs_fsync(struct file *file, int datasync)
1463
1464 dbg_gen("syncing inode %lu", inode->i_ino);
1465
1466 + if (inode->i_sb->s_flags & MS_RDONLY)
1467 + return 0;
1468 +
1469 /*
1470 * VFS has already synchronized dirty pages for this inode. Synchronize
1471 * the inode unless this is a 'datasync()' call.
1472 diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
1473 index 6e11c29..0f029e1 100644
1474 --- a/fs/ubifs/super.c
1475 +++ b/fs/ubifs/super.c
1476 @@ -1543,6 +1543,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1477 mutex_lock(&c->umount_mutex);
1478 dbg_save_space_info(c);
1479 c->remounting_rw = 1;
1480 + c->ro_mount = 0;
1481 c->always_chk_crc = 1;
1482
1483 err = check_free_space(c);
1484 @@ -1648,7 +1649,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1485 }
1486
1487 dbg_gen("re-mounted read-write");
1488 - c->ro_mount = 0;
1489 c->remounting_rw = 0;
1490 c->always_chk_crc = 0;
1491 err = dbg_check_space_info(c);
1492 @@ -1656,6 +1656,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1493 return err;
1494
1495 out:
1496 + c->ro_mount = 1;
1497 vfree(c->orph_buf);
1498 c->orph_buf = NULL;
1499 if (c->bgt) {
1500 diff --git a/include/linux/kernel.h b/include/linux/kernel.h
1501 index 2fe6e84..00cec4d 100644
1502 --- a/include/linux/kernel.h
1503 +++ b/include/linux/kernel.h
1504 @@ -187,14 +187,76 @@ NORET_TYPE void do_exit(long error_code)
1505 ATTRIB_NORET;
1506 NORET_TYPE void complete_and_exit(struct completion *, long)
1507 ATTRIB_NORET;
1508 +
1509 +/* Internal, do not use. */
1510 +int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long *res);
1511 +int __must_check _kstrtol(const char *s, unsigned int base, long *res);
1512 +
1513 +int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
1514 +int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
1515 +static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
1516 +{
1517 + /*
1518 + * We want to shortcut function call, but
1519 + * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
1520 + */
1521 + if (sizeof(unsigned long) == sizeof(unsigned long long) &&
1522 + __alignof__(unsigned long) == __alignof__(unsigned long long))
1523 + return kstrtoull(s, base, (unsigned long long *)res);
1524 + else
1525 + return _kstrtoul(s, base, res);
1526 +}
1527 +
1528 +static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
1529 +{
1530 + /*
1531 + * We want to shortcut function call, but
1532 + * __builtin_types_compatible_p(long, long long) = 0.
1533 + */
1534 + if (sizeof(long) == sizeof(long long) &&
1535 + __alignof__(long) == __alignof__(long long))
1536 + return kstrtoll(s, base, (long long *)res);
1537 + else
1538 + return _kstrtol(s, base, res);
1539 +}
1540 +
1541 +int __must_check kstrtouint(const char *s, unsigned int base, unsigned int *res);
1542 +int __must_check kstrtoint(const char *s, unsigned int base, int *res);
1543 +
1544 +static inline int __must_check kstrtou64(const char *s, unsigned int base, u64 *res)
1545 +{
1546 + return kstrtoull(s, base, res);
1547 +}
1548 +
1549 +static inline int __must_check kstrtos64(const char *s, unsigned int base, s64 *res)
1550 +{
1551 + return kstrtoll(s, base, res);
1552 +}
1553 +
1554 +static inline int __must_check kstrtou32(const char *s, unsigned int base, u32 *res)
1555 +{
1556 + return kstrtouint(s, base, res);
1557 +}
1558 +
1559 +static inline int __must_check kstrtos32(const char *s, unsigned int base, s32 *res)
1560 +{
1561 + return kstrtoint(s, base, res);
1562 +}
1563 +
1564 +int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
1565 +int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
1566 +int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
1567 +int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
1568 +
1569 extern unsigned long simple_strtoul(const char *,char **,unsigned int);
1570 extern long simple_strtol(const char *,char **,unsigned int);
1571 extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
1572 extern long long simple_strtoll(const char *,char **,unsigned int);
1573 -extern int __must_check strict_strtoul(const char *, unsigned int, unsigned long *);
1574 -extern int __must_check strict_strtol(const char *, unsigned int, long *);
1575 -extern int __must_check strict_strtoull(const char *, unsigned int, unsigned long long *);
1576 -extern int __must_check strict_strtoll(const char *, unsigned int, long long *);
1577 +#define strict_strtoul kstrtoul
1578 +#define strict_strtol kstrtol
1579 +#define strict_strtoull kstrtoull
1580 +#define strict_strtoll kstrtoll
1581 +
1582 extern int sprintf(char * buf, const char * fmt, ...)
1583 __attribute__ ((format (printf, 2, 3)));
1584 extern int vsprintf(char *buf, const char *, va_list)
1585 diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
1586 index dda5b0a..a9bd9c0 100644
1587 --- a/include/linux/perf_event.h
1588 +++ b/include/linux/perf_event.h
1589 @@ -1052,7 +1052,7 @@ void perf_event_task_sched_out(struct task_struct *task, struct task_struct *nex
1590 {
1591 perf_sw_event(PERF_COUNT_SW_CONTEXT_SWITCHES, 1, 1, NULL, 0);
1592
1593 - COND_STMT(&perf_task_events, __perf_event_task_sched_out(task, next));
1594 + __perf_event_task_sched_out(task, next);
1595 }
1596
1597 extern void perf_event_mmap(struct vm_area_struct *vma);
1598 diff --git a/include/linux/pid.h b/include/linux/pid.h
1599 index 49f1c2f..ec9f2df 100644
1600 --- a/include/linux/pid.h
1601 +++ b/include/linux/pid.h
1602 @@ -117,7 +117,7 @@ extern struct pid *find_vpid(int nr);
1603 */
1604 extern struct pid *find_get_pid(int nr);
1605 extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
1606 -int next_pidmap(struct pid_namespace *pid_ns, int last);
1607 +int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
1608
1609 extern struct pid *alloc_pid(struct pid_namespace *ns);
1610 extern void free_pid(struct pid *pid);
1611 diff --git a/include/linux/sched.h b/include/linux/sched.h
1612 index 777d8a5..ed6c384 100644
1613 --- a/include/linux/sched.h
1614 +++ b/include/linux/sched.h
1615 @@ -1254,6 +1254,9 @@ struct task_struct {
1616 #endif
1617
1618 struct mm_struct *mm, *active_mm;
1619 +#ifdef CONFIG_COMPAT_BRK
1620 + unsigned brk_randomized:1;
1621 +#endif
1622 #if defined(SPLIT_RSS_COUNTING)
1623 struct task_rss_stat rss_stat;
1624 #endif
1625 diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
1626 index 29a7a8c..84d3b23 100644
1627 --- a/include/net/bluetooth/hci.h
1628 +++ b/include/net/bluetooth/hci.h
1629 @@ -76,6 +76,8 @@ enum {
1630 HCI_INQUIRY,
1631
1632 HCI_RAW,
1633 +
1634 + HCI_RESET,
1635 };
1636
1637 /* HCI ioctl defines */
1638 diff --git a/kernel/futex.c b/kernel/futex.c
1639 index b766d28..d5065e8 100644
1640 --- a/kernel/futex.c
1641 +++ b/kernel/futex.c
1642 @@ -1886,7 +1886,7 @@ retry:
1643 restart->futex.val = val;
1644 restart->futex.time = abs_time->tv64;
1645 restart->futex.bitset = bitset;
1646 - restart->futex.flags = flags;
1647 + restart->futex.flags = flags | FLAGS_HAS_TIMEOUT;
1648
1649 ret = -ERESTART_RESTARTBLOCK;
1650
1651 diff --git a/kernel/pid.c b/kernel/pid.c
1652 index 39b65b6..6aeebc2 100644
1653 --- a/kernel/pid.c
1654 +++ b/kernel/pid.c
1655 @@ -217,11 +217,14 @@ static int alloc_pidmap(struct pid_namespace *pid_ns)
1656 return -1;
1657 }
1658
1659 -int next_pidmap(struct pid_namespace *pid_ns, int last)
1660 +int next_pidmap(struct pid_namespace *pid_ns, unsigned int last)
1661 {
1662 int offset;
1663 struct pidmap *map, *end;
1664
1665 + if (last >= PID_MAX_LIMIT)
1666 + return -1;
1667 +
1668 offset = (last + 1) & BITS_PER_PAGE_MASK;
1669 map = &pid_ns->pidmap[(last + 1)/BITS_PER_PAGE];
1670 end = &pid_ns->pidmap[PIDMAP_ENTRIES];
1671 diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
1672 index 0c26e2d..7406f36 100644
1673 --- a/kernel/sched_fair.c
1674 +++ b/kernel/sched_fair.c
1675 @@ -2043,21 +2043,20 @@ balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
1676 enum cpu_idle_type idle, int *all_pinned,
1677 int *this_best_prio, struct cfs_rq *busiest_cfs_rq)
1678 {
1679 - int loops = 0, pulled = 0, pinned = 0;
1680 + int loops = 0, pulled = 0;
1681 long rem_load_move = max_load_move;
1682 struct task_struct *p, *n;
1683
1684 if (max_load_move == 0)
1685 goto out;
1686
1687 - pinned = 1;
1688 -
1689 list_for_each_entry_safe(p, n, &busiest_cfs_rq->tasks, se.group_node) {
1690 if (loops++ > sysctl_sched_nr_migrate)
1691 break;
1692
1693 if ((p->se.load.weight >> 1) > rem_load_move ||
1694 - !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned))
1695 + !can_migrate_task(p, busiest, this_cpu, sd, idle,
1696 + all_pinned))
1697 continue;
1698
1699 pull_task(busiest, p, this_rq, this_cpu);
1700 @@ -2092,9 +2091,6 @@ out:
1701 */
1702 schedstat_add(sd, lb_gained[idle], pulled);
1703
1704 - if (all_pinned)
1705 - *all_pinned = pinned;
1706 -
1707 return max_load_move - rem_load_move;
1708 }
1709
1710 @@ -3297,6 +3293,7 @@ redo:
1711 * still unbalanced. ld_moved simply stays zero, so it is
1712 * correctly treated as an imbalance.
1713 */
1714 + all_pinned = 1;
1715 local_irq_save(flags);
1716 double_rq_lock(this_rq, busiest);
1717 ld_moved = move_tasks(this_rq, this_cpu, busiest,
1718 diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
1719 index 2b97418..d1b5951 100644
1720 --- a/lib/Kconfig.debug
1721 +++ b/lib/Kconfig.debug
1722 @@ -1236,3 +1236,6 @@ source "samples/Kconfig"
1723 source "lib/Kconfig.kgdb"
1724
1725 source "lib/Kconfig.kmemcheck"
1726 +
1727 +config TEST_KSTRTOX
1728 + tristate "Test kstrto*() family of functions at runtime"
1729 diff --git a/lib/Makefile b/lib/Makefile
1730 index cbb774f..dfbf7d8 100644
1731 --- a/lib/Makefile
1732 +++ b/lib/Makefile
1733 @@ -22,6 +22,8 @@ lib-y += kobject.o kref.o klist.o
1734 obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \
1735 bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \
1736 string_helpers.o gcd.o lcm.o list_sort.o uuid.o flex_array.o
1737 +obj-y += kstrtox.o
1738 +obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
1739
1740 ifeq ($(CONFIG_DEBUG_KOBJECT),y)
1741 CFLAGS_kobject.o += -DDEBUG
1742 diff --git a/lib/kstrtox.c b/lib/kstrtox.c
1743 new file mode 100644
1744 index 0000000..05672e8
1745 --- /dev/null
1746 +++ b/lib/kstrtox.c
1747 @@ -0,0 +1,227 @@
1748 +/*
1749 + * Convert integer string representation to an integer.
1750 + * If an integer doesn't fit into specified type, -E is returned.
1751 + *
1752 + * Integer starts with optional sign.
1753 + * kstrtou*() functions do not accept sign "-".
1754 + *
1755 + * Radix 0 means autodetection: leading "0x" implies radix 16,
1756 + * leading "0" implies radix 8, otherwise radix is 10.
1757 + * Autodetection hints work after optional sign, but not before.
1758 + *
1759 + * If -E is returned, result is not touched.
1760 + */
1761 +#include <linux/ctype.h>
1762 +#include <linux/errno.h>
1763 +#include <linux/kernel.h>
1764 +#include <linux/math64.h>
1765 +#include <linux/module.h>
1766 +#include <linux/types.h>
1767 +
1768 +static inline char _tolower(const char c)
1769 +{
1770 + return c | 0x20;
1771 +}
1772 +
1773 +static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
1774 +{
1775 + unsigned long long acc;
1776 + int ok;
1777 +
1778 + if (base == 0) {
1779 + if (s[0] == '0') {
1780 + if (_tolower(s[1]) == 'x' && isxdigit(s[2]))
1781 + base = 16;
1782 + else
1783 + base = 8;
1784 + } else
1785 + base = 10;
1786 + }
1787 + if (base == 16 && s[0] == '0' && _tolower(s[1]) == 'x')
1788 + s += 2;
1789 +
1790 + acc = 0;
1791 + ok = 0;
1792 + while (*s) {
1793 + unsigned int val;
1794 +
1795 + if ('0' <= *s && *s <= '9')
1796 + val = *s - '0';
1797 + else if ('a' <= _tolower(*s) && _tolower(*s) <= 'f')
1798 + val = _tolower(*s) - 'a' + 10;
1799 + else if (*s == '\n') {
1800 + if (*(s + 1) == '\0')
1801 + break;
1802 + else
1803 + return -EINVAL;
1804 + } else
1805 + return -EINVAL;
1806 +
1807 + if (val >= base)
1808 + return -EINVAL;
1809 + if (acc > div_u64(ULLONG_MAX - val, base))
1810 + return -ERANGE;
1811 + acc = acc * base + val;
1812 + ok = 1;
1813 +
1814 + s++;
1815 + }
1816 + if (!ok)
1817 + return -EINVAL;
1818 + *res = acc;
1819 + return 0;
1820 +}
1821 +
1822 +int kstrtoull(const char *s, unsigned int base, unsigned long long *res)
1823 +{
1824 + if (s[0] == '+')
1825 + s++;
1826 + return _kstrtoull(s, base, res);
1827 +}
1828 +EXPORT_SYMBOL(kstrtoull);
1829 +
1830 +int kstrtoll(const char *s, unsigned int base, long long *res)
1831 +{
1832 + unsigned long long tmp;
1833 + int rv;
1834 +
1835 + if (s[0] == '-') {
1836 + rv = _kstrtoull(s + 1, base, &tmp);
1837 + if (rv < 0)
1838 + return rv;
1839 + if ((long long)(-tmp) >= 0)
1840 + return -ERANGE;
1841 + *res = -tmp;
1842 + } else {
1843 + rv = kstrtoull(s, base, &tmp);
1844 + if (rv < 0)
1845 + return rv;
1846 + if ((long long)tmp < 0)
1847 + return -ERANGE;
1848 + *res = tmp;
1849 + }
1850 + return 0;
1851 +}
1852 +EXPORT_SYMBOL(kstrtoll);
1853 +
1854 +/* Internal, do not use. */
1855 +int _kstrtoul(const char *s, unsigned int base, unsigned long *res)
1856 +{
1857 + unsigned long long tmp;
1858 + int rv;
1859 +
1860 + rv = kstrtoull(s, base, &tmp);
1861 + if (rv < 0)
1862 + return rv;
1863 + if (tmp != (unsigned long long)(unsigned long)tmp)
1864 + return -ERANGE;
1865 + *res = tmp;
1866 + return 0;
1867 +}
1868 +EXPORT_SYMBOL(_kstrtoul);
1869 +
1870 +/* Internal, do not use. */
1871 +int _kstrtol(const char *s, unsigned int base, long *res)
1872 +{
1873 + long long tmp;
1874 + int rv;
1875 +
1876 + rv = kstrtoll(s, base, &tmp);
1877 + if (rv < 0)
1878 + return rv;
1879 + if (tmp != (long long)(long)tmp)
1880 + return -ERANGE;
1881 + *res = tmp;
1882 + return 0;
1883 +}
1884 +EXPORT_SYMBOL(_kstrtol);
1885 +
1886 +int kstrtouint(const char *s, unsigned int base, unsigned int *res)
1887 +{
1888 + unsigned long long tmp;
1889 + int rv;
1890 +
1891 + rv = kstrtoull(s, base, &tmp);
1892 + if (rv < 0)
1893 + return rv;
1894 + if (tmp != (unsigned long long)(unsigned int)tmp)
1895 + return -ERANGE;
1896 + *res = tmp;
1897 + return 0;
1898 +}
1899 +EXPORT_SYMBOL(kstrtouint);
1900 +
1901 +int kstrtoint(const char *s, unsigned int base, int *res)
1902 +{
1903 + long long tmp;
1904 + int rv;
1905 +
1906 + rv = kstrtoll(s, base, &tmp);
1907 + if (rv < 0)
1908 + return rv;
1909 + if (tmp != (long long)(int)tmp)
1910 + return -ERANGE;
1911 + *res = tmp;
1912 + return 0;
1913 +}
1914 +EXPORT_SYMBOL(kstrtoint);
1915 +
1916 +int kstrtou16(const char *s, unsigned int base, u16 *res)
1917 +{
1918 + unsigned long long tmp;
1919 + int rv;
1920 +
1921 + rv = kstrtoull(s, base, &tmp);
1922 + if (rv < 0)
1923 + return rv;
1924 + if (tmp != (unsigned long long)(u16)tmp)
1925 + return -ERANGE;
1926 + *res = tmp;
1927 + return 0;
1928 +}
1929 +EXPORT_SYMBOL(kstrtou16);
1930 +
1931 +int kstrtos16(const char *s, unsigned int base, s16 *res)
1932 +{
1933 + long long tmp;
1934 + int rv;
1935 +
1936 + rv = kstrtoll(s, base, &tmp);
1937 + if (rv < 0)
1938 + return rv;
1939 + if (tmp != (long long)(s16)tmp)
1940 + return -ERANGE;
1941 + *res = tmp;
1942 + return 0;
1943 +}
1944 +EXPORT_SYMBOL(kstrtos16);
1945 +
1946 +int kstrtou8(const char *s, unsigned int base, u8 *res)
1947 +{
1948 + unsigned long long tmp;
1949 + int rv;
1950 +
1951 + rv = kstrtoull(s, base, &tmp);
1952 + if (rv < 0)
1953 + return rv;
1954 + if (tmp != (unsigned long long)(u8)tmp)
1955 + return -ERANGE;
1956 + *res = tmp;
1957 + return 0;
1958 +}
1959 +EXPORT_SYMBOL(kstrtou8);
1960 +
1961 +int kstrtos8(const char *s, unsigned int base, s8 *res)
1962 +{
1963 + long long tmp;
1964 + int rv;
1965 +
1966 + rv = kstrtoll(s, base, &tmp);
1967 + if (rv < 0)
1968 + return rv;
1969 + if (tmp != (long long)(s8)tmp)
1970 + return -ERANGE;
1971 + *res = tmp;
1972 + return 0;
1973 +}
1974 +EXPORT_SYMBOL(kstrtos8);
1975 diff --git a/lib/test-kstrtox.c b/lib/test-kstrtox.c
1976 new file mode 100644
1977 index 0000000..325c2f9
1978 --- /dev/null
1979 +++ b/lib/test-kstrtox.c
1980 @@ -0,0 +1,739 @@
1981 +#include <linux/init.h>
1982 +#include <linux/kernel.h>
1983 +#include <linux/module.h>
1984 +
1985 +#define for_each_test(i, test) \
1986 + for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
1987 +
1988 +struct test_fail {
1989 + const char *str;
1990 + unsigned int base;
1991 +};
1992 +
1993 +#define DEFINE_TEST_FAIL(test) \
1994 + const struct test_fail test[] __initdata
1995 +
1996 +#define DECLARE_TEST_OK(type, test_type) \
1997 + test_type { \
1998 + const char *str; \
1999 + unsigned int base; \
2000 + type expected_res; \
2001 + }
2002 +
2003 +#define DEFINE_TEST_OK(type, test) \
2004 + const type test[] __initdata
2005 +
2006 +#define TEST_FAIL(fn, type, fmt, test) \
2007 +{ \
2008 + unsigned int i; \
2009 + \
2010 + for_each_test(i, test) { \
2011 + const struct test_fail *t = &test[i]; \
2012 + type tmp; \
2013 + int rv; \
2014 + \
2015 + tmp = 0; \
2016 + rv = fn(t->str, t->base, &tmp); \
2017 + if (rv >= 0) { \
2018 + WARN(1, "str '%s', base %u, expected -E, got %d/" fmt "\n", \
2019 + t->str, t->base, rv, tmp); \
2020 + continue; \
2021 + } \
2022 + } \
2023 +}
2024 +
2025 +#define TEST_OK(fn, type, fmt, test) \
2026 +{ \
2027 + unsigned int i; \
2028 + \
2029 + for_each_test(i, test) { \
2030 + const typeof(test[0]) *t = &test[i]; \
2031 + type res; \
2032 + int rv; \
2033 + \
2034 + rv = fn(t->str, t->base, &res); \
2035 + if (rv != 0) { \
2036 + WARN(1, "str '%s', base %u, expected 0/" fmt ", got %d\n", \
2037 + t->str, t->base, t->expected_res, rv); \
2038 + continue; \
2039 + } \
2040 + if (res != t->expected_res) { \
2041 + WARN(1, "str '%s', base %u, expected " fmt ", got " fmt "\n", \
2042 + t->str, t->base, t->expected_res, res); \
2043 + continue; \
2044 + } \
2045 + } \
2046 +}
2047 +
2048 +static void __init test_kstrtoull_ok(void)
2049 +{
2050 + DECLARE_TEST_OK(unsigned long long, struct test_ull);
2051 + static DEFINE_TEST_OK(struct test_ull, test_ull_ok) = {
2052 + {"0", 10, 0ULL},
2053 + {"1", 10, 1ULL},
2054 + {"127", 10, 127ULL},
2055 + {"128", 10, 128ULL},
2056 + {"129", 10, 129ULL},
2057 + {"255", 10, 255ULL},
2058 + {"256", 10, 256ULL},
2059 + {"257", 10, 257ULL},
2060 + {"32767", 10, 32767ULL},
2061 + {"32768", 10, 32768ULL},
2062 + {"32769", 10, 32769ULL},
2063 + {"65535", 10, 65535ULL},
2064 + {"65536", 10, 65536ULL},
2065 + {"65537", 10, 65537ULL},
2066 + {"2147483647", 10, 2147483647ULL},
2067 + {"2147483648", 10, 2147483648ULL},
2068 + {"2147483649", 10, 2147483649ULL},
2069 + {"4294967295", 10, 4294967295ULL},
2070 + {"4294967296", 10, 4294967296ULL},
2071 + {"4294967297", 10, 4294967297ULL},
2072 + {"9223372036854775807", 10, 9223372036854775807ULL},
2073 + {"9223372036854775808", 10, 9223372036854775808ULL},
2074 + {"9223372036854775809", 10, 9223372036854775809ULL},
2075 + {"18446744073709551614", 10, 18446744073709551614ULL},
2076 + {"18446744073709551615", 10, 18446744073709551615ULL},
2077 +
2078 + {"00", 8, 00ULL},
2079 + {"01", 8, 01ULL},
2080 + {"0177", 8, 0177ULL},
2081 + {"0200", 8, 0200ULL},
2082 + {"0201", 8, 0201ULL},
2083 + {"0377", 8, 0377ULL},
2084 + {"0400", 8, 0400ULL},
2085 + {"0401", 8, 0401ULL},
2086 + {"077777", 8, 077777ULL},
2087 + {"0100000", 8, 0100000ULL},
2088 + {"0100001", 8, 0100001ULL},
2089 + {"0177777", 8, 0177777ULL},
2090 + {"0200000", 8, 0200000ULL},
2091 + {"0200001", 8, 0200001ULL},
2092 + {"017777777777", 8, 017777777777ULL},
2093 + {"020000000000", 8, 020000000000ULL},
2094 + {"020000000001", 8, 020000000001ULL},
2095 + {"037777777777", 8, 037777777777ULL},
2096 + {"040000000000", 8, 040000000000ULL},
2097 + {"040000000001", 8, 040000000001ULL},
2098 + {"0777777777777777777777", 8, 0777777777777777777777ULL},
2099 + {"01000000000000000000000", 8, 01000000000000000000000ULL},
2100 + {"01000000000000000000001", 8, 01000000000000000000001ULL},
2101 + {"01777777777777777777776", 8, 01777777777777777777776ULL},
2102 + {"01777777777777777777777", 8, 01777777777777777777777ULL},
2103 +
2104 + {"0x0", 16, 0x0ULL},
2105 + {"0x1", 16, 0x1ULL},
2106 + {"0x7f", 16, 0x7fULL},
2107 + {"0x80", 16, 0x80ULL},
2108 + {"0x81", 16, 0x81ULL},
2109 + {"0xff", 16, 0xffULL},
2110 + {"0x100", 16, 0x100ULL},
2111 + {"0x101", 16, 0x101ULL},
2112 + {"0x7fff", 16, 0x7fffULL},
2113 + {"0x8000", 16, 0x8000ULL},
2114 + {"0x8001", 16, 0x8001ULL},
2115 + {"0xffff", 16, 0xffffULL},
2116 + {"0x10000", 16, 0x10000ULL},
2117 + {"0x10001", 16, 0x10001ULL},
2118 + {"0x7fffffff", 16, 0x7fffffffULL},
2119 + {"0x80000000", 16, 0x80000000ULL},
2120 + {"0x80000001", 16, 0x80000001ULL},
2121 + {"0xffffffff", 16, 0xffffffffULL},
2122 + {"0x100000000", 16, 0x100000000ULL},
2123 + {"0x100000001", 16, 0x100000001ULL},
2124 + {"0x7fffffffffffffff", 16, 0x7fffffffffffffffULL},
2125 + {"0x8000000000000000", 16, 0x8000000000000000ULL},
2126 + {"0x8000000000000001", 16, 0x8000000000000001ULL},
2127 + {"0xfffffffffffffffe", 16, 0xfffffffffffffffeULL},
2128 + {"0xffffffffffffffff", 16, 0xffffffffffffffffULL},
2129 +
2130 + {"0\n", 0, 0ULL},
2131 + };
2132 + TEST_OK(kstrtoull, unsigned long long, "%llu", test_ull_ok);
2133 +}
2134 +
2135 +static void __init test_kstrtoull_fail(void)
2136 +{
2137 + static DEFINE_TEST_FAIL(test_ull_fail) = {
2138 + {"", 0},
2139 + {"", 8},
2140 + {"", 10},
2141 + {"", 16},
2142 + {"\n", 0},
2143 + {"\n", 8},
2144 + {"\n", 10},
2145 + {"\n", 16},
2146 + {"\n0", 0},
2147 + {"\n0", 8},
2148 + {"\n0", 10},
2149 + {"\n0", 16},
2150 + {"+", 0},
2151 + {"+", 8},
2152 + {"+", 10},
2153 + {"+", 16},
2154 + {"-", 0},
2155 + {"-", 8},
2156 + {"-", 10},
2157 + {"-", 16},
2158 + {"0x", 0},
2159 + {"0x", 16},
2160 + {"0X", 0},
2161 + {"0X", 16},
2162 + {"0 ", 0},
2163 + {"1+", 0},
2164 + {"1-", 0},
2165 + {" 2", 0},
2166 + /* base autodetection */
2167 + {"0x0z", 0},
2168 + {"0z", 0},
2169 + {"a", 0},
2170 + /* digit >= base */
2171 + {"2", 2},
2172 + {"8", 8},
2173 + {"a", 10},
2174 + {"A", 10},
2175 + {"g", 16},
2176 + {"G", 16},
2177 + /* overflow */
2178 + {"10000000000000000000000000000000000000000000000000000000000000000", 2},
2179 + {"2000000000000000000000", 8},
2180 + {"18446744073709551616", 10},
2181 + {"10000000000000000", 16},
2182 + /* negative */
2183 + {"-0", 0},
2184 + {"-0", 8},
2185 + {"-0", 10},
2186 + {"-0", 16},
2187 + {"-1", 0},
2188 + {"-1", 8},
2189 + {"-1", 10},
2190 + {"-1", 16},
2191 + /* sign is first character if any */
2192 + {"-+1", 0},
2193 + {"-+1", 8},
2194 + {"-+1", 10},
2195 + {"-+1", 16},
2196 + /* nothing after \n */
2197 + {"0\n0", 0},
2198 + {"0\n0", 8},
2199 + {"0\n0", 10},
2200 + {"0\n0", 16},
2201 + {"0\n+", 0},
2202 + {"0\n+", 8},
2203 + {"0\n+", 10},
2204 + {"0\n+", 16},
2205 + {"0\n-", 0},
2206 + {"0\n-", 8},
2207 + {"0\n-", 10},
2208 + {"0\n-", 16},
2209 + {"0\n ", 0},
2210 + {"0\n ", 8},
2211 + {"0\n ", 10},
2212 + {"0\n ", 16},
2213 + };
2214 + TEST_FAIL(kstrtoull, unsigned long long, "%llu", test_ull_fail);
2215 +}
2216 +
2217 +static void __init test_kstrtoll_ok(void)
2218 +{
2219 + DECLARE_TEST_OK(long long, struct test_ll);
2220 + static DEFINE_TEST_OK(struct test_ll, test_ll_ok) = {
2221 + {"0", 10, 0LL},
2222 + {"1", 10, 1LL},
2223 + {"127", 10, 127LL},
2224 + {"128", 10, 128LL},
2225 + {"129", 10, 129LL},
2226 + {"255", 10, 255LL},
2227 + {"256", 10, 256LL},
2228 + {"257", 10, 257LL},
2229 + {"32767", 10, 32767LL},
2230 + {"32768", 10, 32768LL},
2231 + {"32769", 10, 32769LL},
2232 + {"65535", 10, 65535LL},
2233 + {"65536", 10, 65536LL},
2234 + {"65537", 10, 65537LL},
2235 + {"2147483647", 10, 2147483647LL},
2236 + {"2147483648", 10, 2147483648LL},
2237 + {"2147483649", 10, 2147483649LL},
2238 + {"4294967295", 10, 4294967295LL},
2239 + {"4294967296", 10, 4294967296LL},
2240 + {"4294967297", 10, 4294967297LL},
2241 + {"9223372036854775807", 10, 9223372036854775807LL},
2242 +
2243 + {"-1", 10, -1LL},
2244 + {"-2", 10, -2LL},
2245 + {"-9223372036854775808", 10, LLONG_MIN},
2246 + };
2247 + TEST_OK(kstrtoll, long long, "%lld", test_ll_ok);
2248 +}
2249 +
2250 +static void __init test_kstrtoll_fail(void)
2251 +{
2252 + static DEFINE_TEST_FAIL(test_ll_fail) = {
2253 + {"9223372036854775808", 10},
2254 + {"9223372036854775809", 10},
2255 + {"18446744073709551614", 10},
2256 + {"18446744073709551615", 10},
2257 + {"-9223372036854775809", 10},
2258 + {"-18446744073709551614", 10},
2259 + {"-18446744073709551615", 10},
2260 + /* negative zero isn't an integer in Linux */
2261 + {"-0", 0},
2262 + {"-0", 8},
2263 + {"-0", 10},
2264 + {"-0", 16},
2265 + /* sign is first character if any */
2266 + {"-+1", 0},
2267 + {"-+1", 8},
2268 + {"-+1", 10},
2269 + {"-+1", 16},
2270 + };
2271 + TEST_FAIL(kstrtoll, long long, "%lld", test_ll_fail);
2272 +}
2273 +
2274 +static void __init test_kstrtou64_ok(void)
2275 +{
2276 + DECLARE_TEST_OK(u64, struct test_u64);
2277 + static DEFINE_TEST_OK(struct test_u64, test_u64_ok) = {
2278 + {"0", 10, 0},
2279 + {"1", 10, 1},
2280 + {"126", 10, 126},
2281 + {"127", 10, 127},
2282 + {"128", 10, 128},
2283 + {"129", 10, 129},
2284 + {"254", 10, 254},
2285 + {"255", 10, 255},
2286 + {"256", 10, 256},
2287 + {"257", 10, 257},
2288 + {"32766", 10, 32766},
2289 + {"32767", 10, 32767},
2290 + {"32768", 10, 32768},
2291 + {"32769", 10, 32769},
2292 + {"65534", 10, 65534},
2293 + {"65535", 10, 65535},
2294 + {"65536", 10, 65536},
2295 + {"65537", 10, 65537},
2296 + {"2147483646", 10, 2147483646},
2297 + {"2147483647", 10, 2147483647},
2298 + {"2147483648", 10, 2147483648},
2299 + {"2147483649", 10, 2147483649},
2300 + {"4294967294", 10, 4294967294},
2301 + {"4294967295", 10, 4294967295},
2302 + {"4294967296", 10, 4294967296},
2303 + {"4294967297", 10, 4294967297},
2304 + {"9223372036854775806", 10, 9223372036854775806ULL},
2305 + {"9223372036854775807", 10, 9223372036854775807ULL},
2306 + {"9223372036854775808", 10, 9223372036854775808ULL},
2307 + {"9223372036854775809", 10, 9223372036854775809ULL},
2308 + {"18446744073709551614", 10, 18446744073709551614ULL},
2309 + {"18446744073709551615", 10, 18446744073709551615ULL},
2310 + };
2311 + TEST_OK(kstrtou64, u64, "%llu", test_u64_ok);
2312 +}
2313 +
2314 +static void __init test_kstrtou64_fail(void)
2315 +{
2316 + static DEFINE_TEST_FAIL(test_u64_fail) = {
2317 + {"-2", 10},
2318 + {"-1", 10},
2319 + {"18446744073709551616", 10},
2320 + {"18446744073709551617", 10},
2321 + };
2322 + TEST_FAIL(kstrtou64, u64, "%llu", test_u64_fail);
2323 +}
2324 +
2325 +static void __init test_kstrtos64_ok(void)
2326 +{
2327 + DECLARE_TEST_OK(s64, struct test_s64);
2328 + static DEFINE_TEST_OK(struct test_s64, test_s64_ok) = {
2329 + {"-128", 10, -128},
2330 + {"-127", 10, -127},
2331 + {"-1", 10, -1},
2332 + {"0", 10, 0},
2333 + {"1", 10, 1},
2334 + {"126", 10, 126},
2335 + {"127", 10, 127},
2336 + {"128", 10, 128},
2337 + {"129", 10, 129},
2338 + {"254", 10, 254},
2339 + {"255", 10, 255},
2340 + {"256", 10, 256},
2341 + {"257", 10, 257},
2342 + {"32766", 10, 32766},
2343 + {"32767", 10, 32767},
2344 + {"32768", 10, 32768},
2345 + {"32769", 10, 32769},
2346 + {"65534", 10, 65534},
2347 + {"65535", 10, 65535},
2348 + {"65536", 10, 65536},
2349 + {"65537", 10, 65537},
2350 + {"2147483646", 10, 2147483646},
2351 + {"2147483647", 10, 2147483647},
2352 + {"2147483648", 10, 2147483648},
2353 + {"2147483649", 10, 2147483649},
2354 + {"4294967294", 10, 4294967294},
2355 + {"4294967295", 10, 4294967295},
2356 + {"4294967296", 10, 4294967296},
2357 + {"4294967297", 10, 4294967297},
2358 + {"9223372036854775806", 10, 9223372036854775806LL},
2359 + {"9223372036854775807", 10, 9223372036854775807LL},
2360 + };
2361 + TEST_OK(kstrtos64, s64, "%lld", test_s64_ok);
2362 +}
2363 +
2364 +static void __init test_kstrtos64_fail(void)
2365 +{
2366 + static DEFINE_TEST_FAIL(test_s64_fail) = {
2367 + {"9223372036854775808", 10},
2368 + {"9223372036854775809", 10},
2369 + {"18446744073709551614", 10},
2370 + {"18446744073709551615", 10},
2371 + {"18446744073709551616", 10},
2372 + {"18446744073709551617", 10},
2373 + };
2374 + TEST_FAIL(kstrtos64, s64, "%lld", test_s64_fail);
2375 +}
2376 +
2377 +static void __init test_kstrtou32_ok(void)
2378 +{
2379 + DECLARE_TEST_OK(u32, struct test_u32);
2380 + static DEFINE_TEST_OK(struct test_u32, test_u32_ok) = {
2381 + {"0", 10, 0},
2382 + {"1", 10, 1},
2383 + {"126", 10, 126},
2384 + {"127", 10, 127},
2385 + {"128", 10, 128},
2386 + {"129", 10, 129},
2387 + {"254", 10, 254},
2388 + {"255", 10, 255},
2389 + {"256", 10, 256},
2390 + {"257", 10, 257},
2391 + {"32766", 10, 32766},
2392 + {"32767", 10, 32767},
2393 + {"32768", 10, 32768},
2394 + {"32769", 10, 32769},
2395 + {"65534", 10, 65534},
2396 + {"65535", 10, 65535},
2397 + {"65536", 10, 65536},
2398 + {"65537", 10, 65537},
2399 + {"2147483646", 10, 2147483646},
2400 + {"2147483647", 10, 2147483647},
2401 + {"2147483648", 10, 2147483648},
2402 + {"2147483649", 10, 2147483649},
2403 + {"4294967294", 10, 4294967294},
2404 + {"4294967295", 10, 4294967295},
2405 + };
2406 + TEST_OK(kstrtou32, u32, "%u", test_u32_ok);
2407 +}
2408 +
2409 +static void __init test_kstrtou32_fail(void)
2410 +{
2411 + static DEFINE_TEST_FAIL(test_u32_fail) = {
2412 + {"-2", 10},
2413 + {"-1", 10},
2414 + {"4294967296", 10},
2415 + {"4294967297", 10},
2416 + {"9223372036854775806", 10},
2417 + {"9223372036854775807", 10},
2418 + {"9223372036854775808", 10},
2419 + {"9223372036854775809", 10},
2420 + {"18446744073709551614", 10},
2421 + {"18446744073709551615", 10},
2422 + {"18446744073709551616", 10},
2423 + {"18446744073709551617", 10},
2424 + };
2425 + TEST_FAIL(kstrtou32, u32, "%u", test_u32_fail);
2426 +}
2427 +
2428 +static void __init test_kstrtos32_ok(void)
2429 +{
2430 + DECLARE_TEST_OK(s32, struct test_s32);
2431 + static DEFINE_TEST_OK(struct test_s32, test_s32_ok) = {
2432 + {"-128", 10, -128},
2433 + {"-127", 10, -127},
2434 + {"-1", 10, -1},
2435 + {"0", 10, 0},
2436 + {"1", 10, 1},
2437 + {"126", 10, 126},
2438 + {"127", 10, 127},
2439 + {"128", 10, 128},
2440 + {"129", 10, 129},
2441 + {"254", 10, 254},
2442 + {"255", 10, 255},
2443 + {"256", 10, 256},
2444 + {"257", 10, 257},
2445 + {"32766", 10, 32766},
2446 + {"32767", 10, 32767},
2447 + {"32768", 10, 32768},
2448 + {"32769", 10, 32769},
2449 + {"65534", 10, 65534},
2450 + {"65535", 10, 65535},
2451 + {"65536", 10, 65536},
2452 + {"65537", 10, 65537},
2453 + {"2147483646", 10, 2147483646},
2454 + {"2147483647", 10, 2147483647},
2455 + };
2456 + TEST_OK(kstrtos32, s32, "%d", test_s32_ok);
2457 +}
2458 +
2459 +static void __init test_kstrtos32_fail(void)
2460 +{
2461 + static DEFINE_TEST_FAIL(test_s32_fail) = {
2462 + {"2147483648", 10},
2463 + {"2147483649", 10},
2464 + {"4294967294", 10},
2465 + {"4294967295", 10},
2466 + {"4294967296", 10},
2467 + {"4294967297", 10},
2468 + {"9223372036854775806", 10},
2469 + {"9223372036854775807", 10},
2470 + {"9223372036854775808", 10},
2471 + {"9223372036854775809", 10},
2472 + {"18446744073709551614", 10},
2473 + {"18446744073709551615", 10},
2474 + {"18446744073709551616", 10},
2475 + {"18446744073709551617", 10},
2476 + };
2477 + TEST_FAIL(kstrtos32, s32, "%d", test_s32_fail);
2478 +}
2479 +
2480 +static void __init test_kstrtou16_ok(void)
2481 +{
2482 + DECLARE_TEST_OK(u16, struct test_u16);
2483 + static DEFINE_TEST_OK(struct test_u16, test_u16_ok) = {
2484 + {"0", 10, 0},
2485 + {"1", 10, 1},
2486 + {"126", 10, 126},
2487 + {"127", 10, 127},
2488 + {"128", 10, 128},
2489 + {"129", 10, 129},
2490 + {"254", 10, 254},
2491 + {"255", 10, 255},
2492 + {"256", 10, 256},
2493 + {"257", 10, 257},
2494 + {"32766", 10, 32766},
2495 + {"32767", 10, 32767},
2496 + {"32768", 10, 32768},
2497 + {"32769", 10, 32769},
2498 + {"65534", 10, 65534},
2499 + {"65535", 10, 65535},
2500 + };
2501 + TEST_OK(kstrtou16, u16, "%hu", test_u16_ok);
2502 +}
2503 +
2504 +static void __init test_kstrtou16_fail(void)
2505 +{
2506 + static DEFINE_TEST_FAIL(test_u16_fail) = {
2507 + {"-2", 10},
2508 + {"-1", 10},
2509 + {"65536", 10},
2510 + {"65537", 10},
2511 + {"2147483646", 10},
2512 + {"2147483647", 10},
2513 + {"2147483648", 10},
2514 + {"2147483649", 10},
2515 + {"4294967294", 10},
2516 + {"4294967295", 10},
2517 + {"4294967296", 10},
2518 + {"4294967297", 10},
2519 + {"9223372036854775806", 10},
2520 + {"9223372036854775807", 10},
2521 + {"9223372036854775808", 10},
2522 + {"9223372036854775809", 10},
2523 + {"18446744073709551614", 10},
2524 + {"18446744073709551615", 10},
2525 + {"18446744073709551616", 10},
2526 + {"18446744073709551617", 10},
2527 + };
2528 + TEST_FAIL(kstrtou16, u16, "%hu", test_u16_fail);
2529 +}
2530 +
2531 +static void __init test_kstrtos16_ok(void)
2532 +{
2533 + DECLARE_TEST_OK(s16, struct test_s16);
2534 + static DEFINE_TEST_OK(struct test_s16, test_s16_ok) = {
2535 + {"-130", 10, -130},
2536 + {"-129", 10, -129},
2537 + {"-128", 10, -128},
2538 + {"-127", 10, -127},
2539 + {"-1", 10, -1},
2540 + {"0", 10, 0},
2541 + {"1", 10, 1},
2542 + {"126", 10, 126},
2543 + {"127", 10, 127},
2544 + {"128", 10, 128},
2545 + {"129", 10, 129},
2546 + {"254", 10, 254},
2547 + {"255", 10, 255},
2548 + {"256", 10, 256},
2549 + {"257", 10, 257},
2550 + {"32766", 10, 32766},
2551 + {"32767", 10, 32767},
2552 + };
2553 + TEST_OK(kstrtos16, s16, "%hd", test_s16_ok);
2554 +}
2555 +
2556 +static void __init test_kstrtos16_fail(void)
2557 +{
2558 + static DEFINE_TEST_FAIL(test_s16_fail) = {
2559 + {"32768", 10},
2560 + {"32769", 10},
2561 + {"65534", 10},
2562 + {"65535", 10},
2563 + {"65536", 10},
2564 + {"65537", 10},
2565 + {"2147483646", 10},
2566 + {"2147483647", 10},
2567 + {"2147483648", 10},
2568 + {"2147483649", 10},
2569 + {"4294967294", 10},
2570 + {"4294967295", 10},
2571 + {"4294967296", 10},
2572 + {"4294967297", 10},
2573 + {"9223372036854775806", 10},
2574 + {"9223372036854775807", 10},
2575 + {"9223372036854775808", 10},
2576 + {"9223372036854775809", 10},
2577 + {"18446744073709551614", 10},
2578 + {"18446744073709551615", 10},
2579 + {"18446744073709551616", 10},
2580 + {"18446744073709551617", 10},
2581 + };
2582 + TEST_FAIL(kstrtos16, s16, "%hd", test_s16_fail);
2583 +}
2584 +
2585 +static void __init test_kstrtou8_ok(void)
2586 +{
2587 + DECLARE_TEST_OK(u8, struct test_u8);
2588 + static DEFINE_TEST_OK(struct test_u8, test_u8_ok) = {
2589 + {"0", 10, 0},
2590 + {"1", 10, 1},
2591 + {"126", 10, 126},
2592 + {"127", 10, 127},
2593 + {"128", 10, 128},
2594 + {"129", 10, 129},
2595 + {"254", 10, 254},
2596 + {"255", 10, 255},
2597 + };
2598 + TEST_OK(kstrtou8, u8, "%hhu", test_u8_ok);
2599 +}
2600 +
2601 +static void __init test_kstrtou8_fail(void)
2602 +{
2603 + static DEFINE_TEST_FAIL(test_u8_fail) = {
2604 + {"-2", 10},
2605 + {"-1", 10},
2606 + {"256", 10},
2607 + {"257", 10},
2608 + {"32766", 10},
2609 + {"32767", 10},
2610 + {"32768", 10},
2611 + {"32769", 10},
2612 + {"65534", 10},
2613 + {"65535", 10},
2614 + {"65536", 10},
2615 + {"65537", 10},
2616 + {"2147483646", 10},
2617 + {"2147483647", 10},
2618 + {"2147483648", 10},
2619 + {"2147483649", 10},
2620 + {"4294967294", 10},
2621 + {"4294967295", 10},
2622 + {"4294967296", 10},
2623 + {"4294967297", 10},
2624 + {"9223372036854775806", 10},
2625 + {"9223372036854775807", 10},
2626 + {"9223372036854775808", 10},
2627 + {"9223372036854775809", 10},
2628 + {"18446744073709551614", 10},
2629 + {"18446744073709551615", 10},
2630 + {"18446744073709551616", 10},
2631 + {"18446744073709551617", 10},
2632 + };
2633 + TEST_FAIL(kstrtou8, u8, "%hhu", test_u8_fail);
2634 +}
2635 +
2636 +static void __init test_kstrtos8_ok(void)
2637 +{
2638 + DECLARE_TEST_OK(s8, struct test_s8);
2639 + static DEFINE_TEST_OK(struct test_s8, test_s8_ok) = {
2640 + {"-128", 10, -128},
2641 + {"-127", 10, -127},
2642 + {"-1", 10, -1},
2643 + {"0", 10, 0},
2644 + {"1", 10, 1},
2645 + {"126", 10, 126},
2646 + {"127", 10, 127},
2647 + };
2648 + TEST_OK(kstrtos8, s8, "%hhd", test_s8_ok);
2649 +}
2650 +
2651 +static void __init test_kstrtos8_fail(void)
2652 +{
2653 + static DEFINE_TEST_FAIL(test_s8_fail) = {
2654 + {"-130", 10},
2655 + {"-129", 10},
2656 + {"128", 10},
2657 + {"129", 10},
2658 + {"254", 10},
2659 + {"255", 10},
2660 + {"256", 10},
2661 + {"257", 10},
2662 + {"32766", 10},
2663 + {"32767", 10},
2664 + {"32768", 10},
2665 + {"32769", 10},
2666 + {"65534", 10},
2667 + {"65535", 10},
2668 + {"65536", 10},
2669 + {"65537", 10},
2670 + {"2147483646", 10},
2671 + {"2147483647", 10},
2672 + {"2147483648", 10},
2673 + {"2147483649", 10},
2674 + {"4294967294", 10},
2675 + {"4294967295", 10},
2676 + {"4294967296", 10},
2677 + {"4294967297", 10},
2678 + {"9223372036854775806", 10},
2679 + {"9223372036854775807", 10},
2680 + {"9223372036854775808", 10},
2681 + {"9223372036854775809", 10},
2682 + {"18446744073709551614", 10},
2683 + {"18446744073709551615", 10},
2684 + {"18446744073709551616", 10},
2685 + {"18446744073709551617", 10},
2686 + };
2687 + TEST_FAIL(kstrtos8, s8, "%hhd", test_s8_fail);
2688 +}
2689 +
2690 +static int __init test_kstrtox_init(void)
2691 +{
2692 + test_kstrtoull_ok();
2693 + test_kstrtoull_fail();
2694 + test_kstrtoll_ok();
2695 + test_kstrtoll_fail();
2696 +
2697 + test_kstrtou64_ok();
2698 + test_kstrtou64_fail();
2699 + test_kstrtos64_ok();
2700 + test_kstrtos64_fail();
2701 +
2702 + test_kstrtou32_ok();
2703 + test_kstrtou32_fail();
2704 + test_kstrtos32_ok();
2705 + test_kstrtos32_fail();
2706 +
2707 + test_kstrtou16_ok();
2708 + test_kstrtou16_fail();
2709 + test_kstrtos16_ok();
2710 + test_kstrtos16_fail();
2711 +
2712 + test_kstrtou8_ok();
2713 + test_kstrtou8_fail();
2714 + test_kstrtos8_ok();
2715 + test_kstrtos8_fail();
2716 + return -EINVAL;
2717 +}
2718 +module_init(test_kstrtox_init);
2719 +MODULE_LICENSE("Dual BSD/GPL");
2720 diff --git a/lib/vsprintf.c b/lib/vsprintf.c
2721 index d3023df..f3fd99a 100644
2722 --- a/lib/vsprintf.c
2723 +++ b/lib/vsprintf.c
2724 @@ -120,147 +120,6 @@ long long simple_strtoll(const char *cp, char **endp, unsigned int base)
2725 }
2726 EXPORT_SYMBOL(simple_strtoll);
2727
2728 -/**
2729 - * strict_strtoul - convert a string to an unsigned long strictly
2730 - * @cp: The string to be converted
2731 - * @base: The number base to use
2732 - * @res: The converted result value
2733 - *
2734 - * strict_strtoul converts a string to an unsigned long only if the
2735 - * string is really an unsigned long string, any string containing
2736 - * any invalid char at the tail will be rejected and -EINVAL is returned,
2737 - * only a newline char at the tail is acceptible because people generally
2738 - * change a module parameter in the following way:
2739 - *
2740 - * echo 1024 > /sys/module/e1000/parameters/copybreak
2741 - *
2742 - * echo will append a newline to the tail.
2743 - *
2744 - * It returns 0 if conversion is successful and *res is set to the converted
2745 - * value, otherwise it returns -EINVAL and *res is set to 0.
2746 - *
2747 - * simple_strtoul just ignores the successive invalid characters and
2748 - * return the converted value of prefix part of the string.
2749 - */
2750 -int strict_strtoul(const char *cp, unsigned int base, unsigned long *res)
2751 -{
2752 - char *tail;
2753 - unsigned long val;
2754 -
2755 - *res = 0;
2756 - if (!*cp)
2757 - return -EINVAL;
2758 -
2759 - val = simple_strtoul(cp, &tail, base);
2760 - if (tail == cp)
2761 - return -EINVAL;
2762 -
2763 - if ((tail[0] == '\0') || (tail[0] == '\n' && tail[1] == '\0')) {
2764 - *res = val;
2765 - return 0;
2766 - }
2767 -
2768 - return -EINVAL;
2769 -}
2770 -EXPORT_SYMBOL(strict_strtoul);
2771 -
2772 -/**
2773 - * strict_strtol - convert a string to a long strictly
2774 - * @cp: The string to be converted
2775 - * @base: The number base to use
2776 - * @res: The converted result value
2777 - *
2778 - * strict_strtol is similiar to strict_strtoul, but it allows the first
2779 - * character of a string is '-'.
2780 - *
2781 - * It returns 0 if conversion is successful and *res is set to the converted
2782 - * value, otherwise it returns -EINVAL and *res is set to 0.
2783 - */
2784 -int strict_strtol(const char *cp, unsigned int base, long *res)
2785 -{
2786 - int ret;
2787 - if (*cp == '-') {
2788 - ret = strict_strtoul(cp + 1, base, (unsigned long *)res);
2789 - if (!ret)
2790 - *res = -(*res);
2791 - } else {
2792 - ret = strict_strtoul(cp, base, (unsigned long *)res);
2793 - }
2794 -
2795 - return ret;
2796 -}
2797 -EXPORT_SYMBOL(strict_strtol);
2798 -
2799 -/**
2800 - * strict_strtoull - convert a string to an unsigned long long strictly
2801 - * @cp: The string to be converted
2802 - * @base: The number base to use
2803 - * @res: The converted result value
2804 - *
2805 - * strict_strtoull converts a string to an unsigned long long only if the
2806 - * string is really an unsigned long long string, any string containing
2807 - * any invalid char at the tail will be rejected and -EINVAL is returned,
2808 - * only a newline char at the tail is acceptible because people generally
2809 - * change a module parameter in the following way:
2810 - *
2811 - * echo 1024 > /sys/module/e1000/parameters/copybreak
2812 - *
2813 - * echo will append a newline to the tail of the string.
2814 - *
2815 - * It returns 0 if conversion is successful and *res is set to the converted
2816 - * value, otherwise it returns -EINVAL and *res is set to 0.
2817 - *
2818 - * simple_strtoull just ignores the successive invalid characters and
2819 - * return the converted value of prefix part of the string.
2820 - */
2821 -int strict_strtoull(const char *cp, unsigned int base, unsigned long long *res)
2822 -{
2823 - char *tail;
2824 - unsigned long long val;
2825 -
2826 - *res = 0;
2827 - if (!*cp)
2828 - return -EINVAL;
2829 -
2830 - val = simple_strtoull(cp, &tail, base);
2831 - if (tail == cp)
2832 - return -EINVAL;
2833 - if ((tail[0] == '\0') || (tail[0] == '\n' && tail[1] == '\0')) {
2834 - *res = val;
2835 - return 0;
2836 - }
2837 -
2838 - return -EINVAL;
2839 -}
2840 -EXPORT_SYMBOL(strict_strtoull);
2841 -
2842 -/**
2843 - * strict_strtoll - convert a string to a long long strictly
2844 - * @cp: The string to be converted
2845 - * @base: The number base to use
2846 - * @res: The converted result value
2847 - *
2848 - * strict_strtoll is similiar to strict_strtoull, but it allows the first
2849 - * character of a string is '-'.
2850 - *
2851 - * It returns 0 if conversion is successful and *res is set to the converted
2852 - * value, otherwise it returns -EINVAL and *res is set to 0.
2853 - */
2854 -int strict_strtoll(const char *cp, unsigned int base, long long *res)
2855 -{
2856 - int ret;
2857 - if (*cp == '-') {
2858 - ret = strict_strtoull(cp + 1, base, (unsigned long long *)res);
2859 - if (!ret)
2860 - *res = -(*res);
2861 - } else {
2862 - ret = strict_strtoull(cp, base, (unsigned long long *)res);
2863 - }
2864 -
2865 - return ret;
2866 -}
2867 -EXPORT_SYMBOL(strict_strtoll);
2868 -
2869 static noinline_for_stack
2870 int skip_atoi(const char **s)
2871 {
2872 diff --git a/mm/huge_memory.c b/mm/huge_memory.c
2873 index 113e35c..8f76561 100644
2874 --- a/mm/huge_memory.c
2875 +++ b/mm/huge_memory.c
2876 @@ -244,24 +244,28 @@ static ssize_t single_flag_show(struct kobject *kobj,
2877 struct kobj_attribute *attr, char *buf,
2878 enum transparent_hugepage_flag flag)
2879 {
2880 - if (test_bit(flag, &transparent_hugepage_flags))
2881 - return sprintf(buf, "[yes] no\n");
2882 - else
2883 - return sprintf(buf, "yes [no]\n");
2884 + return sprintf(buf, "%d\n",
2885 + !!test_bit(flag, &transparent_hugepage_flags));
2886 }
2887 +
2888 static ssize_t single_flag_store(struct kobject *kobj,
2889 struct kobj_attribute *attr,
2890 const char *buf, size_t count,
2891 enum transparent_hugepage_flag flag)
2892 {
2893 - if (!memcmp("yes", buf,
2894 - min(sizeof("yes")-1, count))) {
2895 + unsigned long value;
2896 + int ret;
2897 +
2898 + ret = kstrtoul(buf, 10, &value);
2899 + if (ret < 0)
2900 + return ret;
2901 + if (value > 1)
2902 + return -EINVAL;
2903 +
2904 + if (value)
2905 set_bit(flag, &transparent_hugepage_flags);
2906 - } else if (!memcmp("no", buf,
2907 - min(sizeof("no")-1, count))) {
2908 + else
2909 clear_bit(flag, &transparent_hugepage_flags);
2910 - } else
2911 - return -EINVAL;
2912
2913 return count;
2914 }
2915 diff --git a/mm/memory.c b/mm/memory.c
2916 index 5823698..f17746a 100644
2917 --- a/mm/memory.c
2918 +++ b/mm/memory.c
2919 @@ -1410,6 +1410,13 @@ no_page_table:
2920 return page;
2921 }
2922
2923 +static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
2924 +{
2925 + return (vma->vm_flags & VM_GROWSDOWN) &&
2926 + (vma->vm_start == addr) &&
2927 + !vma_stack_continue(vma->vm_prev, addr);
2928 +}
2929 +
2930 int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2931 unsigned long start, int nr_pages, unsigned int gup_flags,
2932 struct page **pages, struct vm_area_struct **vmas,
2933 @@ -1439,7 +1446,6 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2934 vma = find_extend_vma(mm, start);
2935 if (!vma && in_gate_area(tsk, start)) {
2936 unsigned long pg = start & PAGE_MASK;
2937 - struct vm_area_struct *gate_vma = get_gate_vma(tsk);
2938 pgd_t *pgd;
2939 pud_t *pud;
2940 pmd_t *pmd;
2941 @@ -1464,10 +1470,11 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2942 pte_unmap(pte);
2943 return i ? : -EFAULT;
2944 }
2945 + vma = get_gate_vma(tsk);
2946 if (pages) {
2947 struct page *page;
2948
2949 - page = vm_normal_page(gate_vma, start, *pte);
2950 + page = vm_normal_page(vma, start, *pte);
2951 if (!page) {
2952 if (!(gup_flags & FOLL_DUMP) &&
2953 is_zero_pfn(pte_pfn(*pte)))
2954 @@ -1481,12 +1488,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2955 get_page(page);
2956 }
2957 pte_unmap(pte);
2958 - if (vmas)
2959 - vmas[i] = gate_vma;
2960 - i++;
2961 - start += PAGE_SIZE;
2962 - nr_pages--;
2963 - continue;
2964 + goto next_page;
2965 }
2966
2967 if (!vma ||
2968 @@ -1500,6 +1502,13 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2969 continue;
2970 }
2971
2972 + /*
2973 + * If we don't actually want the page itself,
2974 + * and it's the stack guard page, just skip it.
2975 + */
2976 + if (!pages && stack_guard_page(vma, start))
2977 + goto next_page;
2978 +
2979 do {
2980 struct page *page;
2981 unsigned int foll_flags = gup_flags;
2982 @@ -1569,6 +1578,7 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
2983 flush_anon_page(vma, page, start);
2984 flush_dcache_page(page);
2985 }
2986 +next_page:
2987 if (vmas)
2988 vmas[i] = vma;
2989 i++;
2990 diff --git a/mm/mlock.c b/mm/mlock.c
2991 index c3924c7f..da23be4 100644
2992 --- a/mm/mlock.c
2993 +++ b/mm/mlock.c
2994 @@ -135,13 +135,6 @@ void munlock_vma_page(struct page *page)
2995 }
2996 }
2997
2998 -static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr)
2999 -{
3000 - return (vma->vm_flags & VM_GROWSDOWN) &&
3001 - (vma->vm_start == addr) &&
3002 - !vma_stack_continue(vma->vm_prev, addr);
3003 -}
3004 -
3005 /**
3006 * __mlock_vma_pages_range() - mlock a range of pages in the vma.
3007 * @vma: target vma
3008 @@ -188,12 +181,6 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
3009 if (vma->vm_flags & VM_LOCKED)
3010 gup_flags |= FOLL_MLOCK;
3011
3012 - /* We don't try to access the guard page of a stack vma */
3013 - if (stack_guard_page(vma, start)) {
3014 - addr += PAGE_SIZE;
3015 - nr_pages--;
3016 - }
3017 -
3018 return __get_user_pages(current, mm, addr, nr_pages, gup_flags,
3019 NULL, NULL, nonblocking);
3020 }
3021 diff --git a/mm/mmap.c b/mm/mmap.c
3022 index 2ec8eb5..e27e0cf 100644
3023 --- a/mm/mmap.c
3024 +++ b/mm/mmap.c
3025 @@ -259,7 +259,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
3026 * randomize_va_space to 2, which will still cause mm->start_brk
3027 * to be arbitrarily shifted
3028 */
3029 - if (mm->start_brk > PAGE_ALIGN(mm->end_data))
3030 + if (current->brk_randomized)
3031 min_brk = mm->start_brk;
3032 else
3033 min_brk = mm->end_data;
3034 @@ -1814,11 +1814,14 @@ static int expand_downwards(struct vm_area_struct *vma,
3035 size = vma->vm_end - address;
3036 grow = (vma->vm_start - address) >> PAGE_SHIFT;
3037
3038 - error = acct_stack_growth(vma, size, grow);
3039 - if (!error) {
3040 - vma->vm_start = address;
3041 - vma->vm_pgoff -= grow;
3042 - perf_event_mmap(vma);
3043 + error = -ENOMEM;
3044 + if (grow <= vma->vm_pgoff) {
3045 + error = acct_stack_growth(vma, size, grow);
3046 + if (!error) {
3047 + vma->vm_start = address;
3048 + vma->vm_pgoff -= grow;
3049 + perf_event_mmap(vma);
3050 + }
3051 }
3052 }
3053 vma_unlock_anon_vma(vma);
3054 diff --git a/mm/oom_kill.c b/mm/oom_kill.c
3055 index 33b5861..ea16f72 100644
3056 --- a/mm/oom_kill.c
3057 +++ b/mm/oom_kill.c
3058 @@ -84,24 +84,6 @@ static bool has_intersects_mems_allowed(struct task_struct *tsk,
3059 #endif /* CONFIG_NUMA */
3060
3061 /*
3062 - * If this is a system OOM (not a memcg OOM) and the task selected to be
3063 - * killed is not already running at high (RT) priorities, speed up the
3064 - * recovery by boosting the dying task to the lowest FIFO priority.
3065 - * That helps with the recovery and avoids interfering with RT tasks.
3066 - */
3067 -static void boost_dying_task_prio(struct task_struct *p,
3068 - struct mem_cgroup *mem)
3069 -{
3070 - struct sched_param param = { .sched_priority = 1 };
3071 -
3072 - if (mem)
3073 - return;
3074 -
3075 - if (!rt_task(p))
3076 - sched_setscheduler_nocheck(p, SCHED_FIFO, &param);
3077 -}
3078 -
3079 -/*
3080 * The process p may have detached its own ->mm while exiting or through
3081 * use_mm(), but one or more of its subthreads may still have a valid
3082 * pointer. Return p, or any of its subthreads with a valid ->mm, with
3083 @@ -452,13 +434,6 @@ static int oom_kill_task(struct task_struct *p, struct mem_cgroup *mem)
3084 set_tsk_thread_flag(p, TIF_MEMDIE);
3085 force_sig(SIGKILL, p);
3086
3087 - /*
3088 - * We give our sacrificial lamb high priority and access to
3089 - * all the memory it needs. That way it should be able to
3090 - * exit() and clear out its resources quickly...
3091 - */
3092 - boost_dying_task_prio(p, mem);
3093 -
3094 return 0;
3095 }
3096 #undef K
3097 @@ -482,7 +457,6 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
3098 */
3099 if (p->flags & PF_EXITING) {
3100 set_tsk_thread_flag(p, TIF_MEMDIE);
3101 - boost_dying_task_prio(p, mem);
3102 return 0;
3103 }
3104
3105 @@ -701,7 +675,6 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
3106 */
3107 if (fatal_signal_pending(current)) {
3108 set_thread_flag(TIF_MEMDIE);
3109 - boost_dying_task_prio(current, NULL);
3110 return;
3111 }
3112
3113 diff --git a/mm/vmscan.c b/mm/vmscan.c
3114 index 3b4a41d..0665520 100644
3115 --- a/mm/vmscan.c
3116 +++ b/mm/vmscan.c
3117 @@ -41,6 +41,7 @@
3118 #include <linux/memcontrol.h>
3119 #include <linux/delayacct.h>
3120 #include <linux/sysctl.h>
3121 +#include <linux/oom.h>
3122
3123 #include <asm/tlbflush.h>
3124 #include <asm/div64.h>
3125 @@ -1988,17 +1989,12 @@ static bool zone_reclaimable(struct zone *zone)
3126 return zone->pages_scanned < zone_reclaimable_pages(zone) * 6;
3127 }
3128
3129 -/*
3130 - * As hibernation is going on, kswapd is freezed so that it can't mark
3131 - * the zone into all_unreclaimable. It can't handle OOM during hibernation.
3132 - * So let's check zone's unreclaimable in direct reclaim as well as kswapd.
3133 - */
3134 +/* All zones in zonelist are unreclaimable? */
3135 static bool all_unreclaimable(struct zonelist *zonelist,
3136 struct scan_control *sc)
3137 {
3138 struct zoneref *z;
3139 struct zone *zone;
3140 - bool all_unreclaimable = true;
3141
3142 for_each_zone_zonelist_nodemask(zone, z, zonelist,
3143 gfp_zone(sc->gfp_mask), sc->nodemask) {
3144 @@ -2006,13 +2002,11 @@ static bool all_unreclaimable(struct zonelist *zonelist,
3145 continue;
3146 if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL))
3147 continue;
3148 - if (zone_reclaimable(zone)) {
3149 - all_unreclaimable = false;
3150 - break;
3151 - }
3152 + if (!zone->all_unreclaimable)
3153 + return false;
3154 }
3155
3156 - return all_unreclaimable;
3157 + return true;
3158 }
3159
3160 /*
3161 @@ -2108,6 +2102,14 @@ out:
3162 if (sc->nr_reclaimed)
3163 return sc->nr_reclaimed;
3164
3165 + /*
3166 + * As hibernation is going on, kswapd is freezed so that it can't mark
3167 + * the zone into all_unreclaimable. Thus bypassing all_unreclaimable
3168 + * check.
3169 + */
3170 + if (oom_killer_disabled)
3171 + return 0;
3172 +
3173 /* top priority shrink_zones still had more to do? don't OOM, then */
3174 if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc))
3175 return 1;
3176 diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
3177 index be73753..ed68d07 100644
3178 --- a/net/8021q/vlan_dev.c
3179 +++ b/net/8021q/vlan_dev.c
3180 @@ -707,6 +707,7 @@ static int vlan_dev_init(struct net_device *dev)
3181 dev->fcoe_ddp_xid = real_dev->fcoe_ddp_xid;
3182 #endif
3183
3184 + dev->needed_headroom = real_dev->needed_headroom;
3185 if (real_dev->features & NETIF_F_HW_VLAN_TX) {
3186 dev->header_ops = real_dev->header_ops;
3187 dev->hard_header_len = real_dev->hard_header_len;
3188 diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
3189 index 9c4541b..7d0a304 100644
3190 --- a/net/bluetooth/hci_core.c
3191 +++ b/net/bluetooth/hci_core.c
3192 @@ -184,6 +184,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt)
3193 BT_DBG("%s %ld", hdev->name, opt);
3194
3195 /* Reset device */
3196 + set_bit(HCI_RESET, &hdev->flags);
3197 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
3198 }
3199
3200 @@ -210,8 +211,10 @@ static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
3201 /* Mandatory initialization */
3202
3203 /* Reset */
3204 - if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks))
3205 + if (!test_bit(HCI_QUIRK_NO_RESET, &hdev->quirks)) {
3206 + set_bit(HCI_RESET, &hdev->flags);
3207 hci_send_cmd(hdev, HCI_OP_RESET, 0, NULL);
3208 + }
3209
3210 /* Read Local Supported Features */
3211 hci_send_cmd(hdev, HCI_OP_READ_LOCAL_FEATURES, 0, NULL);
3212 diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
3213 index a290854..a63bcf0 100644
3214 --- a/net/bluetooth/hci_event.c
3215 +++ b/net/bluetooth/hci_event.c
3216 @@ -183,6 +183,8 @@ static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb)
3217
3218 BT_DBG("%s status 0x%x", hdev->name, status);
3219
3220 + clear_bit(HCI_RESET, &hdev->flags);
3221 +
3222 hci_req_complete(hdev, HCI_OP_RESET, status);
3223 }
3224
3225 @@ -1464,7 +1466,7 @@ static inline void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
3226 break;
3227 }
3228
3229 - if (ev->ncmd) {
3230 + if (ev->ncmd && !test_bit(HCI_RESET, &hdev->flags)) {
3231 atomic_set(&hdev->cmd_cnt, 1);
3232 if (!skb_queue_empty(&hdev->cmd_q))
3233 tasklet_schedule(&hdev->cmd_task);
3234 diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
3235 index 030a002..f61eb2e 100644
3236 --- a/net/bridge/br_multicast.c
3237 +++ b/net/bridge/br_multicast.c
3238 @@ -445,9 +445,9 @@ static struct sk_buff *br_ip6_multicast_alloc_query(struct net_bridge *br,
3239 ip6h->payload_len = htons(8 + sizeof(*mldq));
3240 ip6h->nexthdr = IPPROTO_HOPOPTS;
3241 ip6h->hop_limit = 1;
3242 + ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1));
3243 ipv6_dev_get_saddr(dev_net(br->dev), br->dev, &ip6h->daddr, 0,
3244 &ip6h->saddr);
3245 - ipv6_addr_set(&ip6h->daddr, htonl(0xff020000), 0, 0, htonl(1));
3246 ipv6_eth_mc_map(&ip6h->daddr, eth->h_dest);
3247
3248 hopopt = (u8 *)(ip6h + 1);
3249 diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
3250 index 4b5b66d..333bcaa 100644
3251 --- a/net/bridge/br_netfilter.c
3252 +++ b/net/bridge/br_netfilter.c
3253 @@ -249,11 +249,9 @@ static int br_parse_ip_options(struct sk_buff *skb)
3254 goto drop;
3255 }
3256
3257 - /* Zero out the CB buffer if no options present */
3258 - if (iph->ihl == 5) {
3259 - memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
3260 + memset(IPCB(skb), 0, sizeof(struct inet_skb_parm));
3261 + if (iph->ihl == 5)
3262 return 0;
3263 - }
3264
3265 opt->optlen = iph->ihl*4 - sizeof(struct iphdr);
3266 if (ip_options_compile(dev_net(dev), opt, skb))
3267 @@ -741,6 +739,9 @@ static unsigned int br_nf_forward_ip(unsigned int hook, struct sk_buff *skb,
3268 nf_bridge->mask |= BRNF_PKT_TYPE;
3269 }
3270
3271 + if (br_parse_ip_options(skb))
3272 + return NF_DROP;
3273 +
3274 /* The physdev module checks on this */
3275 nf_bridge->mask |= BRNF_BRIDGED;
3276 nf_bridge->physoutdev = skb->dev;
3277 diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
3278 index 1d2cdd4..8725e78 100644
3279 --- a/net/ipv4/fib_frontend.c
3280 +++ b/net/ipv4/fib_frontend.c
3281 @@ -1041,6 +1041,7 @@ static void ip_fib_net_exit(struct net *net)
3282 fib4_rules_exit(net);
3283 #endif
3284
3285 + rtnl_lock();
3286 for (i = 0; i < FIB_TABLE_HASHSZ; i++) {
3287 struct fib_table *tb;
3288 struct hlist_head *head;
3289 @@ -1053,6 +1054,7 @@ static void ip_fib_net_exit(struct net *net)
3290 fib_free_table(tb);
3291 }
3292 }
3293 + rtnl_unlock();
3294 kfree(net->ipv4.fib_table_hash);
3295 }
3296
3297 diff --git a/net/ipv4/ip_options.c b/net/ipv4/ip_options.c
3298 index 1906fa3..b0413e3 100644
3299 --- a/net/ipv4/ip_options.c
3300 +++ b/net/ipv4/ip_options.c
3301 @@ -329,7 +329,7 @@ int ip_options_compile(struct net *net,
3302 pp_ptr = optptr + 2;
3303 goto error;
3304 }
3305 - if (skb) {
3306 + if (rt) {
3307 memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
3308 opt->is_changed = 1;
3309 }
3310 @@ -371,7 +371,7 @@ int ip_options_compile(struct net *net,
3311 goto error;
3312 }
3313 opt->ts = optptr - iph;
3314 - if (skb) {
3315 + if (rt) {
3316 memcpy(&optptr[optptr[2]-1], &rt->rt_spec_dst, 4);
3317 timeptr = (__be32*)&optptr[optptr[2]+3];
3318 }
3319 @@ -603,7 +603,7 @@ int ip_options_rcv_srr(struct sk_buff *skb)
3320 unsigned long orefdst;
3321 int err;
3322
3323 - if (!opt->srr)
3324 + if (!opt->srr || !rt)
3325 return 0;
3326
3327 if (skb->pkt_type != PACKET_HOST)
3328 diff --git a/net/ipv4/route.c b/net/ipv4/route.c
3329 index 6ed6603..fabfe81 100644
3330 --- a/net/ipv4/route.c
3331 +++ b/net/ipv4/route.c
3332 @@ -171,7 +171,7 @@ static struct dst_ops ipv4_dst_ops = {
3333
3334 const __u8 ip_tos2prio[16] = {
3335 TC_PRIO_BESTEFFORT,
3336 - ECN_OR_COST(FILLER),
3337 + ECN_OR_COST(BESTEFFORT),
3338 TC_PRIO_BESTEFFORT,
3339 ECN_OR_COST(BESTEFFORT),
3340 TC_PRIO_BULK,
3341 diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
3342 index 65f6c04..5f1ea7c 100644
3343 --- a/net/ipv4/tcp_input.c
3344 +++ b/net/ipv4/tcp_input.c
3345 @@ -2659,7 +2659,7 @@ static void DBGUNDO(struct sock *sk, const char *msg)
3346 #define DBGUNDO(x...) do { } while (0)
3347 #endif
3348
3349 -static void tcp_undo_cwr(struct sock *sk, const int undo)
3350 +static void tcp_undo_cwr(struct sock *sk, const int undo_ssthresh)
3351 {
3352 struct tcp_sock *tp = tcp_sk(sk);
3353
3354 @@ -2671,14 +2671,13 @@ static void tcp_undo_cwr(struct sock *sk, const int undo)
3355 else
3356 tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh << 1);
3357
3358 - if (undo && tp->prior_ssthresh > tp->snd_ssthresh) {
3359 + if (undo_ssthresh && tp->prior_ssthresh > tp->snd_ssthresh) {
3360 tp->snd_ssthresh = tp->prior_ssthresh;
3361 TCP_ECN_withdraw_cwr(tp);
3362 }
3363 } else {
3364 tp->snd_cwnd = max(tp->snd_cwnd, tp->snd_ssthresh);
3365 }
3366 - tcp_moderate_cwnd(tp);
3367 tp->snd_cwnd_stamp = tcp_time_stamp;
3368 }
3369
3370 @@ -2822,8 +2821,11 @@ static int tcp_try_undo_loss(struct sock *sk)
3371 static inline void tcp_complete_cwr(struct sock *sk)
3372 {
3373 struct tcp_sock *tp = tcp_sk(sk);
3374 - tp->snd_cwnd = min(tp->snd_cwnd, tp->snd_ssthresh);
3375 - tp->snd_cwnd_stamp = tcp_time_stamp;
3376 + /* Do not moderate cwnd if it's already undone in cwr or recovery */
3377 + if (tp->undo_marker && tp->snd_cwnd > tp->snd_ssthresh) {
3378 + tp->snd_cwnd = tp->snd_ssthresh;
3379 + tp->snd_cwnd_stamp = tcp_time_stamp;
3380 + }
3381 tcp_ca_event(sk, CA_EVENT_COMPLETE_CWR);
3382 }
3383
3384 diff --git a/net/ipv6/sysctl_net_ipv6.c b/net/ipv6/sysctl_net_ipv6.c
3385 index 7cb65ef..6dcf5e7 100644
3386 --- a/net/ipv6/sysctl_net_ipv6.c
3387 +++ b/net/ipv6/sysctl_net_ipv6.c
3388 @@ -17,6 +17,16 @@
3389
3390 static struct ctl_table empty[1];
3391
3392 +static ctl_table ipv6_static_skeleton[] = {
3393 + {
3394 + .procname = "neigh",
3395 + .maxlen = 0,
3396 + .mode = 0555,
3397 + .child = empty,
3398 + },
3399 + { }
3400 +};
3401 +
3402 static ctl_table ipv6_table_template[] = {
3403 {
3404 .procname = "route",
3405 @@ -37,12 +47,6 @@ static ctl_table ipv6_table_template[] = {
3406 .mode = 0644,
3407 .proc_handler = proc_dointvec
3408 },
3409 - {
3410 - .procname = "neigh",
3411 - .maxlen = 0,
3412 - .mode = 0555,
3413 - .child = empty,
3414 - },
3415 { }
3416 };
3417
3418 @@ -160,7 +164,7 @@ static struct ctl_table_header *ip6_base;
3419
3420 int ipv6_static_sysctl_register(void)
3421 {
3422 - ip6_base = register_sysctl_paths(net_ipv6_ctl_path, empty);
3423 + ip6_base = register_sysctl_paths(net_ipv6_ctl_path, ipv6_static_skeleton);
3424 if (ip6_base == NULL)
3425 return -ENOMEM;
3426 return 0;
3427 diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
3428 index 8d9ce0a..a8193f5 100644
3429 --- a/net/l2tp/l2tp_eth.c
3430 +++ b/net/l2tp/l2tp_eth.c
3431 @@ -283,7 +283,7 @@ static __net_init int l2tp_eth_init_net(struct net *net)
3432 return 0;
3433 }
3434
3435 -static __net_initdata struct pernet_operations l2tp_eth_net_ops = {
3436 +static struct pernet_operations l2tp_eth_net_ops = {
3437 .init = l2tp_eth_init_net,
3438 .id = &l2tp_eth_net_id,
3439 .size = sizeof(struct l2tp_eth_net),
3440 diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
3441 index e58f947..dec012d 100644
3442 --- a/net/sctp/protocol.c
3443 +++ b/net/sctp/protocol.c
3444 @@ -1204,7 +1204,7 @@ SCTP_STATIC __init int sctp_init(void)
3445 if ((sctp_assoc_hashsize > (64 * 1024)) && order > 0)
3446 continue;
3447 sctp_assoc_hashtable = (struct sctp_hashbucket *)
3448 - __get_free_pages(GFP_ATOMIC, order);
3449 + __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order);
3450 } while (!sctp_assoc_hashtable && --order > 0);
3451 if (!sctp_assoc_hashtable) {
3452 pr_err("Failed association hash alloc\n");
3453 @@ -1237,7 +1237,7 @@ SCTP_STATIC __init int sctp_init(void)
3454 if ((sctp_port_hashsize > (64 * 1024)) && order > 0)
3455 continue;
3456 sctp_port_hashtable = (struct sctp_bind_hashbucket *)
3457 - __get_free_pages(GFP_ATOMIC, order);
3458 + __get_free_pages(GFP_ATOMIC|__GFP_NOWARN, order);
3459 } while (!sctp_port_hashtable && --order > 0);
3460 if (!sctp_port_hashtable) {
3461 pr_err("Failed bind hash alloc\n");
3462 diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
3463 index 6459588..8da2741 100644
3464 --- a/net/xfrm/xfrm_policy.c
3465 +++ b/net/xfrm/xfrm_policy.c
3466 @@ -1778,6 +1778,8 @@ restart:
3467 goto no_transform;
3468 }
3469
3470 + dst_hold(&xdst->u.dst);
3471 +
3472 spin_lock_bh(&xfrm_policy_sk_bundle_lock);
3473 xdst->u.dst.next = xfrm_policy_sk_bundles;
3474 xfrm_policy_sk_bundles = &xdst->u.dst;
3475 diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
3476 index 4c0383d..58434b3 100755
3477 --- a/scripts/checkpatch.pl
3478 +++ b/scripts/checkpatch.pl
3479 @@ -2809,9 +2809,9 @@ sub process {
3480 WARN("consider using a completion\n" . $herecurr);
3481
3482 }
3483 -# recommend strict_strto* over simple_strto*
3484 +# recommend kstrto* over simple_strto*
3485 if ($line =~ /\bsimple_(strto.*?)\s*\(/) {
3486 - WARN("consider using strict_$1 in preference to simple_$1\n" . $herecurr);
3487 + WARN("consider using kstrto* in preference to simple_$1\n" . $herecurr);
3488 }
3489 # check for __initcall(), use device_initcall() explicitly please
3490 if ($line =~ /^.\s*__initcall\s*\(/) {
3491 diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
3492 index e164a4b..da7cdca 100644
3493 --- a/sound/pci/hda/patch_realtek.c
3494 +++ b/sound/pci/hda/patch_realtek.c
3495 @@ -9932,7 +9932,6 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
3496 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
3497 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
3498 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
3499 - SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
3500
3501 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
3502 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
3503 @@ -10769,6 +10768,7 @@ enum {
3504 PINFIX_LENOVO_Y530,
3505 PINFIX_PB_M5210,
3506 PINFIX_ACER_ASPIRE_7736,
3507 + PINFIX_GIGABYTE_880GM,
3508 };
3509
3510 static const struct alc_fixup alc882_fixups[] = {
3511 @@ -10800,6 +10800,13 @@ static const struct alc_fixup alc882_fixups[] = {
3512 .type = ALC_FIXUP_SKU,
3513 .v.sku = ALC_FIXUP_SKU_IGNORE,
3514 },
3515 + [PINFIX_GIGABYTE_880GM] = {
3516 + .type = ALC_FIXUP_PINS,
3517 + .v.pins = (const struct alc_pincfg[]) {
3518 + { 0x14, 0x1114410 }, /* set as speaker */
3519 + { }
3520 + }
3521 + },
3522 };
3523
3524 static struct snd_pci_quirk alc882_fixup_tbl[] = {
3525 @@ -10807,6 +10814,7 @@ static struct snd_pci_quirk alc882_fixup_tbl[] = {
3526 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530),
3527 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
3528 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736),
3529 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", PINFIX_GIGABYTE_880GM),
3530 {}
3531 };
3532
3533 @@ -18851,8 +18859,6 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
3534 ALC662_3ST_6ch_DIG),
3535 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
3536 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
3537 - SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
3538 - ALC662_3ST_6ch_DIG),
3539 SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),
3540 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),
3541 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),
3542 @@ -19526,6 +19532,7 @@ enum {
3543 ALC662_FIXUP_IDEAPAD,
3544 ALC272_FIXUP_MARIO,
3545 ALC662_FIXUP_CZC_P10T,
3546 + ALC662_FIXUP_GIGABYTE,
3547 };
3548
3549 static const struct alc_fixup alc662_fixups[] = {
3550 @@ -19554,12 +19561,20 @@ static const struct alc_fixup alc662_fixups[] = {
3551 {}
3552 }
3553 },
3554 + [ALC662_FIXUP_GIGABYTE] = {
3555 + .type = ALC_FIXUP_PINS,
3556 + .v.pins = (const struct alc_pincfg[]) {
3557 + { 0x14, 0x1114410 }, /* set as speaker */
3558 + { }
3559 + }
3560 + },
3561 };
3562
3563 static struct snd_pci_quirk alc662_fixup_tbl[] = {
3564 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
3565 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
3566 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
3567 + SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte", ALC662_FIXUP_GIGABYTE),
3568 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
3569 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
3570 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
3571 diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c
3572 index d9ab3ce..0c7454f 100644
3573 --- a/tools/perf/bench/sched-pipe.c
3574 +++ b/tools/perf/bench/sched-pipe.c
3575 @@ -55,7 +55,7 @@ int bench_sched_pipe(int argc, const char **argv,
3576 * discarding returned value of read(), write()
3577 * causes error in building environment for perf
3578 */
3579 - int ret, wait_stat;
3580 + int __used ret, wait_stat;
3581 pid_t pid, retpid;
3582
3583 argc = parse_options(argc, argv, options,
3584 diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
3585 index 29acb89..ae7225c 100644
3586 --- a/tools/perf/builtin-sched.c
3587 +++ b/tools/perf/builtin-sched.c
3588 @@ -369,11 +369,6 @@ static void
3589 process_sched_event(struct task_desc *this_task __used, struct sched_atom *atom)
3590 {
3591 int ret = 0;
3592 - u64 now;
3593 - long long delta;
3594 -
3595 - now = get_nsecs();
3596 - delta = start_time + atom->timestamp - now;
3597
3598 switch (atom->type) {
3599 case SCHED_EVENT_RUN:
3600 @@ -562,7 +557,7 @@ static void wait_for_tasks(void)
3601
3602 static void run_one_test(void)
3603 {
3604 - u64 T0, T1, delta, avg_delta, fluct, std_dev;
3605 + u64 T0, T1, delta, avg_delta, fluct;
3606
3607 T0 = get_nsecs();
3608 wait_for_tasks();
3609 @@ -578,7 +573,6 @@ static void run_one_test(void)
3610 else
3611 fluct = delta - avg_delta;
3612 sum_fluct += fluct;
3613 - std_dev = sum_fluct / nr_runs / sqrt(nr_runs);
3614 if (!run_avg)
3615 run_avg = delta;
3616 run_avg = (run_avg*9 + delta)/10;
3617 @@ -799,7 +793,7 @@ replay_switch_event(struct trace_switch_event *switch_event,
3618 u64 timestamp,
3619 struct thread *thread __used)
3620 {
3621 - struct task_desc *prev, *next;
3622 + struct task_desc *prev, __used *next;
3623 u64 timestamp0;
3624 s64 delta;
3625
3626 @@ -1404,7 +1398,7 @@ map_switch_event(struct trace_switch_event *switch_event,
3627 u64 timestamp,
3628 struct thread *thread __used)
3629 {
3630 - struct thread *sched_out, *sched_in;
3631 + struct thread *sched_out __used, *sched_in;
3632 int new_shortname;
3633 u64 timestamp0;
3634 s64 delta;
3635 diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
3636 index 5a29d9c..b0f6925 100644
3637 --- a/tools/perf/builtin-top.c
3638 +++ b/tools/perf/builtin-top.c
3639 @@ -183,7 +183,6 @@ static int parse_source(struct sym_entry *syme)
3640 FILE *file;
3641 char command[PATH_MAX*2];
3642 const char *path;
3643 - u64 len;
3644
3645 if (!syme)
3646 return -1;
3647 @@ -212,8 +211,6 @@ static int parse_source(struct sym_entry *syme)
3648 }
3649 path = map->dso->long_name;
3650
3651 - len = sym->end - sym->start;
3652 -
3653 sprintf(command,
3654 "objdump --start-address=%#0*" PRIx64 " --stop-address=%#0*" PRIx64 " -dS %s",
3655 BITS_PER_LONG / 4, map__rip_2objdump(map, sym->start),
3656 @@ -1296,7 +1293,7 @@ static int __cmd_top(void)
3657 {
3658 pthread_t thread;
3659 struct perf_evsel *counter;
3660 - int i, ret;
3661 + int i, ret __used;
3662 /*
3663 * FIXME: perf_session__new should allow passing a O_MMAP, so that all this
3664 * mmap reading, etc is encapsulated in it. Use O_WRONLY for now.
3665 diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
3666 index 0866bcd..9721e2f 100644
3667 --- a/tools/perf/util/header.c
3668 +++ b/tools/perf/util/header.c
3669 @@ -1144,7 +1144,7 @@ int event__synthesize_tracing_data(int fd, struct list_head *pattrs,
3670 {
3671 event_t ev;
3672 ssize_t size = 0, aligned_size = 0, padding;
3673 - int err = 0;
3674 + int err __used = 0;
3675
3676 memset(&ev, 0, sizeof(ev));
3677
3678 diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
3679 index df51560..5214b70 100644
3680 --- a/tools/perf/util/hist.c
3681 +++ b/tools/perf/util/hist.c
3682 @@ -1095,7 +1095,6 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head,
3683 char command[PATH_MAX * 2];
3684 FILE *file;
3685 int err = 0;
3686 - u64 len;
3687 char symfs_filename[PATH_MAX];
3688
3689 if (filename) {
3690 @@ -1140,8 +1139,6 @@ fallback:
3691 filename, sym->name, map->unmap_ip(map, sym->start),
3692 map->unmap_ip(map, sym->end));
3693
3694 - len = sym->end - sym->start;
3695 -
3696 pr_debug("annotating [%p] %30s : [%p] %30s\n",
3697 dso, dso->long_name, sym, sym->name);
3698
3699 diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
3700 index c6d9933..2040b85 100644
3701 --- a/tools/perf/util/scripting-engines/trace-event-python.c
3702 +++ b/tools/perf/util/scripting-engines/trace-event-python.c
3703 @@ -248,8 +248,7 @@ static void python_process_event(int cpu, void *data,
3704 context = PyCObject_FromVoidPtr(scripting_context, NULL);
3705
3706 PyTuple_SetItem(t, n++, PyString_FromString(handler_name));
3707 - PyTuple_SetItem(t, n++,
3708 - PyCObject_FromVoidPtr(scripting_context, NULL));
3709 + PyTuple_SetItem(t, n++, context);
3710
3711 if (handler) {
3712 PyTuple_SetItem(t, n++, PyInt_FromLong(cpu));
3713 diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
3714 index b1bf490..ba6d489 100644
3715 --- a/tools/perf/util/symbol.c
3716 +++ b/tools/perf/util/symbol.c
3717 @@ -1525,8 +1525,8 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter)
3718 symbol_conf.symfs, self->long_name);
3719 break;
3720 case DSO__ORIG_GUEST_KMODULE:
3721 - if (map->groups && map->groups->machine)
3722 - root_dir = map->groups->machine->root_dir;
3723 + if (map->groups && machine)
3724 + root_dir = machine->root_dir;
3725 else
3726 root_dir = "";
3727 snprintf(name, size, "%s%s%s", symbol_conf.symfs,
3728 diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
3729 index 73a0222..d8e622d 100644
3730 --- a/tools/perf/util/trace-event-parse.c
3731 +++ b/tools/perf/util/trace-event-parse.c
3732 @@ -153,7 +153,7 @@ void parse_proc_kallsyms(char *file, unsigned int size __unused)
3733 char *next = NULL;
3734 char *addr_str;
3735 char ch;
3736 - int ret;
3737 + int ret __used;
3738 int i;
3739
3740 line = strtok_r(file, "\n", &next);
3741 diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c
3742 index e515836..8462bff 100644
3743 --- a/tools/perf/util/ui/browsers/map.c
3744 +++ b/tools/perf/util/ui/browsers/map.c
3745 @@ -41,7 +41,7 @@ static int ui_entry__read(const char *title, char *bf, size_t size, int width)
3746 out_free_form:
3747 newtPopWindow();
3748 newtFormDestroy(form);
3749 - return 0;
3750 + return err;
3751 }
3752
3753 struct map_browser {

  ViewVC Help
Powered by ViewVC 1.1.20