Contents of /trunk/kernel26-magellan-server/patches-2.6.25-r5/0103-2.6.25.4-all-fixes.patch
Parent Directory | Revision Log
Revision 677 -
(show annotations)
(download)
Wed Sep 10 21:27:27 2008 UTC (16 years ago) by niro
File size: 95407 byte(s)
Wed Sep 10 21:27:27 2008 UTC (16 years ago) by niro
File size: 95407 byte(s)
2.6.25-magellan-r5: - updated to linux-2.6.25.17
1 | diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S |
2 | index c2eed8f..1ea92e7 100644 |
3 | --- a/arch/sparc/kernel/entry.S |
4 | +++ b/arch/sparc/kernel/entry.S |
5 | @@ -1398,6 +1398,8 @@ ret_from_fork: |
6 | .align 4 |
7 | .globl linux_sparc_syscall |
8 | linux_sparc_syscall: |
9 | + sethi %hi(PSR_SYSCALL), %l4 |
10 | + or %l0, %l4, %l0 |
11 | /* Direct access to user regs, must faster. */ |
12 | cmp %g1, NR_SYSCALLS |
13 | bgeu linux_sparc_ni_syscall |
14 | diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c |
15 | index 70c0dd2..a65aed3 100644 |
16 | --- a/arch/sparc/kernel/process.c |
17 | +++ b/arch/sparc/kernel/process.c |
18 | @@ -421,14 +421,26 @@ asmlinkage int sparc_do_fork(unsigned long clone_flags, |
19 | unsigned long stack_size) |
20 | { |
21 | unsigned long parent_tid_ptr, child_tid_ptr; |
22 | + unsigned long orig_i1 = regs->u_regs[UREG_I1]; |
23 | + long ret; |
24 | |
25 | parent_tid_ptr = regs->u_regs[UREG_I2]; |
26 | child_tid_ptr = regs->u_regs[UREG_I4]; |
27 | |
28 | - return do_fork(clone_flags, stack_start, |
29 | - regs, stack_size, |
30 | - (int __user *) parent_tid_ptr, |
31 | - (int __user *) child_tid_ptr); |
32 | + ret = do_fork(clone_flags, stack_start, |
33 | + regs, stack_size, |
34 | + (int __user *) parent_tid_ptr, |
35 | + (int __user *) child_tid_ptr); |
36 | + |
37 | + /* If we get an error and potentially restart the system |
38 | + * call, we're screwed because copy_thread() clobbered |
39 | + * the parent's %o1. So detect that case and restore it |
40 | + * here. |
41 | + */ |
42 | + if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) |
43 | + regs->u_regs[UREG_I1] = orig_i1; |
44 | + |
45 | + return ret; |
46 | } |
47 | |
48 | /* Copy a Sparc thread. The fork() return value conventions |
49 | @@ -628,11 +640,6 @@ asmlinkage int sparc_execve(struct pt_regs *regs) |
50 | (char __user * __user *)regs->u_regs[base + UREG_I2], |
51 | regs); |
52 | putname(filename); |
53 | - if (error == 0) { |
54 | - task_lock(current); |
55 | - current->ptrace &= ~PT_DTRACE; |
56 | - task_unlock(current); |
57 | - } |
58 | out: |
59 | return error; |
60 | } |
61 | diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c |
62 | index 7f44ae6..81f3b92 100644 |
63 | --- a/arch/sparc/kernel/ptrace.c |
64 | +++ b/arch/sparc/kernel/ptrace.c |
65 | @@ -170,8 +170,8 @@ static int genregs32_set(struct task_struct *target, |
66 | switch (pos) { |
67 | case 32: /* PSR */ |
68 | psr = regs->psr; |
69 | - psr &= ~PSR_ICC; |
70 | - psr |= (reg & PSR_ICC); |
71 | + psr &= ~(PSR_ICC | PSR_SYSCALL); |
72 | + psr |= (reg & (PSR_ICC | PSR_SYSCALL)); |
73 | regs->psr = psr; |
74 | break; |
75 | case 33: /* PC */ |
76 | @@ -441,6 +441,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
77 | break; |
78 | |
79 | default: |
80 | + if (request == PTRACE_SPARC_DETACH) |
81 | + request = PTRACE_DETACH; |
82 | ret = ptrace_request(child, request, addr, data); |
83 | break; |
84 | } |
85 | diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S |
86 | index 77ca6fd..ab818cd 100644 |
87 | --- a/arch/sparc/kernel/rtrap.S |
88 | +++ b/arch/sparc/kernel/rtrap.S |
89 | @@ -50,8 +50,9 @@ rtrap_7win_patch5: and %g1, 0x7f, %g1 |
90 | ret_trap_entry: |
91 | ret_trap_lockless_ipi: |
92 | andcc %t_psr, PSR_PS, %g0 |
93 | + sethi %hi(PSR_SYSCALL), %g1 |
94 | be 1f |
95 | - nop |
96 | + andn %t_psr, %g1, %t_psr |
97 | |
98 | wr %t_psr, 0x0, %psr |
99 | b ret_trap_kernel |
100 | @@ -73,7 +74,6 @@ signal_p: |
101 | ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr |
102 | |
103 | mov %l5, %o1 |
104 | - mov %l6, %o2 |
105 | call do_signal |
106 | add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr |
107 | |
108 | @@ -81,6 +81,8 @@ signal_p: |
109 | ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr |
110 | clr %l6 |
111 | ret_trap_continue: |
112 | + sethi %hi(PSR_SYSCALL), %g1 |
113 | + andn %t_psr, %g1, %t_psr |
114 | wr %t_psr, 0x0, %psr |
115 | WRITE_PAUSE |
116 | |
117 | @@ -137,8 +139,9 @@ ret_trap_userwins_ok: |
118 | LOAD_PT_PRIV(sp, t_psr, t_pc, t_npc) |
119 | or %t_pc, %t_npc, %g2 |
120 | andcc %g2, 0x3, %g0 |
121 | + sethi %hi(PSR_SYSCALL), %g2 |
122 | be 1f |
123 | - nop |
124 | + andn %t_psr, %g2, %t_psr |
125 | |
126 | b ret_trap_unaligned_pc |
127 | add %sp, STACKFRAME_SZ, %o0 |
128 | @@ -201,6 +204,8 @@ rtrap_patch5: and %g1, 0xff, %g1 |
129 | 1: |
130 | LOAD_PT_ALL(sp, t_psr, t_pc, t_npc, g1) |
131 | 2: |
132 | + sethi %hi(PSR_SYSCALL), %twin_tmp1 |
133 | + andn %t_psr, %twin_tmp1, %t_psr |
134 | wr %t_psr, 0x0, %psr |
135 | WRITE_PAUSE |
136 | |
137 | diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c |
138 | index 9994cac..e85023b 100644 |
139 | --- a/arch/sparc/kernel/signal.c |
140 | +++ b/arch/sparc/kernel/signal.c |
141 | @@ -178,6 +178,9 @@ static inline void do_new_sigreturn (struct pt_regs *regs) |
142 | regs->psr = (up_psr & ~(PSR_ICC | PSR_EF)) |
143 | | (regs->psr & (PSR_ICC | PSR_EF)); |
144 | |
145 | + /* Prevent syscall restart. */ |
146 | + pt_regs_clear_syscall(regs); |
147 | + |
148 | err |= __get_user(fpu_save, &sf->fpu_save); |
149 | |
150 | if (fpu_save) |
151 | @@ -299,6 +302,9 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs) |
152 | |
153 | regs->psr = (regs->psr & ~PSR_ICC) | (psr & PSR_ICC); |
154 | |
155 | + /* Prevent syscall restart. */ |
156 | + pt_regs_clear_syscall(regs); |
157 | + |
158 | err |= __get_user(fpu_save, &sf->fpu_save); |
159 | |
160 | if (fpu_save) |
161 | @@ -345,15 +351,29 @@ static inline int invalid_frame_pointer(void __user *fp, int fplen) |
162 | |
163 | static inline void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, unsigned long framesize) |
164 | { |
165 | - unsigned long sp; |
166 | + unsigned long sp = regs->u_regs[UREG_FP]; |
167 | |
168 | - sp = regs->u_regs[UREG_FP]; |
169 | + /* |
170 | + * If we are on the alternate signal stack and would overflow it, don't. |
171 | + * Return an always-bogus address instead so we will die with SIGSEGV. |
172 | + */ |
173 | + if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) |
174 | + return (void __user *) -1L; |
175 | |
176 | /* This is the X/Open sanctioned signal stack switching. */ |
177 | if (sa->sa_flags & SA_ONSTACK) { |
178 | - if (!on_sig_stack(sp) && !((current->sas_ss_sp + current->sas_ss_size) & 7)) |
179 | + if (sas_ss_flags(sp) == 0) |
180 | sp = current->sas_ss_sp + current->sas_ss_size; |
181 | } |
182 | + |
183 | + /* Always align the stack frame. This handles two cases. First, |
184 | + * sigaltstack need not be mindful of platform specific stack |
185 | + * alignment. Second, if we took this signal because the stack |
186 | + * is not aligned properly, we'd like to take the signal cleanly |
187 | + * and report that. |
188 | + */ |
189 | + sp &= ~7UL; |
190 | + |
191 | return (void __user *)(sp - framesize); |
192 | } |
193 | |
194 | @@ -994,13 +1014,13 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
195 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
196 | * mistake. |
197 | */ |
198 | -asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int restart_syscall) |
199 | +asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0) |
200 | { |
201 | - siginfo_t info; |
202 | - struct sparc_deliver_cookie cookie; |
203 | struct k_sigaction ka; |
204 | - int signr; |
205 | + int restart_syscall; |
206 | sigset_t *oldset; |
207 | + siginfo_t info; |
208 | + int signr; |
209 | |
210 | /* |
211 | * XXX Disable svr4 signal handling until solaris emulation works. |
212 | @@ -1013,18 +1033,28 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest |
213 | int svr4_signal = current->personality == PER_SVR4; |
214 | #endif |
215 | |
216 | - cookie.restart_syscall = restart_syscall; |
217 | - cookie.orig_i0 = orig_i0; |
218 | + if (pt_regs_is_syscall(regs) && (regs->psr & PSR_C)) |
219 | + restart_syscall = 1; |
220 | + else |
221 | + restart_syscall = 0; |
222 | |
223 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
224 | oldset = ¤t->saved_sigmask; |
225 | else |
226 | oldset = ¤t->blocked; |
227 | |
228 | - signr = get_signal_to_deliver(&info, &ka, regs, &cookie); |
229 | + signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
230 | + |
231 | + /* If the debugger messes with the program counter, it clears |
232 | + * the software "in syscall" bit, directing us to not perform |
233 | + * a syscall restart. |
234 | + */ |
235 | + if (restart_syscall && !pt_regs_is_syscall(regs)) |
236 | + restart_syscall = 0; |
237 | + |
238 | if (signr > 0) { |
239 | - if (cookie.restart_syscall) |
240 | - syscall_restart(cookie.orig_i0, regs, &ka.sa); |
241 | + if (restart_syscall) |
242 | + syscall_restart(orig_i0, regs, &ka.sa); |
243 | handle_signal(signr, &ka, &info, oldset, |
244 | regs, svr4_signal); |
245 | /* a signal was successfully delivered; the saved |
246 | @@ -1036,16 +1066,16 @@ asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int rest |
247 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
248 | return; |
249 | } |
250 | - if (cookie.restart_syscall && |
251 | + if (restart_syscall && |
252 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
253 | regs->u_regs[UREG_I0] == ERESTARTSYS || |
254 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
255 | /* replay the system call when we are done */ |
256 | - regs->u_regs[UREG_I0] = cookie.orig_i0; |
257 | + regs->u_regs[UREG_I0] = orig_i0; |
258 | regs->pc -= 4; |
259 | regs->npc -= 4; |
260 | } |
261 | - if (cookie.restart_syscall && |
262 | + if (restart_syscall && |
263 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
264 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
265 | regs->pc -= 4; |
266 | @@ -1097,27 +1127,3 @@ do_sys_sigstack(struct sigstack __user *ssptr, struct sigstack __user *ossptr, |
267 | out: |
268 | return ret; |
269 | } |
270 | - |
271 | -void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) |
272 | -{ |
273 | - struct sparc_deliver_cookie *cp = cookie; |
274 | - |
275 | - if (cp->restart_syscall && |
276 | - (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
277 | - regs->u_regs[UREG_I0] == ERESTARTSYS || |
278 | - regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
279 | - /* replay the system call when we are done */ |
280 | - regs->u_regs[UREG_I0] = cp->orig_i0; |
281 | - regs->pc -= 4; |
282 | - regs->npc -= 4; |
283 | - cp->restart_syscall = 0; |
284 | - } |
285 | - |
286 | - if (cp->restart_syscall && |
287 | - regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
288 | - regs->u_regs[UREG_G1] = __NR_restart_syscall; |
289 | - regs->pc -= 4; |
290 | - regs->npc -= 4; |
291 | - cp->restart_syscall = 0; |
292 | - } |
293 | -} |
294 | diff --git a/arch/sparc/kernel/sys_sparc.c b/arch/sparc/kernel/sys_sparc.c |
295 | index 9f8c8e1..3423d07 100644 |
296 | --- a/arch/sparc/kernel/sys_sparc.c |
297 | +++ b/arch/sparc/kernel/sys_sparc.c |
298 | @@ -220,7 +220,7 @@ out: |
299 | return err; |
300 | } |
301 | |
302 | -int sparc_mmap_check(unsigned long addr, unsigned long len, unsigned long flags) |
303 | +int sparc_mmap_check(unsigned long addr, unsigned long len) |
304 | { |
305 | if (ARCH_SUN4C_SUN4 && |
306 | (len > 0x20000000 || |
307 | @@ -296,52 +296,14 @@ asmlinkage unsigned long sparc_mremap(unsigned long addr, |
308 | unsigned long old_len, unsigned long new_len, |
309 | unsigned long flags, unsigned long new_addr) |
310 | { |
311 | - struct vm_area_struct *vma; |
312 | unsigned long ret = -EINVAL; |
313 | - if (ARCH_SUN4C_SUN4) { |
314 | - if (old_len > 0x20000000 || new_len > 0x20000000) |
315 | - goto out; |
316 | - if (addr < 0xe0000000 && addr + old_len > 0x20000000) |
317 | - goto out; |
318 | - } |
319 | - if (old_len > TASK_SIZE - PAGE_SIZE || |
320 | - new_len > TASK_SIZE - PAGE_SIZE) |
321 | + |
322 | + if (unlikely(sparc_mmap_check(addr, old_len))) |
323 | + goto out; |
324 | + if (unlikely(sparc_mmap_check(new_addr, new_len))) |
325 | goto out; |
326 | down_write(¤t->mm->mmap_sem); |
327 | - if (flags & MREMAP_FIXED) { |
328 | - if (ARCH_SUN4C_SUN4 && |
329 | - new_addr < 0xe0000000 && |
330 | - new_addr + new_len > 0x20000000) |
331 | - goto out_sem; |
332 | - if (new_addr + new_len > TASK_SIZE - PAGE_SIZE) |
333 | - goto out_sem; |
334 | - } else if ((ARCH_SUN4C_SUN4 && addr < 0xe0000000 && |
335 | - addr + new_len > 0x20000000) || |
336 | - addr + new_len > TASK_SIZE - PAGE_SIZE) { |
337 | - unsigned long map_flags = 0; |
338 | - struct file *file = NULL; |
339 | - |
340 | - ret = -ENOMEM; |
341 | - if (!(flags & MREMAP_MAYMOVE)) |
342 | - goto out_sem; |
343 | - |
344 | - vma = find_vma(current->mm, addr); |
345 | - if (vma) { |
346 | - if (vma->vm_flags & VM_SHARED) |
347 | - map_flags |= MAP_SHARED; |
348 | - file = vma->vm_file; |
349 | - } |
350 | - |
351 | - new_addr = get_unmapped_area(file, addr, new_len, |
352 | - vma ? vma->vm_pgoff : 0, |
353 | - map_flags); |
354 | - ret = new_addr; |
355 | - if (new_addr & ~PAGE_MASK) |
356 | - goto out_sem; |
357 | - flags |= MREMAP_FIXED; |
358 | - } |
359 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
360 | -out_sem: |
361 | up_write(¤t->mm->mmap_sem); |
362 | out: |
363 | return ret; |
364 | diff --git a/arch/sparc64/kernel/etrap.S b/arch/sparc64/kernel/etrap.S |
365 | index 4b2bf9e..b087e97 100644 |
366 | --- a/arch/sparc64/kernel/etrap.S |
367 | +++ b/arch/sparc64/kernel/etrap.S |
368 | @@ -27,11 +27,12 @@ |
369 | |
370 | .text |
371 | .align 64 |
372 | - .globl etrap, etrap_irq, etraptl1 |
373 | + .globl etrap_syscall, etrap, etrap_irq, etraptl1 |
374 | etrap: rdpr %pil, %g2 |
375 | -etrap_irq: |
376 | - TRAP_LOAD_THREAD_REG(%g6, %g1) |
377 | +etrap_irq: clr %g3 |
378 | +etrap_syscall: TRAP_LOAD_THREAD_REG(%g6, %g1) |
379 | rdpr %tstate, %g1 |
380 | + or %g1, %g3, %g1 |
381 | sllx %g2, 20, %g3 |
382 | andcc %g1, TSTATE_PRIV, %g0 |
383 | or %g1, %g3, %g1 |
384 | diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c |
385 | index eb88bd6..b441a26 100644 |
386 | --- a/arch/sparc64/kernel/irq.c |
387 | +++ b/arch/sparc64/kernel/irq.c |
388 | @@ -1,6 +1,6 @@ |
389 | /* irq.c: UltraSparc IRQ handling/init/registry. |
390 | * |
391 | - * Copyright (C) 1997, 2007 David S. Miller (davem@davemloft.net) |
392 | + * Copyright (C) 1997, 2007, 2008 David S. Miller (davem@davemloft.net) |
393 | * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) |
394 | * Copyright (C) 1998 Jakub Jelinek (jj@ultra.linux.cz) |
395 | */ |
396 | @@ -308,6 +308,7 @@ static void sun4u_irq_enable(unsigned int virt_irq) |
397 | IMAP_AID_SAFARI | IMAP_NID_SAFARI); |
398 | val |= tid | IMAP_VALID; |
399 | upa_writeq(val, imap); |
400 | + upa_writeq(ICLR_IDLE, data->iclr); |
401 | } |
402 | } |
403 | |
404 | diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c |
405 | index 545356b..39f0c46 100644 |
406 | --- a/arch/sparc64/kernel/pci.c |
407 | +++ b/arch/sparc64/kernel/pci.c |
408 | @@ -351,8 +351,7 @@ static void pci_parse_of_addrs(struct of_device *op, |
409 | |
410 | struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, |
411 | struct device_node *node, |
412 | - struct pci_bus *bus, int devfn, |
413 | - int host_controller) |
414 | + struct pci_bus *bus, int devfn) |
415 | { |
416 | struct dev_archdata *sd; |
417 | struct pci_dev *dev; |
418 | @@ -389,43 +388,28 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, |
419 | dev->devfn = devfn; |
420 | dev->multifunction = 0; /* maybe a lie? */ |
421 | |
422 | - if (host_controller) { |
423 | - if (tlb_type != hypervisor) { |
424 | - pci_read_config_word(dev, PCI_VENDOR_ID, |
425 | - &dev->vendor); |
426 | - pci_read_config_word(dev, PCI_DEVICE_ID, |
427 | - &dev->device); |
428 | - } else { |
429 | - dev->vendor = PCI_VENDOR_ID_SUN; |
430 | - dev->device = 0x80f0; |
431 | - } |
432 | - dev->cfg_size = 256; |
433 | - dev->class = PCI_CLASS_BRIDGE_HOST << 8; |
434 | - sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), |
435 | - 0x00, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
436 | - } else { |
437 | - dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); |
438 | - dev->device = of_getintprop_default(node, "device-id", 0xffff); |
439 | - dev->subsystem_vendor = |
440 | - of_getintprop_default(node, "subsystem-vendor-id", 0); |
441 | - dev->subsystem_device = |
442 | - of_getintprop_default(node, "subsystem-id", 0); |
443 | - |
444 | - dev->cfg_size = pci_cfg_space_size(dev); |
445 | - |
446 | - /* We can't actually use the firmware value, we have |
447 | - * to read what is in the register right now. One |
448 | - * reason is that in the case of IDE interfaces the |
449 | - * firmware can sample the value before the the IDE |
450 | - * interface is programmed into native mode. |
451 | - */ |
452 | - pci_read_config_dword(dev, PCI_CLASS_REVISION, &class); |
453 | - dev->class = class >> 8; |
454 | - dev->revision = class & 0xff; |
455 | + dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); |
456 | + dev->device = of_getintprop_default(node, "device-id", 0xffff); |
457 | + dev->subsystem_vendor = |
458 | + of_getintprop_default(node, "subsystem-vendor-id", 0); |
459 | + dev->subsystem_device = |
460 | + of_getintprop_default(node, "subsystem-id", 0); |
461 | + |
462 | + dev->cfg_size = pci_cfg_space_size(dev); |
463 | + |
464 | + /* We can't actually use the firmware value, we have |
465 | + * to read what is in the register right now. One |
466 | + * reason is that in the case of IDE interfaces the |
467 | + * firmware can sample the value before the the IDE |
468 | + * interface is programmed into native mode. |
469 | + */ |
470 | + pci_read_config_dword(dev, PCI_CLASS_REVISION, &class); |
471 | + dev->class = class >> 8; |
472 | + dev->revision = class & 0xff; |
473 | + |
474 | + sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), |
475 | + dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
476 | |
477 | - sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), |
478 | - dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); |
479 | - } |
480 | if (ofpci_verbose) |
481 | printk(" class: 0x%x device name: %s\n", |
482 | dev->class, pci_name(dev)); |
483 | @@ -440,26 +424,21 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, |
484 | dev->current_state = 4; /* unknown power state */ |
485 | dev->error_state = pci_channel_io_normal; |
486 | |
487 | - if (host_controller) { |
488 | + if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { |
489 | + /* a PCI-PCI bridge */ |
490 | dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; |
491 | dev->rom_base_reg = PCI_ROM_ADDRESS1; |
492 | - dev->irq = PCI_IRQ_NONE; |
493 | + } else if (!strcmp(type, "cardbus")) { |
494 | + dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; |
495 | } else { |
496 | - if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { |
497 | - /* a PCI-PCI bridge */ |
498 | - dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; |
499 | - dev->rom_base_reg = PCI_ROM_ADDRESS1; |
500 | - } else if (!strcmp(type, "cardbus")) { |
501 | - dev->hdr_type = PCI_HEADER_TYPE_CARDBUS; |
502 | - } else { |
503 | - dev->hdr_type = PCI_HEADER_TYPE_NORMAL; |
504 | - dev->rom_base_reg = PCI_ROM_ADDRESS; |
505 | + dev->hdr_type = PCI_HEADER_TYPE_NORMAL; |
506 | + dev->rom_base_reg = PCI_ROM_ADDRESS; |
507 | |
508 | - dev->irq = sd->op->irqs[0]; |
509 | - if (dev->irq == 0xffffffff) |
510 | - dev->irq = PCI_IRQ_NONE; |
511 | - } |
512 | + dev->irq = sd->op->irqs[0]; |
513 | + if (dev->irq == 0xffffffff) |
514 | + dev->irq = PCI_IRQ_NONE; |
515 | } |
516 | + |
517 | pci_parse_of_addrs(sd->op, node, dev); |
518 | |
519 | if (ofpci_verbose) |
520 | @@ -748,7 +727,7 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm, |
521 | prev_devfn = devfn; |
522 | |
523 | /* create a new pci_dev for this device */ |
524 | - dev = of_create_pci_dev(pbm, child, bus, devfn, 0); |
525 | + dev = of_create_pci_dev(pbm, child, bus, devfn); |
526 | if (!dev) |
527 | continue; |
528 | if (ofpci_verbose) |
529 | @@ -795,48 +774,9 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus) |
530 | pci_bus_register_of_sysfs(child_bus); |
531 | } |
532 | |
533 | -int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev, |
534 | - unsigned int devfn, |
535 | - int where, int size, |
536 | - u32 *value) |
537 | -{ |
538 | - static u8 fake_pci_config[] = { |
539 | - 0x8e, 0x10, /* Vendor: 0x108e (Sun) */ |
540 | - 0xf0, 0x80, /* Device: 0x80f0 (Fire) */ |
541 | - 0x46, 0x01, /* Command: 0x0146 (SERR, PARITY, MASTER, MEM) */ |
542 | - 0xa0, 0x22, /* Status: 0x02a0 (DEVSEL_MED, FB2B, 66MHZ) */ |
543 | - 0x00, 0x00, 0x00, 0x06, /* Class: 0x06000000 host bridge */ |
544 | - 0x00, /* Cacheline: 0x00 */ |
545 | - 0x40, /* Latency: 0x40 */ |
546 | - 0x00, /* Header-Type: 0x00 normal */ |
547 | - }; |
548 | - |
549 | - *value = 0; |
550 | - if (where >= 0 && where < sizeof(fake_pci_config) && |
551 | - (where + size) >= 0 && |
552 | - (where + size) < sizeof(fake_pci_config) && |
553 | - size <= sizeof(u32)) { |
554 | - while (size--) { |
555 | - *value <<= 8; |
556 | - *value |= fake_pci_config[where + size]; |
557 | - } |
558 | - } |
559 | - |
560 | - return PCIBIOS_SUCCESSFUL; |
561 | -} |
562 | - |
563 | -int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev, |
564 | - unsigned int devfn, |
565 | - int where, int size, |
566 | - u32 value) |
567 | -{ |
568 | - return PCIBIOS_SUCCESSFUL; |
569 | -} |
570 | - |
571 | struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) |
572 | { |
573 | struct device_node *node = pbm->prom_node; |
574 | - struct pci_dev *host_pdev; |
575 | struct pci_bus *bus; |
576 | |
577 | printk("PCI: Scanning PBM %s\n", node->full_name); |
578 | @@ -854,10 +794,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) |
579 | bus->resource[0] = &pbm->io_space; |
580 | bus->resource[1] = &pbm->mem_space; |
581 | |
582 | - /* Create the dummy host bridge and link it in. */ |
583 | - host_pdev = of_create_pci_dev(pbm, node, bus, 0x00, 1); |
584 | - bus->self = host_pdev; |
585 | - |
586 | pci_of_scan_bus(pbm, node, bus); |
587 | pci_bus_add_devices(bus); |
588 | pci_bus_register_of_sysfs(bus); |
589 | diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c |
590 | index 923e0bc..19fa621 100644 |
591 | --- a/arch/sparc64/kernel/pci_common.c |
592 | +++ b/arch/sparc64/kernel/pci_common.c |
593 | @@ -264,9 +264,6 @@ static int sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, |
594 | unsigned int func = PCI_FUNC(devfn); |
595 | unsigned long ret; |
596 | |
597 | - if (!bus && devfn == 0x00) |
598 | - return pci_host_bridge_read_pci_cfg(bus_dev, devfn, where, |
599 | - size, value); |
600 | if (config_out_of_range(pbm, bus, devfn, where)) { |
601 | ret = ~0UL; |
602 | } else { |
603 | @@ -300,9 +297,6 @@ static int sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn, |
604 | unsigned int func = PCI_FUNC(devfn); |
605 | unsigned long ret; |
606 | |
607 | - if (!bus && devfn == 0x00) |
608 | - return pci_host_bridge_write_pci_cfg(bus_dev, devfn, where, |
609 | - size, value); |
610 | if (config_out_of_range(pbm, bus, devfn, where)) { |
611 | /* Do nothing. */ |
612 | } else { |
613 | diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc64/kernel/pci_impl.h |
614 | index 4a50da1..37b4403 100644 |
615 | --- a/arch/sparc64/kernel/pci_impl.h |
616 | +++ b/arch/sparc64/kernel/pci_impl.h |
617 | @@ -167,15 +167,6 @@ extern void pci_get_pbm_props(struct pci_pbm_info *pbm); |
618 | extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm); |
619 | extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); |
620 | |
621 | -extern int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev, |
622 | - unsigned int devfn, |
623 | - int where, int size, |
624 | - u32 *value); |
625 | -extern int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev, |
626 | - unsigned int devfn, |
627 | - int where, int size, |
628 | - u32 value); |
629 | - |
630 | /* Error reporting support. */ |
631 | extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); |
632 | extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); |
633 | diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c |
634 | index acf8c52..334e64c 100644 |
635 | --- a/arch/sparc64/kernel/process.c |
636 | +++ b/arch/sparc64/kernel/process.c |
637 | @@ -507,6 +507,8 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags, |
638 | unsigned long stack_size) |
639 | { |
640 | int __user *parent_tid_ptr, *child_tid_ptr; |
641 | + unsigned long orig_i1 = regs->u_regs[UREG_I1]; |
642 | + long ret; |
643 | |
644 | #ifdef CONFIG_COMPAT |
645 | if (test_thread_flag(TIF_32BIT)) { |
646 | @@ -519,9 +521,19 @@ asmlinkage long sparc_do_fork(unsigned long clone_flags, |
647 | child_tid_ptr = (int __user *) regs->u_regs[UREG_I4]; |
648 | } |
649 | |
650 | - return do_fork(clone_flags, stack_start, |
651 | - regs, stack_size, |
652 | - parent_tid_ptr, child_tid_ptr); |
653 | + ret = do_fork(clone_flags, stack_start, |
654 | + regs, stack_size, |
655 | + parent_tid_ptr, child_tid_ptr); |
656 | + |
657 | + /* If we get an error and potentially restart the system |
658 | + * call, we're screwed because copy_thread() clobbered |
659 | + * the parent's %o1. So detect that case and restore it |
660 | + * here. |
661 | + */ |
662 | + if ((unsigned long)ret >= -ERESTART_RESTARTBLOCK) |
663 | + regs->u_regs[UREG_I1] = orig_i1; |
664 | + |
665 | + return ret; |
666 | } |
667 | |
668 | /* Copy a Sparc thread. The fork() return value conventions |
669 | diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c |
670 | index e9fc0aa..f6c9fc9 100644 |
671 | --- a/arch/sparc64/kernel/ptrace.c |
672 | +++ b/arch/sparc64/kernel/ptrace.c |
673 | @@ -287,11 +287,11 @@ static int genregs64_set(struct task_struct *target, |
674 | 32 * sizeof(u64), |
675 | 33 * sizeof(u64)); |
676 | if (!ret) { |
677 | - /* Only the condition codes can be modified |
678 | - * in the %tstate register. |
679 | + /* Only the condition codes and the "in syscall" |
680 | + * state can be modified in the %tstate register. |
681 | */ |
682 | - tstate &= (TSTATE_ICC | TSTATE_XCC); |
683 | - regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC); |
684 | + tstate &= (TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
685 | + regs->tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
686 | regs->tstate |= tstate; |
687 | } |
688 | } |
689 | @@ -657,8 +657,10 @@ static int genregs32_set(struct task_struct *target, |
690 | switch (pos) { |
691 | case 32: /* PSR */ |
692 | tstate = regs->tstate; |
693 | - tstate &= ~(TSTATE_ICC | TSTATE_XCC); |
694 | + tstate &= ~(TSTATE_ICC | TSTATE_XCC | TSTATE_SYSCALL); |
695 | tstate |= psr_to_tstate_icc(reg); |
696 | + if (reg & PSR_SYSCALL) |
697 | + tstate |= TSTATE_SYSCALL; |
698 | regs->tstate = tstate; |
699 | break; |
700 | case 33: /* PC */ |
701 | @@ -944,6 +946,8 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, |
702 | break; |
703 | |
704 | default: |
705 | + if (request == PTRACE_SPARC_DETACH) |
706 | + request = PTRACE_DETACH; |
707 | ret = compat_ptrace_request(child, request, addr, data); |
708 | break; |
709 | } |
710 | @@ -1036,6 +1040,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) |
711 | break; |
712 | |
713 | default: |
714 | + if (request == PTRACE_SPARC_DETACH) |
715 | + request = PTRACE_DETACH; |
716 | ret = ptrace_request(child, request, addr, data); |
717 | break; |
718 | } |
719 | diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S |
720 | index 079d18a..5bfa79d 100644 |
721 | --- a/arch/sparc64/kernel/rtrap.S |
722 | +++ b/arch/sparc64/kernel/rtrap.S |
723 | @@ -270,6 +270,7 @@ rt_continue: ldx [%sp + PTREGS_OFF + PT_V9_G1], %g1 |
724 | wr %o3, %g0, %y |
725 | wrpr %l4, 0x0, %pil |
726 | wrpr %g0, 0x1, %tl |
727 | + andn %l1, TSTATE_SYSCALL, %l1 |
728 | wrpr %l1, %g0, %tstate |
729 | wrpr %l2, %g0, %tpc |
730 | wrpr %o2, %g0, %tnpc |
731 | diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c |
732 | index 9d51956..ec016cb 100644 |
733 | --- a/arch/sparc64/kernel/signal.c |
734 | +++ b/arch/sparc64/kernel/signal.c |
735 | @@ -336,6 +336,9 @@ void do_rt_sigreturn(struct pt_regs *regs) |
736 | regs->tpc = tpc; |
737 | regs->tnpc = tnpc; |
738 | |
739 | + /* Prevent syscall restart. */ |
740 | + pt_regs_clear_syscall(regs); |
741 | + |
742 | sigdelsetmask(&set, ~_BLOCKABLE); |
743 | spin_lock_irq(¤t->sighand->siglock); |
744 | current->blocked = set; |
745 | @@ -377,16 +380,29 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) |
746 | |
747 | static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, unsigned long framesize) |
748 | { |
749 | - unsigned long sp; |
750 | + unsigned long sp = regs->u_regs[UREG_FP] + STACK_BIAS; |
751 | |
752 | - sp = regs->u_regs[UREG_FP] + STACK_BIAS; |
753 | + /* |
754 | + * If we are on the alternate signal stack and would overflow it, don't. |
755 | + * Return an always-bogus address instead so we will die with SIGSEGV. |
756 | + */ |
757 | + if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) |
758 | + return (void __user *) -1L; |
759 | |
760 | /* This is the X/Open sanctioned signal stack switching. */ |
761 | if (ka->sa.sa_flags & SA_ONSTACK) { |
762 | - if (!on_sig_stack(sp) && |
763 | - !((current->sas_ss_sp + current->sas_ss_size) & 7)) |
764 | + if (sas_ss_flags(sp) == 0) |
765 | sp = current->sas_ss_sp + current->sas_ss_size; |
766 | } |
767 | + |
768 | + /* Always align the stack frame. This handles two cases. First, |
769 | + * sigaltstack need not be mindful of platform specific stack |
770 | + * alignment. Second, if we took this signal because the stack |
771 | + * is not aligned properly, we'd like to take the signal cleanly |
772 | + * and report that. |
773 | + */ |
774 | + sp &= ~7UL; |
775 | + |
776 | return (void __user *)(sp - framesize); |
777 | } |
778 | |
779 | @@ -487,7 +503,7 @@ static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, |
780 | } |
781 | |
782 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
783 | - struct sigaction *sa) |
784 | + struct sigaction *sa) |
785 | { |
786 | switch (regs->u_regs[UREG_I0]) { |
787 | case ERESTART_RESTARTBLOCK: |
788 | @@ -511,16 +527,19 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
789 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
790 | * mistake. |
791 | */ |
792 | -static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall) |
793 | +static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int __ignored) |
794 | { |
795 | - siginfo_t info; |
796 | - struct signal_deliver_cookie cookie; |
797 | struct k_sigaction ka; |
798 | - int signr; |
799 | + int restart_syscall; |
800 | sigset_t *oldset; |
801 | + siginfo_t info; |
802 | + int signr; |
803 | |
804 | - cookie.restart_syscall = restart_syscall; |
805 | - cookie.orig_i0 = orig_i0; |
806 | + if (pt_regs_is_syscall(regs) && |
807 | + (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) { |
808 | + restart_syscall = 1; |
809 | + } else |
810 | + restart_syscall = 0; |
811 | |
812 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
813 | oldset = ¤t->saved_sigmask; |
814 | @@ -530,16 +549,24 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s |
815 | #ifdef CONFIG_SPARC32_COMPAT |
816 | if (test_thread_flag(TIF_32BIT)) { |
817 | extern void do_signal32(sigset_t *, struct pt_regs *, |
818 | - unsigned long, int); |
819 | - do_signal32(oldset, regs, orig_i0, |
820 | - cookie.restart_syscall); |
821 | + int restart_syscall, |
822 | + unsigned long orig_i0); |
823 | + do_signal32(oldset, regs, restart_syscall, orig_i0); |
824 | return; |
825 | } |
826 | #endif |
827 | |
828 | - signr = get_signal_to_deliver(&info, &ka, regs, &cookie); |
829 | + signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
830 | + |
831 | + /* If the debugger messes with the program counter, it clears |
832 | + * the software "in syscall" bit, directing us to not perform |
833 | + * a syscall restart. |
834 | + */ |
835 | + if (restart_syscall && !pt_regs_is_syscall(regs)) |
836 | + restart_syscall = 0; |
837 | + |
838 | if (signr > 0) { |
839 | - if (cookie.restart_syscall) |
840 | + if (restart_syscall) |
841 | syscall_restart(orig_i0, regs, &ka.sa); |
842 | handle_signal(signr, &ka, &info, oldset, regs); |
843 | |
844 | @@ -552,16 +579,16 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_s |
845 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
846 | return; |
847 | } |
848 | - if (cookie.restart_syscall && |
849 | + if (restart_syscall && |
850 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
851 | regs->u_regs[UREG_I0] == ERESTARTSYS || |
852 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
853 | /* replay the system call when we are done */ |
854 | - regs->u_regs[UREG_I0] = cookie.orig_i0; |
855 | + regs->u_regs[UREG_I0] = orig_i0; |
856 | regs->tpc -= 4; |
857 | regs->tnpc -= 4; |
858 | } |
859 | - if (cookie.restart_syscall && |
860 | + if (restart_syscall && |
861 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
862 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
863 | regs->tpc -= 4; |
864 | @@ -583,26 +610,3 @@ void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, int restart_s |
865 | if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) |
866 | do_signal(regs, orig_i0, restart_syscall); |
867 | } |
868 | - |
869 | -void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) |
870 | -{ |
871 | - struct signal_deliver_cookie *cp = cookie; |
872 | - |
873 | - if (cp->restart_syscall && |
874 | - (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
875 | - regs->u_regs[UREG_I0] == ERESTARTSYS || |
876 | - regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
877 | - /* replay the system call when we are done */ |
878 | - regs->u_regs[UREG_I0] = cp->orig_i0; |
879 | - regs->tpc -= 4; |
880 | - regs->tnpc -= 4; |
881 | - cp->restart_syscall = 0; |
882 | - } |
883 | - if (cp->restart_syscall && |
884 | - regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
885 | - regs->u_regs[UREG_G1] = __NR_restart_syscall; |
886 | - regs->tpc -= 4; |
887 | - regs->tnpc -= 4; |
888 | - cp->restart_syscall = 0; |
889 | - } |
890 | -} |
891 | diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c |
892 | index 8c1c121..c1b06e2 100644 |
893 | --- a/arch/sparc64/kernel/signal32.c |
894 | +++ b/arch/sparc64/kernel/signal32.c |
895 | @@ -295,6 +295,9 @@ void do_new_sigreturn32(struct pt_regs *regs) |
896 | regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); |
897 | regs->tstate |= psr_to_tstate_icc(psr); |
898 | |
899 | + /* Prevent syscall restart. */ |
900 | + pt_regs_clear_syscall(regs); |
901 | + |
902 | err |= __get_user(fpu_save, &sf->fpu_save); |
903 | if (fpu_save) |
904 | err |= restore_fpu_state32(regs, &sf->fpu_state); |
905 | @@ -448,6 +451,9 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs) |
906 | regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); |
907 | regs->tstate |= psr_to_tstate_icc(psr); |
908 | |
909 | + /* Prevent syscall restart. */ |
910 | + pt_regs_clear_syscall(regs); |
911 | + |
912 | err |= __get_user(fpu_save, &sf->fpu_save); |
913 | if (fpu_save) |
914 | err |= restore_fpu_state32(regs, &sf->fpu_state); |
915 | @@ -497,11 +503,27 @@ static void __user *get_sigframe(struct sigaction *sa, struct pt_regs *regs, uns |
916 | regs->u_regs[UREG_FP] &= 0x00000000ffffffffUL; |
917 | sp = regs->u_regs[UREG_FP]; |
918 | |
919 | + /* |
920 | + * If we are on the alternate signal stack and would overflow it, don't. |
921 | + * Return an always-bogus address instead so we will die with SIGSEGV. |
922 | + */ |
923 | + if (on_sig_stack(sp) && !likely(on_sig_stack(sp - framesize))) |
924 | + return (void __user *) -1L; |
925 | + |
926 | /* This is the X/Open sanctioned signal stack switching. */ |
927 | if (sa->sa_flags & SA_ONSTACK) { |
928 | - if (!on_sig_stack(sp) && !((current->sas_ss_sp + current->sas_ss_size) & 7)) |
929 | + if (sas_ss_flags(sp) == 0) |
930 | sp = current->sas_ss_sp + current->sas_ss_size; |
931 | } |
932 | + |
933 | + /* Always align the stack frame. This handles two cases. First, |
934 | + * sigaltstack need not be mindful of platform specific stack |
935 | + * alignment. Second, if we took this signal because the stack |
936 | + * is not aligned properly, we'd like to take the signal cleanly |
937 | + * and report that. |
938 | + */ |
939 | + sp &= ~7UL; |
940 | + |
941 | return (void __user *)(sp - framesize); |
942 | } |
943 | |
944 | @@ -1264,20 +1286,24 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs |
945 | * mistake. |
946 | */ |
947 | void do_signal32(sigset_t *oldset, struct pt_regs * regs, |
948 | - unsigned long orig_i0, int restart_syscall) |
949 | + int restart_syscall, unsigned long orig_i0) |
950 | { |
951 | - siginfo_t info; |
952 | - struct signal_deliver_cookie cookie; |
953 | struct k_sigaction ka; |
954 | + siginfo_t info; |
955 | int signr; |
956 | int svr4_signal = current->personality == PER_SVR4; |
957 | |
958 | - cookie.restart_syscall = restart_syscall; |
959 | - cookie.orig_i0 = orig_i0; |
960 | + signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
961 | + |
962 | + /* If the debugger messes with the program counter, it clears |
963 | + * the "in syscall" bit, directing us to not perform a syscall |
964 | + * restart. |
965 | + */ |
966 | + if (restart_syscall && !pt_regs_is_syscall(regs)) |
967 | + restart_syscall = 0; |
968 | |
969 | - signr = get_signal_to_deliver(&info, &ka, regs, &cookie); |
970 | if (signr > 0) { |
971 | - if (cookie.restart_syscall) |
972 | + if (restart_syscall) |
973 | syscall_restart32(orig_i0, regs, &ka.sa); |
974 | handle_signal32(signr, &ka, &info, oldset, |
975 | regs, svr4_signal); |
976 | @@ -1291,16 +1317,16 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs, |
977 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
978 | return; |
979 | } |
980 | - if (cookie.restart_syscall && |
981 | + if (restart_syscall && |
982 | (regs->u_regs[UREG_I0] == ERESTARTNOHAND || |
983 | regs->u_regs[UREG_I0] == ERESTARTSYS || |
984 | regs->u_regs[UREG_I0] == ERESTARTNOINTR)) { |
985 | /* replay the system call when we are done */ |
986 | - regs->u_regs[UREG_I0] = cookie.orig_i0; |
987 | + regs->u_regs[UREG_I0] = orig_i0; |
988 | regs->tpc -= 4; |
989 | regs->tnpc -= 4; |
990 | } |
991 | - if (cookie.restart_syscall && |
992 | + if (restart_syscall && |
993 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
994 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
995 | regs->tpc -= 4; |
996 | diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c |
997 | index cc37936..4b495fe 100644 |
998 | --- a/arch/sparc64/kernel/sys_sparc.c |
999 | +++ b/arch/sparc64/kernel/sys_sparc.c |
1000 | @@ -454,8 +454,8 @@ asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second, |
1001 | err = sys_semget(first, (int)second, (int)third); |
1002 | goto out; |
1003 | case SEMCTL: { |
1004 | - err = sys_semctl(first, third, |
1005 | - (int)second | IPC_64, |
1006 | + err = sys_semctl(first, second, |
1007 | + (int)third | IPC_64, |
1008 | (union semun) ptr); |
1009 | goto out; |
1010 | } |
1011 | @@ -542,8 +542,7 @@ asmlinkage long sparc64_personality(unsigned long personality) |
1012 | return ret; |
1013 | } |
1014 | |
1015 | -int sparc64_mmap_check(unsigned long addr, unsigned long len, |
1016 | - unsigned long flags) |
1017 | +int sparc64_mmap_check(unsigned long addr, unsigned long len) |
1018 | { |
1019 | if (test_thread_flag(TIF_32BIT)) { |
1020 | if (len >= STACK_TOP32) |
1021 | @@ -609,46 +608,19 @@ asmlinkage unsigned long sys64_mremap(unsigned long addr, |
1022 | unsigned long old_len, unsigned long new_len, |
1023 | unsigned long flags, unsigned long new_addr) |
1024 | { |
1025 | - struct vm_area_struct *vma; |
1026 | unsigned long ret = -EINVAL; |
1027 | |
1028 | if (test_thread_flag(TIF_32BIT)) |
1029 | goto out; |
1030 | if (unlikely(new_len >= VA_EXCLUDE_START)) |
1031 | goto out; |
1032 | - if (unlikely(invalid_64bit_range(addr, old_len))) |
1033 | + if (unlikely(sparc64_mmap_check(addr, old_len))) |
1034 | + goto out; |
1035 | + if (unlikely(sparc64_mmap_check(new_addr, new_len))) |
1036 | goto out; |
1037 | |
1038 | down_write(¤t->mm->mmap_sem); |
1039 | - if (flags & MREMAP_FIXED) { |
1040 | - if (invalid_64bit_range(new_addr, new_len)) |
1041 | - goto out_sem; |
1042 | - } else if (invalid_64bit_range(addr, new_len)) { |
1043 | - unsigned long map_flags = 0; |
1044 | - struct file *file = NULL; |
1045 | - |
1046 | - ret = -ENOMEM; |
1047 | - if (!(flags & MREMAP_MAYMOVE)) |
1048 | - goto out_sem; |
1049 | - |
1050 | - vma = find_vma(current->mm, addr); |
1051 | - if (vma) { |
1052 | - if (vma->vm_flags & VM_SHARED) |
1053 | - map_flags |= MAP_SHARED; |
1054 | - file = vma->vm_file; |
1055 | - } |
1056 | - |
1057 | - /* MREMAP_FIXED checked above. */ |
1058 | - new_addr = get_unmapped_area(file, addr, new_len, |
1059 | - vma ? vma->vm_pgoff : 0, |
1060 | - map_flags); |
1061 | - ret = new_addr; |
1062 | - if (new_addr & ~PAGE_MASK) |
1063 | - goto out_sem; |
1064 | - flags |= MREMAP_FIXED; |
1065 | - } |
1066 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
1067 | -out_sem: |
1068 | up_write(¤t->mm->mmap_sem); |
1069 | out: |
1070 | return ret; |
1071 | diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c |
1072 | index 2455fa4..54df31a 100644 |
1073 | --- a/arch/sparc64/kernel/sys_sparc32.c |
1074 | +++ b/arch/sparc64/kernel/sys_sparc32.c |
1075 | @@ -906,44 +906,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr, |
1076 | unsigned long old_len, unsigned long new_len, |
1077 | unsigned long flags, u32 __new_addr) |
1078 | { |
1079 | - struct vm_area_struct *vma; |
1080 | unsigned long ret = -EINVAL; |
1081 | unsigned long new_addr = __new_addr; |
1082 | |
1083 | - if (old_len > STACK_TOP32 || new_len > STACK_TOP32) |
1084 | + if (unlikely(sparc64_mmap_check(addr, old_len))) |
1085 | goto out; |
1086 | - if (addr > STACK_TOP32 - old_len) |
1087 | + if (unlikely(sparc64_mmap_check(new_addr, new_len))) |
1088 | goto out; |
1089 | down_write(¤t->mm->mmap_sem); |
1090 | - if (flags & MREMAP_FIXED) { |
1091 | - if (new_addr > STACK_TOP32 - new_len) |
1092 | - goto out_sem; |
1093 | - } else if (addr > STACK_TOP32 - new_len) { |
1094 | - unsigned long map_flags = 0; |
1095 | - struct file *file = NULL; |
1096 | - |
1097 | - ret = -ENOMEM; |
1098 | - if (!(flags & MREMAP_MAYMOVE)) |
1099 | - goto out_sem; |
1100 | - |
1101 | - vma = find_vma(current->mm, addr); |
1102 | - if (vma) { |
1103 | - if (vma->vm_flags & VM_SHARED) |
1104 | - map_flags |= MAP_SHARED; |
1105 | - file = vma->vm_file; |
1106 | - } |
1107 | - |
1108 | - /* MREMAP_FIXED checked above. */ |
1109 | - new_addr = get_unmapped_area(file, addr, new_len, |
1110 | - vma ? vma->vm_pgoff : 0, |
1111 | - map_flags); |
1112 | - ret = new_addr; |
1113 | - if (new_addr & ~PAGE_MASK) |
1114 | - goto out_sem; |
1115 | - flags |= MREMAP_FIXED; |
1116 | - } |
1117 | ret = do_mremap(addr, old_len, new_len, flags, new_addr); |
1118 | -out_sem: |
1119 | up_write(¤t->mm->mmap_sem); |
1120 | out: |
1121 | return ret; |
1122 | diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig |
1123 | index 6c70fed..99a4ed3 100644 |
1124 | --- a/arch/x86/Kconfig |
1125 | +++ b/arch/x86/Kconfig |
1126 | @@ -24,6 +24,18 @@ config X86 |
1127 | select HAVE_KRETPROBES |
1128 | select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64) |
1129 | |
1130 | +config DEFCONFIG_LIST |
1131 | + string |
1132 | + depends on X86_32 |
1133 | + option defconfig_list |
1134 | + default "arch/x86/configs/i386_defconfig" |
1135 | + |
1136 | +config DEFCONFIG_LIST |
1137 | + string |
1138 | + depends on X86_64 |
1139 | + option defconfig_list |
1140 | + default "arch/x86/configs/x86_64_defconfig" |
1141 | + |
1142 | |
1143 | config GENERIC_LOCKBREAK |
1144 | def_bool n |
1145 | diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c |
1146 | index fae8404..815b8c3 100644 |
1147 | --- a/drivers/ata/ata_piix.c |
1148 | +++ b/drivers/ata/ata_piix.c |
1149 | @@ -1531,6 +1531,8 @@ static void __devinit piix_init_sidpr(struct ata_host *host) |
1150 | { |
1151 | struct pci_dev *pdev = to_pci_dev(host->dev); |
1152 | struct piix_host_priv *hpriv = host->private_data; |
1153 | + struct ata_device *dev0 = &host->ports[0]->link.device[0]; |
1154 | + u32 scontrol; |
1155 | int i; |
1156 | |
1157 | /* check for availability */ |
1158 | @@ -1549,6 +1551,29 @@ static void __devinit piix_init_sidpr(struct ata_host *host) |
1159 | return; |
1160 | |
1161 | hpriv->sidpr = pcim_iomap_table(pdev)[PIIX_SIDPR_BAR]; |
1162 | + |
1163 | + /* SCR access via SIDPR doesn't work on some configurations. |
1164 | + * Give it a test drive by inhibiting power save modes which |
1165 | + * we'll do anyway. |
1166 | + */ |
1167 | + scontrol = piix_sidpr_read(dev0, SCR_CONTROL); |
1168 | + |
1169 | + /* if IPM is already 3, SCR access is probably working. Don't |
1170 | + * un-inhibit power save modes as BIOS might have inhibited |
1171 | + * them for a reason. |
1172 | + */ |
1173 | + if ((scontrol & 0xf00) != 0x300) { |
1174 | + scontrol |= 0x300; |
1175 | + piix_sidpr_write(dev0, SCR_CONTROL, scontrol); |
1176 | + scontrol = piix_sidpr_read(dev0, SCR_CONTROL); |
1177 | + |
1178 | + if ((scontrol & 0xf00) != 0x300) { |
1179 | + dev_printk(KERN_INFO, host->dev, "SCR access via " |
1180 | + "SIDPR is available but doesn't work\n"); |
1181 | + return; |
1182 | + } |
1183 | + } |
1184 | + |
1185 | host->ports[0]->ops = &piix_sidpr_sata_ops; |
1186 | host->ports[1]->ops = &piix_sidpr_sata_ops; |
1187 | } |
1188 | diff --git a/drivers/char/vt.c b/drivers/char/vt.c |
1189 | index 9b58b89..c2e1a83 100644 |
1190 | --- a/drivers/char/vt.c |
1191 | +++ b/drivers/char/vt.c |
1192 | @@ -2723,6 +2723,10 @@ static int con_open(struct tty_struct *tty, struct file *filp) |
1193 | tty->winsize.ws_row = vc_cons[currcons].d->vc_rows; |
1194 | tty->winsize.ws_col = vc_cons[currcons].d->vc_cols; |
1195 | } |
1196 | + if (vc->vc_utf) |
1197 | + tty->termios->c_iflag |= IUTF8; |
1198 | + else |
1199 | + tty->termios->c_iflag &= ~IUTF8; |
1200 | release_console_sem(); |
1201 | vcs_make_sysfs(tty); |
1202 | return ret; |
1203 | @@ -2899,6 +2903,8 @@ int __init vty_init(void) |
1204 | console_driver->minor_start = 1; |
1205 | console_driver->type = TTY_DRIVER_TYPE_CONSOLE; |
1206 | console_driver->init_termios = tty_std_termios; |
1207 | + if (default_utf8) |
1208 | + console_driver->init_termios.c_iflag |= IUTF8; |
1209 | console_driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS; |
1210 | tty_set_operations(console_driver, &con_ops); |
1211 | if (tty_register_driver(console_driver)) |
1212 | diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c |
1213 | index 9bbe96c..f0b4073 100644 |
1214 | --- a/drivers/i2c/busses/i2c-piix4.c |
1215 | +++ b/drivers/i2c/busses/i2c-piix4.c |
1216 | @@ -108,7 +108,27 @@ static unsigned short piix4_smba; |
1217 | static struct pci_driver piix4_driver; |
1218 | static struct i2c_adapter piix4_adapter; |
1219 | |
1220 | -static struct dmi_system_id __devinitdata piix4_dmi_table[] = { |
1221 | +static struct dmi_system_id __devinitdata piix4_dmi_blacklist[] = { |
1222 | + { |
1223 | + .ident = "Sapphire AM2RD790", |
1224 | + .matches = { |
1225 | + DMI_MATCH(DMI_BOARD_VENDOR, "SAPPHIRE Inc."), |
1226 | + DMI_MATCH(DMI_BOARD_NAME, "PC-AM2RD790"), |
1227 | + }, |
1228 | + }, |
1229 | + { |
1230 | + .ident = "DFI Lanparty UT 790FX", |
1231 | + .matches = { |
1232 | + DMI_MATCH(DMI_BOARD_VENDOR, "DFI Inc."), |
1233 | + DMI_MATCH(DMI_BOARD_NAME, "LP UT 790FX"), |
1234 | + }, |
1235 | + }, |
1236 | + { } |
1237 | +}; |
1238 | + |
1239 | +/* The IBM entry is in a separate table because we only check it |
1240 | + on Intel-based systems */ |
1241 | +static struct dmi_system_id __devinitdata piix4_dmi_ibm[] = { |
1242 | { |
1243 | .ident = "IBM", |
1244 | .matches = { DMI_MATCH(DMI_SYS_VENDOR, "IBM"), }, |
1245 | @@ -123,8 +143,16 @@ static int __devinit piix4_setup(struct pci_dev *PIIX4_dev, |
1246 | |
1247 | dev_info(&PIIX4_dev->dev, "Found %s device\n", pci_name(PIIX4_dev)); |
1248 | |
1249 | + /* On some motherboards, it was reported that accessing the SMBus |
1250 | + caused severe hardware problems */ |
1251 | + if (dmi_check_system(piix4_dmi_blacklist)) { |
1252 | + dev_err(&PIIX4_dev->dev, |
1253 | + "Accessing the SMBus on this system is unsafe!\n"); |
1254 | + return -EPERM; |
1255 | + } |
1256 | + |
1257 | /* Don't access SMBus on IBM systems which get corrupted eeproms */ |
1258 | - if (dmi_check_system(piix4_dmi_table) && |
1259 | + if (dmi_check_system(piix4_dmi_ibm) && |
1260 | PIIX4_dev->vendor == PCI_VENDOR_ID_INTEL) { |
1261 | dev_err(&PIIX4_dev->dev, "IBM system detected; this module " |
1262 | "may corrupt your serial eeprom! Refusing to load " |
1263 | diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c |
1264 | index b162b83..18a1379 100644 |
1265 | --- a/drivers/md/raid5.c |
1266 | +++ b/drivers/md/raid5.c |
1267 | @@ -2354,8 +2354,8 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, |
1268 | |
1269 | /* complete a check operation */ |
1270 | if (test_and_clear_bit(STRIPE_OP_CHECK, &sh->ops.complete)) { |
1271 | - clear_bit(STRIPE_OP_CHECK, &sh->ops.ack); |
1272 | - clear_bit(STRIPE_OP_CHECK, &sh->ops.pending); |
1273 | + clear_bit(STRIPE_OP_CHECK, &sh->ops.ack); |
1274 | + clear_bit(STRIPE_OP_CHECK, &sh->ops.pending); |
1275 | if (s->failed == 0) { |
1276 | if (sh->ops.zero_sum_result == 0) |
1277 | /* parity is correct (on disc, |
1278 | @@ -2385,16 +2385,6 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, |
1279 | canceled_check = 1; /* STRIPE_INSYNC is not set */ |
1280 | } |
1281 | |
1282 | - /* check if we can clear a parity disk reconstruct */ |
1283 | - if (test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete) && |
1284 | - test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) { |
1285 | - |
1286 | - clear_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending); |
1287 | - clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete); |
1288 | - clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.ack); |
1289 | - clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending); |
1290 | - } |
1291 | - |
1292 | /* start a new check operation if there are no failures, the stripe is |
1293 | * not insync, and a repair is not in flight |
1294 | */ |
1295 | @@ -2409,6 +2399,17 @@ static void handle_parity_checks5(raid5_conf_t *conf, struct stripe_head *sh, |
1296 | } |
1297 | } |
1298 | |
1299 | + /* check if we can clear a parity disk reconstruct */ |
1300 | + if (test_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete) && |
1301 | + test_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending)) { |
1302 | + |
1303 | + clear_bit(STRIPE_OP_MOD_REPAIR_PD, &sh->ops.pending); |
1304 | + clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.complete); |
1305 | + clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.ack); |
1306 | + clear_bit(STRIPE_OP_COMPUTE_BLK, &sh->ops.pending); |
1307 | + } |
1308 | + |
1309 | + |
1310 | /* Wait for check parity and compute block operations to complete |
1311 | * before write-back. If a failure occurred while the check operation |
1312 | * was in flight we need to cycle this stripe through handle_stripe |
1313 | diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c |
1314 | index e709382..9fd8399 100644 |
1315 | --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c |
1316 | +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c |
1317 | @@ -13,6 +13,7 @@ |
1318 | #include "dib7000p.h" |
1319 | #include "mt2060.h" |
1320 | #include "mt2266.h" |
1321 | +#include "tuner-xc2028.h" |
1322 | #include "dib0070.h" |
1323 | |
1324 | static int force_lna_activation; |
1325 | @@ -297,6 +298,149 @@ static int stk7700d_tuner_attach(struct dvb_usb_adapter *adap) |
1326 | &stk7700d_mt2266_config[adap->id]) == NULL ? -ENODEV : 0;; |
1327 | } |
1328 | |
1329 | +/* STK7700-PH: Digital/Analog Hybrid Tuner, e.h. Cinergy HT USB HE */ |
1330 | +struct dibx000_agc_config xc3028_agc_config = { |
1331 | + BAND_VHF | BAND_UHF, /* band_caps */ |
1332 | + |
1333 | + /* P_agc_use_sd_mod1=0, P_agc_use_sd_mod2=0, P_agc_freq_pwm_div=0, |
1334 | + * P_agc_inv_pwm1=0, P_agc_inv_pwm2=0, P_agc_inh_dc_rv_est=0, |
1335 | + * P_agc_time_est=3, P_agc_freeze=0, P_agc_nb_est=2, P_agc_write=0 */ |
1336 | + (0 << 15) | (0 << 14) | (0 << 11) | (0 << 10) | (0 << 9) | (0 << 8) | |
1337 | + (3 << 5) | (0 << 4) | (2 << 1) | (0 << 0), /* setup */ |
1338 | + |
1339 | + 712, /* inv_gain */ |
1340 | + 21, /* time_stabiliz */ |
1341 | + |
1342 | + 0, /* alpha_level */ |
1343 | + 118, /* thlock */ |
1344 | + |
1345 | + 0, /* wbd_inv */ |
1346 | + 2867, /* wbd_ref */ |
1347 | + 0, /* wbd_sel */ |
1348 | + 2, /* wbd_alpha */ |
1349 | + |
1350 | + 0, /* agc1_max */ |
1351 | + 0, /* agc1_min */ |
1352 | + 39718, /* agc2_max */ |
1353 | + 9930, /* agc2_min */ |
1354 | + 0, /* agc1_pt1 */ |
1355 | + 0, /* agc1_pt2 */ |
1356 | + 0, /* agc1_pt3 */ |
1357 | + 0, /* agc1_slope1 */ |
1358 | + 0, /* agc1_slope2 */ |
1359 | + 0, /* agc2_pt1 */ |
1360 | + 128, /* agc2_pt2 */ |
1361 | + 29, /* agc2_slope1 */ |
1362 | + 29, /* agc2_slope2 */ |
1363 | + |
1364 | + 17, /* alpha_mant */ |
1365 | + 27, /* alpha_exp */ |
1366 | + 23, /* beta_mant */ |
1367 | + 51, /* beta_exp */ |
1368 | + |
1369 | + 1, /* perform_agc_softsplit */ |
1370 | +}; |
1371 | + |
1372 | +/* PLL Configuration for COFDM BW_MHz = 8.00 with external clock = 30.00 */ |
1373 | +struct dibx000_bandwidth_config xc3028_bw_config = { |
1374 | + 60000, 30000, /* internal, sampling */ |
1375 | + 1, 8, 3, 1, 0, /* pll_cfg: prediv, ratio, range, reset, bypass */ |
1376 | + 0, 0, 1, 1, 0, /* misc: refdiv, bypclk_div, IO_CLK_en_core, ADClkSrc, |
1377 | + modulo */ |
1378 | + (3 << 14) | (1 << 12) | (524 << 0), /* sad_cfg: refsel, sel, freq_15k */ |
1379 | + (1 << 25) | 5816102, /* ifreq = 5.200000 MHz */ |
1380 | + 20452225, /* timf */ |
1381 | + 30000000, /* xtal_hz */ |
1382 | +}; |
1383 | + |
1384 | +static struct dib7000p_config stk7700ph_dib7700_xc3028_config = { |
1385 | + .output_mpeg2_in_188_bytes = 1, |
1386 | + .tuner_is_baseband = 1, |
1387 | + |
1388 | + .agc_config_count = 1, |
1389 | + .agc = &xc3028_agc_config, |
1390 | + .bw = &xc3028_bw_config, |
1391 | + |
1392 | + .gpio_dir = DIB7000P_GPIO_DEFAULT_DIRECTIONS, |
1393 | + .gpio_val = DIB7000P_GPIO_DEFAULT_VALUES, |
1394 | + .gpio_pwm_pos = DIB7000P_GPIO_DEFAULT_PWM_POS, |
1395 | +}; |
1396 | + |
1397 | +static int stk7700ph_xc3028_callback(void *ptr, int command, int arg) |
1398 | +{ |
1399 | + struct dvb_usb_adapter *adap = ptr; |
1400 | + |
1401 | + switch (command) { |
1402 | + case XC2028_TUNER_RESET: |
1403 | + /* Send the tuner in then out of reset */ |
1404 | + dib7000p_set_gpio(adap->fe, 8, 0, 0); msleep(10); |
1405 | + dib7000p_set_gpio(adap->fe, 8, 0, 1); |
1406 | + break; |
1407 | + case XC2028_RESET_CLK: |
1408 | + break; |
1409 | + default: |
1410 | + err("%s: unknown command %d, arg %d\n", __func__, |
1411 | + command, arg); |
1412 | + return -EINVAL; |
1413 | + } |
1414 | + return 0; |
1415 | +} |
1416 | + |
1417 | +static struct xc2028_ctrl stk7700ph_xc3028_ctrl = { |
1418 | + .fname = XC2028_DEFAULT_FIRMWARE, |
1419 | + .max_len = 64, |
1420 | + .demod = XC3028_FE_DIBCOM52, |
1421 | +}; |
1422 | + |
1423 | +static struct xc2028_config stk7700ph_xc3028_config = { |
1424 | + .i2c_addr = 0x61, |
1425 | + .callback = stk7700ph_xc3028_callback, |
1426 | + .ctrl = &stk7700ph_xc3028_ctrl, |
1427 | +}; |
1428 | + |
1429 | +static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) |
1430 | +{ |
1431 | + struct usb_device_descriptor *desc = &adap->dev->udev->descriptor; |
1432 | + |
1433 | + if (desc->idVendor == USB_VID_PINNACLE && |
1434 | + desc->idProduct == USB_PID_PINNACLE_EXPRESSCARD_320CX) |
1435 | + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
1436 | + else |
1437 | + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
1438 | + msleep(20); |
1439 | + dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
1440 | + dib0700_set_gpio(adap->dev, GPIO4, GPIO_OUT, 1); |
1441 | + dib0700_set_gpio(adap->dev, GPIO7, GPIO_OUT, 1); |
1442 | + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); |
1443 | + msleep(10); |
1444 | + dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); |
1445 | + msleep(20); |
1446 | + dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
1447 | + msleep(10); |
1448 | + |
1449 | + dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
1450 | + &stk7700ph_dib7700_xc3028_config); |
1451 | + |
1452 | + adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
1453 | + &stk7700ph_dib7700_xc3028_config); |
1454 | + |
1455 | + return adap->fe == NULL ? -ENODEV : 0; |
1456 | +} |
1457 | + |
1458 | +static int stk7700ph_tuner_attach(struct dvb_usb_adapter *adap) |
1459 | +{ |
1460 | + struct i2c_adapter *tun_i2c; |
1461 | + |
1462 | + tun_i2c = dib7000p_get_i2c_master(adap->fe, |
1463 | + DIBX000_I2C_INTERFACE_TUNER, 1); |
1464 | + |
1465 | + stk7700ph_xc3028_config.i2c_adap = tun_i2c; |
1466 | + stk7700ph_xc3028_config.video_dev = adap; |
1467 | + |
1468 | + return dvb_attach(xc2028_attach, adap->fe, &stk7700ph_xc3028_config) |
1469 | + == NULL ? -ENODEV : 0; |
1470 | +} |
1471 | + |
1472 | #define DEFAULT_RC_INTERVAL 150 |
1473 | |
1474 | static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; |
1475 | @@ -794,6 +938,10 @@ static struct dib7000p_config dib7070p_dib7000p_config = { |
1476 | /* STK7070P */ |
1477 | static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) |
1478 | { |
1479 | + if (adap->dev->udev->descriptor.idVendor == USB_VID_PINNACLE && |
1480 | + adap->dev->udev->descriptor.idProduct == USB_PID_PINNACLE_PCTV72E) |
1481 | + dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); |
1482 | + else |
1483 | dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); |
1484 | msleep(10); |
1485 | dib0700_set_gpio(adap->dev, GPIO9, GPIO_OUT, 1); |
1486 | @@ -808,9 +956,11 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) |
1487 | msleep(10); |
1488 | dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); |
1489 | |
1490 | - dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, &dib7070p_dib7000p_config); |
1491 | + dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, |
1492 | + &dib7070p_dib7000p_config); |
1493 | |
1494 | - adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &dib7070p_dib7000p_config); |
1495 | + adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, |
1496 | + &dib7070p_dib7000p_config); |
1497 | return adap->fe == NULL ? -ENODEV : 0; |
1498 | } |
1499 | |
1500 | @@ -878,34 +1028,41 @@ static int stk7070pd_frontend_attach1(struct dvb_usb_adapter *adap) |
1501 | /* DVB-USB and USB stuff follows */ |
1502 | struct usb_device_id dib0700_usb_id_table[] = { |
1503 | /* 0 */ { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) }, |
1504 | - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, |
1505 | - |
1506 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, |
1507 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, |
1508 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, |
1509 | + { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P_PC) }, |
1510 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) }, |
1511 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) }, |
1512 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) }, |
1513 | /* 5 */ { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) }, |
1514 | - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, |
1515 | - { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, |
1516 | - { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, |
1517 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, |
1518 | + { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500) }, |
1519 | + { USB_DEVICE(USB_VID_UNIWILL, USB_PID_UNIWILL_STK7700P) }, |
1520 | + { USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV_DONGLE_STK7700P) }, |
1521 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_2) }, |
1522 | /* 10 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR_2) }, |
1523 | - { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, |
1524 | - { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, |
1525 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, |
1526 | - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, |
1527 | + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV2000E) }, |
1528 | + { USB_DEVICE(USB_VID_TERRATEC, |
1529 | + USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY) }, |
1530 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_TD_STICK) }, |
1531 | + { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700D) }, |
1532 | /* 15 */{ USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070P) }, |
1533 | - { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, |
1534 | - { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, |
1535 | - { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, |
1536 | - { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, |
1537 | + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV_DVB_T_FLASH) }, |
1538 | + { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7070PD) }, |
1539 | + { USB_DEVICE(USB_VID_PINNACLE, |
1540 | + USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T) }, |
1541 | + { USB_DEVICE(USB_VID_COMPRO, USB_PID_COMPRO_VIDEOMATE_U500_PC) }, |
1542 | /* 20 */{ USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_EXPRESS) }, |
1543 | - { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, |
1544 | - { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, |
1545 | - { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, |
1546 | - { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, |
1547 | -/* 25 */ { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, |
1548 | - { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, |
1549 | - { 0 } /* Terminating entry */ |
1550 | + { USB_DEVICE(USB_VID_GIGABYTE, USB_PID_GIGABYTE_U7000) }, |
1551 | + { USB_DEVICE(USB_VID_ULTIMA_ELECTRONIC, USB_PID_ARTEC_T14BR) }, |
1552 | + { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3000) }, |
1553 | + { USB_DEVICE(USB_VID_ASUS, USB_PID_ASUS_U3100) }, |
1554 | +/* 25 */{ USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK_3) }, |
1555 | + { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_MYTV_T) }, |
1556 | + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_USB_XE) }, |
1557 | + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_EXPRESSCARD_320CX) }, |
1558 | + { USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV72E) }, |
1559 | +/* 30 */{ USB_DEVICE(USB_VID_PINNACLE, USB_PID_PINNACLE_PCTV73E) }, |
1560 | + { USB_DEVICE(USB_VID_YUAN, USB_PID_YUAN_EC372S) }, |
1561 | + { USB_DEVICE(USB_VID_TERRATEC, USB_PID_TERRATEC_CINERGY_HT_EXPRESS) }, |
1562 | + { 0 } /* Terminating entry */ |
1563 | }; |
1564 | MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table); |
1565 | |
1566 | @@ -1069,12 +1226,16 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
1567 | }, |
1568 | }, |
1569 | |
1570 | - .num_device_descs = 1, |
1571 | + .num_device_descs = 2, |
1572 | .devices = { |
1573 | { "ASUS My Cinema U3000 Mini DVBT Tuner", |
1574 | { &dib0700_usb_id_table[23], NULL }, |
1575 | { NULL }, |
1576 | }, |
1577 | + { "Yuan EC372S", |
1578 | + { &dib0700_usb_id_table[31], NULL }, |
1579 | + { NULL }, |
1580 | + } |
1581 | } |
1582 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
1583 | |
1584 | @@ -1090,7 +1251,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
1585 | }, |
1586 | }, |
1587 | |
1588 | - .num_device_descs = 6, |
1589 | + .num_device_descs = 8, |
1590 | .devices = { |
1591 | { "DiBcom STK7070P reference design", |
1592 | { &dib0700_usb_id_table[15], NULL }, |
1593 | @@ -1116,6 +1277,14 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
1594 | { &dib0700_usb_id_table[26], NULL }, |
1595 | { NULL }, |
1596 | }, |
1597 | + { "Pinnacle PCTV 72e", |
1598 | + { &dib0700_usb_id_table[29], NULL }, |
1599 | + { NULL }, |
1600 | + }, |
1601 | + { "Pinnacle PCTV 73e", |
1602 | + { &dib0700_usb_id_table[30], NULL }, |
1603 | + { NULL }, |
1604 | + }, |
1605 | }, |
1606 | |
1607 | .rc_interval = DEFAULT_RC_INTERVAL, |
1608 | @@ -1155,6 +1324,40 @@ struct dvb_usb_device_properties dib0700_devices[] = { |
1609 | { NULL }, |
1610 | } |
1611 | } |
1612 | + }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
1613 | + |
1614 | + .num_adapters = 1, |
1615 | + .adapter = { |
1616 | + { |
1617 | + .frontend_attach = stk7700ph_frontend_attach, |
1618 | + .tuner_attach = stk7700ph_tuner_attach, |
1619 | + |
1620 | + DIB0700_DEFAULT_STREAMING_CONFIG(0x02), |
1621 | + |
1622 | + .size_of_priv = sizeof(struct |
1623 | + dib0700_adapter_state), |
1624 | + }, |
1625 | + }, |
1626 | + |
1627 | + .num_device_descs = 3, |
1628 | + .devices = { |
1629 | + { "Terratec Cinergy HT USB XE", |
1630 | + { &dib0700_usb_id_table[27], NULL }, |
1631 | + { NULL }, |
1632 | + }, |
1633 | + { "Pinnacle Expresscard 320cx", |
1634 | + { &dib0700_usb_id_table[28], NULL }, |
1635 | + { NULL }, |
1636 | + }, |
1637 | + { "Terratec Cinergy HT Express", |
1638 | + { &dib0700_usb_id_table[32], NULL }, |
1639 | + { NULL }, |
1640 | + }, |
1641 | + }, |
1642 | + .rc_interval = DEFAULT_RC_INTERVAL, |
1643 | + .rc_key_map = dib0700_rc_keys, |
1644 | + .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), |
1645 | + .rc_query = dib0700_rc_query |
1646 | }, |
1647 | }; |
1648 | |
1649 | diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h |
1650 | index aa4844e..49a44f2 100644 |
1651 | --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h |
1652 | +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h |
1653 | @@ -46,8 +46,8 @@ |
1654 | #define USB_VID_ULTIMA_ELECTRONIC 0x05d8 |
1655 | #define USB_VID_UNIWILL 0x1584 |
1656 | #define USB_VID_WIDEVIEW 0x14aa |
1657 | -/* dom : pour gigabyte u7000 */ |
1658 | #define USB_VID_GIGABYTE 0x1044 |
1659 | +#define USB_VID_YUAN 0x1164 |
1660 | |
1661 | |
1662 | /* Product IDs */ |
1663 | @@ -135,9 +135,14 @@ |
1664 | #define USB_PID_AVERMEDIA_VOLAR 0xa807 |
1665 | #define USB_PID_AVERMEDIA_VOLAR_2 0xb808 |
1666 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a |
1667 | +#define USB_PID_TERRATEC_CINERGY_HT_USB_XE 0x0058 |
1668 | +#define USB_PID_TERRATEC_CINERGY_HT_EXPRESS 0x0060 |
1669 | +#define USB_PID_PINNACLE_EXPRESSCARD_320CX 0x022e |
1670 | #define USB_PID_PINNACLE_PCTV2000E 0x022c |
1671 | #define USB_PID_PINNACLE_PCTV_DVB_T_FLASH 0x0228 |
1672 | #define USB_PID_PINNACLE_PCTV_DUAL_DIVERSITY_DVB_T 0x0229 |
1673 | +#define USB_PID_PINNACLE_PCTV72E 0x0236 |
1674 | +#define USB_PID_PINNACLE_PCTV73E 0x0237 |
1675 | #define USB_PID_PCTV_200E 0x020e |
1676 | #define USB_PID_PCTV_400E 0x020f |
1677 | #define USB_PID_PCTV_450E 0x0222 |
1678 | @@ -183,9 +188,9 @@ |
1679 | #define USB_PID_OPERA1_WARM 0x3829 |
1680 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD 0x0514 |
1681 | #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM 0x0513 |
1682 | -/* dom pour gigabyte u7000 */ |
1683 | #define USB_PID_GIGABYTE_U7000 0x7001 |
1684 | #define USB_PID_ASUS_U3000 0x171f |
1685 | #define USB_PID_ASUS_U3100 0x173f |
1686 | +#define USB_PID_YUAN_EC372S 0x1edc |
1687 | |
1688 | #endif |
1689 | diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c |
1690 | index f651a81..34c2b98 100644 |
1691 | --- a/drivers/net/macvlan.c |
1692 | +++ b/drivers/net/macvlan.c |
1693 | @@ -450,7 +450,7 @@ static void macvlan_dellink(struct net_device *dev) |
1694 | unregister_netdevice(dev); |
1695 | |
1696 | if (list_empty(&port->vlans)) |
1697 | - macvlan_port_destroy(dev); |
1698 | + macvlan_port_destroy(port->dev); |
1699 | } |
1700 | |
1701 | static struct rtnl_link_ops macvlan_link_ops __read_mostly = { |
1702 | diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c |
1703 | index 3acfeea..6572425 100644 |
1704 | --- a/drivers/net/r8169.c |
1705 | +++ b/drivers/net/r8169.c |
1706 | @@ -1617,6 +1617,7 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1707 | SET_NETDEV_DEV(dev, &pdev->dev); |
1708 | tp = netdev_priv(dev); |
1709 | tp->dev = dev; |
1710 | + tp->pci_dev = pdev; |
1711 | tp->msg_enable = netif_msg_init(debug.msg_enable, R8169_MSG_DEFAULT); |
1712 | |
1713 | /* enable device (incl. PCI PM wakeup and hotplug setup) */ |
1714 | @@ -1705,18 +1706,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1715 | |
1716 | rtl8169_print_mac_version(tp); |
1717 | |
1718 | - for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) { |
1719 | + for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) { |
1720 | if (tp->mac_version == rtl_chip_info[i].mac_version) |
1721 | break; |
1722 | } |
1723 | - if (i < 0) { |
1724 | + if (i == ARRAY_SIZE(rtl_chip_info)) { |
1725 | /* Unknown chip: assume array element #0, original RTL-8169 */ |
1726 | if (netif_msg_probe(tp)) { |
1727 | dev_printk(KERN_DEBUG, &pdev->dev, |
1728 | "unknown chip version, assuming %s\n", |
1729 | rtl_chip_info[0].name); |
1730 | } |
1731 | - i++; |
1732 | + i = 0; |
1733 | } |
1734 | tp->chipset = i; |
1735 | |
1736 | @@ -1777,7 +1778,6 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1737 | #endif |
1738 | |
1739 | tp->intr_mask = 0xffff; |
1740 | - tp->pci_dev = pdev; |
1741 | tp->mmio_addr = ioaddr; |
1742 | tp->align = cfg->align; |
1743 | tp->hw_start = cfg->hw_start; |
1744 | diff --git a/drivers/rtc/rtc-lib.c b/drivers/rtc/rtc-lib.c |
1745 | index ba795a4..9f996ec 100644 |
1746 | --- a/drivers/rtc/rtc-lib.c |
1747 | +++ b/drivers/rtc/rtc-lib.c |
1748 | @@ -51,7 +51,7 @@ EXPORT_SYMBOL(rtc_year_days); |
1749 | */ |
1750 | void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) |
1751 | { |
1752 | - register int days, month, year; |
1753 | + unsigned int days, month, year; |
1754 | |
1755 | days = time / 86400; |
1756 | time -= days * 86400; |
1757 | diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c |
1758 | index 6ccdc96..d9bc859 100644 |
1759 | --- a/drivers/scsi/aha152x.c |
1760 | +++ b/drivers/scsi/aha152x.c |
1761 | @@ -3835,7 +3835,7 @@ static int __init aha152x_init(void) |
1762 | iounmap(p); |
1763 | } |
1764 | if (!ok && setup_count == 0) |
1765 | - return 0; |
1766 | + return -ENODEV; |
1767 | |
1768 | printk(KERN_INFO "aha152x: BIOS test: passed, "); |
1769 | #else |
1770 | @@ -3914,14 +3914,14 @@ static int __init aha152x_init(void) |
1771 | #endif |
1772 | } |
1773 | |
1774 | - return 1; |
1775 | + return 0; |
1776 | } |
1777 | |
1778 | static void __exit aha152x_exit(void) |
1779 | { |
1780 | - struct aha152x_hostdata *hd; |
1781 | + struct aha152x_hostdata *hd, *tmp; |
1782 | |
1783 | - list_for_each_entry(hd, &aha152x_host_list, host_list) { |
1784 | + list_for_each_entry_safe(hd, tmp, &aha152x_host_list, host_list) { |
1785 | struct Scsi_Host *shost = container_of((void *)hd, struct Scsi_Host, hostdata); |
1786 | |
1787 | aha152x_release(shost); |
1788 | diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c |
1789 | index bdd7de7..9975095 100644 |
1790 | --- a/drivers/scsi/libiscsi.c |
1791 | +++ b/drivers/scsi/libiscsi.c |
1792 | @@ -635,7 +635,9 @@ static int __iscsi_complete_pdu(struct iscsi_conn *conn, struct iscsi_hdr *hdr, |
1793 | if (iscsi_recv_pdu(conn->cls_conn, hdr, data, |
1794 | datalen)) |
1795 | rc = ISCSI_ERR_CONN_FAILED; |
1796 | - } |
1797 | + } else |
1798 | + mod_timer(&conn->transport_timer, |
1799 | + jiffies + conn->recv_timeout); |
1800 | iscsi_free_mgmt_task(conn, mtask); |
1801 | break; |
1802 | default: |
1803 | @@ -1353,19 +1355,20 @@ static void iscsi_check_transport_timeouts(unsigned long data) |
1804 | { |
1805 | struct iscsi_conn *conn = (struct iscsi_conn *)data; |
1806 | struct iscsi_session *session = conn->session; |
1807 | - unsigned long timeout, next_timeout = 0, last_recv; |
1808 | + unsigned long recv_timeout, next_timeout = 0, last_recv; |
1809 | |
1810 | spin_lock(&session->lock); |
1811 | if (session->state != ISCSI_STATE_LOGGED_IN) |
1812 | goto done; |
1813 | |
1814 | - timeout = conn->recv_timeout; |
1815 | - if (!timeout) |
1816 | + recv_timeout = conn->recv_timeout; |
1817 | + if (!recv_timeout) |
1818 | goto done; |
1819 | |
1820 | - timeout *= HZ; |
1821 | + recv_timeout *= HZ; |
1822 | last_recv = conn->last_recv; |
1823 | - if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ), |
1824 | + if (conn->ping_mtask && |
1825 | + time_before_eq(conn->last_ping + (conn->ping_timeout * HZ), |
1826 | jiffies)) { |
1827 | iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs " |
1828 | "expired, last rx %lu, last ping %lu, " |
1829 | @@ -1376,15 +1379,13 @@ static void iscsi_check_transport_timeouts(unsigned long data) |
1830 | return; |
1831 | } |
1832 | |
1833 | - if (time_before_eq(last_recv + timeout, jiffies)) { |
1834 | - if (time_before_eq(conn->last_ping, last_recv)) { |
1835 | - /* send a ping to try to provoke some traffic */ |
1836 | - debug_scsi("Sending nopout as ping on conn %p\n", conn); |
1837 | - iscsi_send_nopout(conn, NULL); |
1838 | - } |
1839 | - next_timeout = last_recv + timeout + (conn->ping_timeout * HZ); |
1840 | + if (time_before_eq(last_recv + recv_timeout, jiffies)) { |
1841 | + /* send a ping to try to provoke some traffic */ |
1842 | + debug_scsi("Sending nopout as ping on conn %p\n", conn); |
1843 | + iscsi_send_nopout(conn, NULL); |
1844 | + next_timeout = conn->last_ping + (conn->ping_timeout * HZ); |
1845 | } else |
1846 | - next_timeout = last_recv + timeout; |
1847 | + next_timeout = last_recv + recv_timeout; |
1848 | |
1849 | debug_scsi("Setting next tmo %lu\n", next_timeout); |
1850 | mod_timer(&conn->transport_timer, next_timeout); |
1851 | diff --git a/drivers/scsi/qla1280.c b/drivers/scsi/qla1280.c |
1852 | index 68c0d09..624e616 100644 |
1853 | --- a/drivers/scsi/qla1280.c |
1854 | +++ b/drivers/scsi/qla1280.c |
1855 | @@ -2012,7 +2012,7 @@ qla1280_set_defaults(struct scsi_qla_host *ha) |
1856 | nv->bus[bus].config_2.req_ack_active_negation = 1; |
1857 | nv->bus[bus].config_2.data_line_active_negation = 1; |
1858 | nv->bus[bus].selection_timeout = 250; |
1859 | - nv->bus[bus].max_queue_depth = 256; |
1860 | + nv->bus[bus].max_queue_depth = 32; |
1861 | |
1862 | if (IS_ISP1040(ha)) { |
1863 | nv->bus[bus].bus_reset_delay = 3; |
1864 | @@ -2056,7 +2056,7 @@ qla1280_config_target(struct scsi_qla_host *ha, int bus, int target) |
1865 | status = qla1280_mailbox_command(ha, 0x0f, mb); |
1866 | |
1867 | /* Save Tag queuing enable flag. */ |
1868 | - flag = (BIT_0 << target) & mb[0]; |
1869 | + flag = (BIT_0 << target); |
1870 | if (nv->bus[bus].target[target].parameter.tag_queuing) |
1871 | ha->bus_settings[bus].qtag_enables |= flag; |
1872 | |
1873 | diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c |
1874 | index 0f5a179..3bf9294 100644 |
1875 | --- a/drivers/serial/serial_core.c |
1876 | +++ b/drivers/serial/serial_core.c |
1877 | @@ -535,7 +535,7 @@ static int uart_chars_in_buffer(struct tty_struct *tty) |
1878 | static void uart_flush_buffer(struct tty_struct *tty) |
1879 | { |
1880 | struct uart_state *state = tty->driver_data; |
1881 | - struct uart_port *port = state->port; |
1882 | + struct uart_port *port; |
1883 | unsigned long flags; |
1884 | |
1885 | /* |
1886 | @@ -547,6 +547,7 @@ static void uart_flush_buffer(struct tty_struct *tty) |
1887 | return; |
1888 | } |
1889 | |
1890 | + port = state->port; |
1891 | pr_debug("uart_flush_buffer(%d) called\n", tty->index); |
1892 | |
1893 | spin_lock_irqsave(&port->lock, flags); |
1894 | diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c |
1895 | index be0fe15..145c028 100644 |
1896 | --- a/drivers/serial/sunhv.c |
1897 | +++ b/drivers/serial/sunhv.c |
1898 | @@ -392,7 +392,7 @@ static struct uart_ops sunhv_pops = { |
1899 | |
1900 | static struct uart_driver sunhv_reg = { |
1901 | .owner = THIS_MODULE, |
1902 | - .driver_name = "serial", |
1903 | + .driver_name = "sunhv", |
1904 | .dev_name = "ttyS", |
1905 | .major = TTY_MAJOR, |
1906 | }; |
1907 | diff --git a/drivers/serial/sunsab.c b/drivers/serial/sunsab.c |
1908 | index 543f937..9ff5b38 100644 |
1909 | --- a/drivers/serial/sunsab.c |
1910 | +++ b/drivers/serial/sunsab.c |
1911 | @@ -826,7 +826,7 @@ static struct uart_ops sunsab_pops = { |
1912 | |
1913 | static struct uart_driver sunsab_reg = { |
1914 | .owner = THIS_MODULE, |
1915 | - .driver_name = "serial", |
1916 | + .driver_name = "sunsab", |
1917 | .dev_name = "ttyS", |
1918 | .major = TTY_MAJOR, |
1919 | }; |
1920 | diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c |
1921 | index 4e2302d..03806a9 100644 |
1922 | --- a/drivers/serial/sunsu.c |
1923 | +++ b/drivers/serial/sunsu.c |
1924 | @@ -1173,7 +1173,7 @@ out: |
1925 | |
1926 | static struct uart_driver sunsu_reg = { |
1927 | .owner = THIS_MODULE, |
1928 | - .driver_name = "serial", |
1929 | + .driver_name = "sunsu", |
1930 | .dev_name = "ttyS", |
1931 | .major = TTY_MAJOR, |
1932 | }; |
1933 | diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c |
1934 | index cb2e405..87210c0 100644 |
1935 | --- a/drivers/serial/sunzilog.c |
1936 | +++ b/drivers/serial/sunzilog.c |
1937 | @@ -1015,6 +1015,7 @@ static struct uart_ops sunzilog_pops = { |
1938 | .verify_port = sunzilog_verify_port, |
1939 | }; |
1940 | |
1941 | +static int uart_chip_count; |
1942 | static struct uart_sunzilog_port *sunzilog_port_table; |
1943 | static struct zilog_layout __iomem **sunzilog_chip_regs; |
1944 | |
1945 | @@ -1022,7 +1023,7 @@ static struct uart_sunzilog_port *sunzilog_irq_chain; |
1946 | |
1947 | static struct uart_driver sunzilog_reg = { |
1948 | .owner = THIS_MODULE, |
1949 | - .driver_name = "ttyS", |
1950 | + .driver_name = "sunzilog", |
1951 | .dev_name = "ttyS", |
1952 | .major = TTY_MAJOR, |
1953 | }; |
1954 | @@ -1350,16 +1351,22 @@ static int zilog_irq = -1; |
1955 | |
1956 | static int __devinit zs_probe(struct of_device *op, const struct of_device_id *match) |
1957 | { |
1958 | - static int inst; |
1959 | + static int kbm_inst, uart_inst; |
1960 | + int inst; |
1961 | struct uart_sunzilog_port *up; |
1962 | struct zilog_layout __iomem *rp; |
1963 | - int keyboard_mouse; |
1964 | + int keyboard_mouse = 0; |
1965 | int err; |
1966 | |
1967 | - keyboard_mouse = 0; |
1968 | if (of_find_property(op->node, "keyboard", NULL)) |
1969 | keyboard_mouse = 1; |
1970 | |
1971 | + /* uarts must come before keyboards/mice */ |
1972 | + if (keyboard_mouse) |
1973 | + inst = uart_chip_count + kbm_inst; |
1974 | + else |
1975 | + inst = uart_inst; |
1976 | + |
1977 | sunzilog_chip_regs[inst] = of_ioremap(&op->resource[0], 0, |
1978 | sizeof(struct zilog_layout), |
1979 | "zs"); |
1980 | @@ -1427,6 +1434,7 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m |
1981 | rp, sizeof(struct zilog_layout)); |
1982 | return err; |
1983 | } |
1984 | + uart_inst++; |
1985 | } else { |
1986 | printk(KERN_INFO "%s: Keyboard at MMIO 0x%llx (irq = %d) " |
1987 | "is a %s\n", |
1988 | @@ -1438,12 +1446,11 @@ static int __devinit zs_probe(struct of_device *op, const struct of_device_id *m |
1989 | op->dev.bus_id, |
1990 | (unsigned long long) up[1].port.mapbase, |
1991 | op->irqs[0], sunzilog_type(&up[1].port)); |
1992 | + kbm_inst++; |
1993 | } |
1994 | |
1995 | dev_set_drvdata(&op->dev, &up[0]); |
1996 | |
1997 | - inst++; |
1998 | - |
1999 | return 0; |
2000 | } |
2001 | |
2002 | @@ -1491,28 +1498,25 @@ static struct of_platform_driver zs_driver = { |
2003 | static int __init sunzilog_init(void) |
2004 | { |
2005 | struct device_node *dp; |
2006 | - int err, uart_count; |
2007 | - int num_keybms; |
2008 | + int err; |
2009 | + int num_keybms = 0; |
2010 | int num_sunzilog = 0; |
2011 | |
2012 | - num_keybms = 0; |
2013 | for_each_node_by_name(dp, "zs") { |
2014 | num_sunzilog++; |
2015 | if (of_find_property(dp, "keyboard", NULL)) |
2016 | num_keybms++; |
2017 | } |
2018 | |
2019 | - uart_count = 0; |
2020 | if (num_sunzilog) { |
2021 | - int uart_count; |
2022 | - |
2023 | err = sunzilog_alloc_tables(num_sunzilog); |
2024 | if (err) |
2025 | goto out; |
2026 | |
2027 | - uart_count = (num_sunzilog * 2) - (2 * num_keybms); |
2028 | + uart_chip_count = num_sunzilog - num_keybms; |
2029 | |
2030 | - err = sunserial_register_minors(&sunzilog_reg, uart_count); |
2031 | + err = sunserial_register_minors(&sunzilog_reg, |
2032 | + uart_chip_count * 2); |
2033 | if (err) |
2034 | goto out_free_tables; |
2035 | } |
2036 | diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c |
2037 | index d72dc07..e534f9d 100644 |
2038 | --- a/drivers/usb/host/ohci-at91.c |
2039 | +++ b/drivers/usb/host/ohci-at91.c |
2040 | @@ -348,6 +348,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev) |
2041 | if (!clocked) |
2042 | at91_start_clock(); |
2043 | |
2044 | + ohci_finish_controller_resume(hcd); |
2045 | return 0; |
2046 | } |
2047 | #else |
2048 | diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c |
2049 | index 156e93a..963ed60 100644 |
2050 | --- a/drivers/usb/host/ohci-ep93xx.c |
2051 | +++ b/drivers/usb/host/ohci-ep93xx.c |
2052 | @@ -194,8 +194,8 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) |
2053 | |
2054 | ep93xx_start_hc(&pdev->dev); |
2055 | pdev->dev.power.power_state = PMSG_ON; |
2056 | - usb_hcd_resume_root_hub(hcd); |
2057 | |
2058 | + ohci_finish_controller_resume(hcd); |
2059 | return 0; |
2060 | } |
2061 | #endif |
2062 | diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c |
2063 | index 48e4b11..9eff2de 100644 |
2064 | --- a/drivers/usb/host/ohci-hub.c |
2065 | +++ b/drivers/usb/host/ohci-hub.c |
2066 | @@ -326,6 +326,49 @@ static int ohci_bus_resume (struct usb_hcd *hcd) |
2067 | return rc; |
2068 | } |
2069 | |
2070 | +/* Carry out the final steps of resuming the controller device */ |
2071 | +static void ohci_finish_controller_resume(struct usb_hcd *hcd) |
2072 | +{ |
2073 | + struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
2074 | + int port; |
2075 | + bool need_reinit = false; |
2076 | + |
2077 | + /* See if the controller is already running or has been reset */ |
2078 | + ohci->hc_control = ohci_readl(ohci, &ohci->regs->control); |
2079 | + if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) { |
2080 | + need_reinit = true; |
2081 | + } else { |
2082 | + switch (ohci->hc_control & OHCI_CTRL_HCFS) { |
2083 | + case OHCI_USB_OPER: |
2084 | + case OHCI_USB_RESET: |
2085 | + need_reinit = true; |
2086 | + } |
2087 | + } |
2088 | + |
2089 | + /* If needed, reinitialize and suspend the root hub */ |
2090 | + if (need_reinit) { |
2091 | + spin_lock_irq(&ohci->lock); |
2092 | + hcd->state = HC_STATE_RESUMING; |
2093 | + ohci_rh_resume(ohci); |
2094 | + hcd->state = HC_STATE_QUIESCING; |
2095 | + ohci_rh_suspend(ohci, 0); |
2096 | + hcd->state = HC_STATE_SUSPENDED; |
2097 | + spin_unlock_irq(&ohci->lock); |
2098 | + } |
2099 | + |
2100 | + /* Normally just turn on port power and enable interrupts */ |
2101 | + else { |
2102 | + ohci_dbg(ohci, "powerup ports\n"); |
2103 | + for (port = 0; port < ohci->num_ports; port++) |
2104 | + ohci_writel(ohci, RH_PS_PPS, |
2105 | + &ohci->regs->roothub.portstatus[port]); |
2106 | + |
2107 | + ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); |
2108 | + ohci_readl(ohci, &ohci->regs->intrenable); |
2109 | + msleep(20); |
2110 | + } |
2111 | +} |
2112 | + |
2113 | /* Carry out polling-, autostop-, and autoresume-related state changes */ |
2114 | static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, |
2115 | int any_connected) |
2116 | diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c |
2117 | index 7bfca1e..611bc9f 100644 |
2118 | --- a/drivers/usb/host/ohci-omap.c |
2119 | +++ b/drivers/usb/host/ohci-omap.c |
2120 | @@ -519,7 +519,7 @@ static int ohci_omap_resume(struct platform_device *dev) |
2121 | |
2122 | omap_ohci_clock_power(1); |
2123 | dev->dev.power.power_state = PMSG_ON; |
2124 | - usb_hcd_resume_root_hub(platform_get_drvdata(dev)); |
2125 | + ohci_finish_controller_resume(hcd); |
2126 | return 0; |
2127 | } |
2128 | |
2129 | diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c |
2130 | index b0e2275..b4886e1 100644 |
2131 | --- a/drivers/usb/host/ohci-pci.c |
2132 | +++ b/drivers/usb/host/ohci-pci.c |
2133 | @@ -238,42 +238,6 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd) |
2134 | return ret; |
2135 | } |
2136 | |
2137 | -#if defined(CONFIG_USB_PERSIST) && (defined(CONFIG_USB_EHCI_HCD) || \ |
2138 | - defined(CONFIG_USB_EHCI_HCD_MODULE)) |
2139 | - |
2140 | -/* Following a power loss, we must prepare to regain control of the ports |
2141 | - * we used to own. This means turning on the port power before ehci-hcd |
2142 | - * tries to switch ownership. |
2143 | - * |
2144 | - * This isn't a 100% perfect solution. On most systems the OHCI controllers |
2145 | - * lie at lower PCI addresses than the EHCI controller, so they will be |
2146 | - * discovered (and hence resumed) first. But there is no guarantee things |
2147 | - * will always work this way. If the EHCI controller is resumed first and |
2148 | - * the OHCI ports are unpowered, then the handover will fail. |
2149 | - */ |
2150 | -static void prepare_for_handover(struct usb_hcd *hcd) |
2151 | -{ |
2152 | - struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
2153 | - int port; |
2154 | - |
2155 | - /* Here we "know" root ports should always stay powered */ |
2156 | - ohci_dbg(ohci, "powerup ports\n"); |
2157 | - for (port = 0; port < ohci->num_ports; port++) |
2158 | - ohci_writel(ohci, RH_PS_PPS, |
2159 | - &ohci->regs->roothub.portstatus[port]); |
2160 | - |
2161 | - /* Flush those writes */ |
2162 | - ohci_readl(ohci, &ohci->regs->control); |
2163 | - msleep(20); |
2164 | -} |
2165 | - |
2166 | -#else |
2167 | - |
2168 | -static inline void prepare_for_handover(struct usb_hcd *hcd) |
2169 | -{ } |
2170 | - |
2171 | -#endif /* CONFIG_USB_PERSIST etc. */ |
2172 | - |
2173 | #ifdef CONFIG_PM |
2174 | |
2175 | static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) |
2176 | @@ -312,13 +276,8 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) |
2177 | |
2178 | static int ohci_pci_resume (struct usb_hcd *hcd) |
2179 | { |
2180 | - struct ohci_hcd *ohci = hcd_to_ohci(hcd); |
2181 | - |
2182 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); |
2183 | - |
2184 | - /* FIXME: we should try to detect loss of VBUS power here */ |
2185 | - prepare_for_handover(hcd); |
2186 | - ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); |
2187 | + ohci_finish_controller_resume(hcd); |
2188 | return 0; |
2189 | } |
2190 | |
2191 | diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c |
2192 | index 8ad9b3b..3de3b00 100644 |
2193 | --- a/drivers/usb/host/ohci-pxa27x.c |
2194 | +++ b/drivers/usb/host/ohci-pxa27x.c |
2195 | @@ -358,8 +358,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct platform_device *pdev) |
2196 | return status; |
2197 | |
2198 | pdev->dev.power.power_state = PMSG_ON; |
2199 | - usb_hcd_resume_root_hub(hcd); |
2200 | - |
2201 | + ohci_finish_controller_resume(hcd); |
2202 | return 0; |
2203 | } |
2204 | #endif |
2205 | diff --git a/drivers/usb/host/ohci-sm501.c b/drivers/usb/host/ohci-sm501.c |
2206 | index 4ea9276..c852f03 100644 |
2207 | --- a/drivers/usb/host/ohci-sm501.c |
2208 | +++ b/drivers/usb/host/ohci-sm501.c |
2209 | @@ -239,7 +239,7 @@ static int ohci_sm501_resume(struct platform_device *pdev) |
2210 | |
2211 | sm501_unit_power(dev->parent, SM501_GATE_USB_HOST, 1); |
2212 | dev->power.power_state = PMSG_ON; |
2213 | - usb_hcd_resume_root_hub(platform_get_drvdata(pdev)); |
2214 | + ohci_finish_controller_resume(hcd); |
2215 | return 0; |
2216 | } |
2217 | #endif |
2218 | diff --git a/drivers/usb/host/ohci-ssb.c b/drivers/usb/host/ohci-ssb.c |
2219 | index 6e9c2d6..1c0867a 100644 |
2220 | --- a/drivers/usb/host/ohci-ssb.c |
2221 | +++ b/drivers/usb/host/ohci-ssb.c |
2222 | @@ -224,6 +224,7 @@ static int ssb_ohci_resume(struct ssb_device *dev) |
2223 | |
2224 | ssb_device_enable(dev, ohcidev->enable_flags); |
2225 | |
2226 | + ohci_finish_controller_resume(hcd); |
2227 | return 0; |
2228 | } |
2229 | |
2230 | diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c |
2231 | index f156dba..a3482fc 100644 |
2232 | --- a/drivers/usb/serial/airprime.c |
2233 | +++ b/drivers/usb/serial/airprime.c |
2234 | @@ -220,7 +220,7 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp) |
2235 | mutex_lock(&port->serial->disc_mutex); |
2236 | if (!port->serial->disconnected) |
2237 | airprime_send_setup(port); |
2238 | - mutex_lock(&port->serial->disc_mutex); |
2239 | + mutex_unlock(&port->serial->disc_mutex); |
2240 | |
2241 | for (i = 0; i < NUM_READ_URBS; ++i) { |
2242 | usb_kill_urb (priv->read_urbp[i]); |
2243 | diff --git a/include/asm-sparc/mman.h b/include/asm-sparc/mman.h |
2244 | index b7dc40b..632cd8a 100644 |
2245 | --- a/include/asm-sparc/mman.h |
2246 | +++ b/include/asm-sparc/mman.h |
2247 | @@ -37,9 +37,8 @@ |
2248 | |
2249 | #ifdef __KERNEL__ |
2250 | #ifndef __ASSEMBLY__ |
2251 | -#define arch_mmap_check sparc_mmap_check |
2252 | -int sparc_mmap_check(unsigned long addr, unsigned long len, |
2253 | - unsigned long flags); |
2254 | +#define arch_mmap_check(addr,len,flags) sparc_mmap_check(addr,len) |
2255 | +int sparc_mmap_check(unsigned long addr, unsigned long len); |
2256 | #endif |
2257 | #endif |
2258 | |
2259 | diff --git a/include/asm-sparc/psr.h b/include/asm-sparc/psr.h |
2260 | index 19c9780..2139704 100644 |
2261 | --- a/include/asm-sparc/psr.h |
2262 | +++ b/include/asm-sparc/psr.h |
2263 | @@ -25,6 +25,7 @@ |
2264 | #define PSR_PIL 0x00000f00 /* processor interrupt level */ |
2265 | #define PSR_EF 0x00001000 /* enable floating point */ |
2266 | #define PSR_EC 0x00002000 /* enable co-processor */ |
2267 | +#define PSR_SYSCALL 0x00004000 /* inside of a syscall */ |
2268 | #define PSR_LE 0x00008000 /* SuperSparcII little-endian */ |
2269 | #define PSR_ICC 0x00f00000 /* integer condition codes */ |
2270 | #define PSR_C 0x00100000 /* carry bit */ |
2271 | diff --git a/include/asm-sparc/ptrace.h b/include/asm-sparc/ptrace.h |
2272 | index 8201a7b..0afb867 100644 |
2273 | --- a/include/asm-sparc/ptrace.h |
2274 | +++ b/include/asm-sparc/ptrace.h |
2275 | @@ -10,6 +10,8 @@ |
2276 | |
2277 | #ifndef __ASSEMBLY__ |
2278 | |
2279 | +#include <linux/types.h> |
2280 | + |
2281 | struct pt_regs { |
2282 | unsigned long psr; |
2283 | unsigned long pc; |
2284 | @@ -39,6 +41,16 @@ struct pt_regs { |
2285 | #define UREG_FP UREG_I6 |
2286 | #define UREG_RETPC UREG_I7 |
2287 | |
2288 | +static inline bool pt_regs_is_syscall(struct pt_regs *regs) |
2289 | +{ |
2290 | + return (regs->psr & PSR_SYSCALL); |
2291 | +} |
2292 | + |
2293 | +static inline bool pt_regs_clear_syscall(struct pt_regs *regs) |
2294 | +{ |
2295 | + return (regs->psr &= ~PSR_SYSCALL); |
2296 | +} |
2297 | + |
2298 | /* A register window */ |
2299 | struct reg_window { |
2300 | unsigned long locals[8]; |
2301 | @@ -149,6 +161,7 @@ extern void show_regs(struct pt_regs *); |
2302 | #define SF_XXARG 0x5c |
2303 | |
2304 | /* Stuff for the ptrace system call */ |
2305 | +#define PTRACE_SPARC_DETACH 11 |
2306 | #define PTRACE_GETREGS 12 |
2307 | #define PTRACE_SETREGS 13 |
2308 | #define PTRACE_GETFPREGS 14 |
2309 | diff --git a/include/asm-sparc/signal.h b/include/asm-sparc/signal.h |
2310 | index d03a21c..94071c7 100644 |
2311 | --- a/include/asm-sparc/signal.h |
2312 | +++ b/include/asm-sparc/signal.h |
2313 | @@ -199,13 +199,7 @@ typedef struct sigaltstack { |
2314 | size_t ss_size; |
2315 | } stack_t; |
2316 | |
2317 | -struct sparc_deliver_cookie { |
2318 | - int restart_syscall; |
2319 | - unsigned long orig_i0; |
2320 | -}; |
2321 | - |
2322 | -struct pt_regs; |
2323 | -extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); |
2324 | +#define ptrace_signal_deliver(regs, cookie) do { } while (0) |
2325 | |
2326 | #endif /* !(__KERNEL__) */ |
2327 | |
2328 | diff --git a/include/asm-sparc64/mman.h b/include/asm-sparc64/mman.h |
2329 | index 8cc1860..e0fcfca 100644 |
2330 | --- a/include/asm-sparc64/mman.h |
2331 | +++ b/include/asm-sparc64/mman.h |
2332 | @@ -37,9 +37,8 @@ |
2333 | |
2334 | #ifdef __KERNEL__ |
2335 | #ifndef __ASSEMBLY__ |
2336 | -#define arch_mmap_check sparc64_mmap_check |
2337 | -int sparc64_mmap_check(unsigned long addr, unsigned long len, |
2338 | - unsigned long flags); |
2339 | +#define arch_mmap_check(addr,len,flags) sparc64_mmap_check(addr,len) |
2340 | +int sparc64_mmap_check(unsigned long addr, unsigned long len); |
2341 | #endif |
2342 | #endif |
2343 | |
2344 | diff --git a/include/asm-sparc64/psrcompat.h b/include/asm-sparc64/psrcompat.h |
2345 | index 5590ce6..3614ca0 100644 |
2346 | --- a/include/asm-sparc64/psrcompat.h |
2347 | +++ b/include/asm-sparc64/psrcompat.h |
2348 | @@ -12,6 +12,7 @@ |
2349 | #define PSR_PIL 0x00000f00 /* processor interrupt level */ |
2350 | #define PSR_EF 0x00001000 /* enable floating point */ |
2351 | #define PSR_EC 0x00002000 /* enable co-processor */ |
2352 | +#define PSR_SYSCALL 0x00004000 /* inside of a syscall */ |
2353 | #define PSR_LE 0x00008000 /* SuperSparcII little-endian */ |
2354 | #define PSR_ICC 0x00f00000 /* integer condition codes */ |
2355 | #define PSR_C 0x00100000 /* carry bit */ |
2356 | @@ -30,6 +31,7 @@ static inline unsigned int tstate_to_psr(unsigned long tstate) |
2357 | PSR_S | |
2358 | ((tstate & TSTATE_ICC) >> 12) | |
2359 | ((tstate & TSTATE_XCC) >> 20) | |
2360 | + ((tstate & TSTATE_SYSCALL) ? PSR_SYSCALL : 0) | |
2361 | PSR_V8PLUS); |
2362 | } |
2363 | |
2364 | diff --git a/include/asm-sparc64/pstate.h b/include/asm-sparc64/pstate.h |
2365 | index f3c4548..949aeba 100644 |
2366 | --- a/include/asm-sparc64/pstate.h |
2367 | +++ b/include/asm-sparc64/pstate.h |
2368 | @@ -62,6 +62,7 @@ |
2369 | #define TSTATE_PRIV _AC(0x0000000000000400,UL) /* Privilege. */ |
2370 | #define TSTATE_IE _AC(0x0000000000000200,UL) /* Interrupt Enable. */ |
2371 | #define TSTATE_AG _AC(0x0000000000000100,UL) /* Alternate Globals.*/ |
2372 | +#define TSTATE_SYSCALL _AC(0x0000000000000020,UL) /* in syscall trap */ |
2373 | #define TSTATE_CWP _AC(0x000000000000001f,UL) /* Curr Win-Pointer. */ |
2374 | |
2375 | /* Floating-Point Registers State Register. |
2376 | diff --git a/include/asm-sparc64/ptrace.h b/include/asm-sparc64/ptrace.h |
2377 | index 6da1978..0093f60 100644 |
2378 | --- a/include/asm-sparc64/ptrace.h |
2379 | +++ b/include/asm-sparc64/ptrace.h |
2380 | @@ -10,6 +10,8 @@ |
2381 | |
2382 | #ifndef __ASSEMBLY__ |
2383 | |
2384 | +#include <linux/types.h> |
2385 | + |
2386 | struct pt_regs { |
2387 | unsigned long u_regs[16]; /* globals and ins */ |
2388 | unsigned long tstate; |
2389 | @@ -27,6 +29,16 @@ struct pt_regs32 { |
2390 | unsigned int u_regs[16]; /* globals and ins */ |
2391 | }; |
2392 | |
2393 | +static inline bool pt_regs_is_syscall(struct pt_regs *regs) |
2394 | +{ |
2395 | + return (regs->tstate & TSTATE_SYSCALL); |
2396 | +} |
2397 | + |
2398 | +static inline bool pt_regs_clear_syscall(struct pt_regs *regs) |
2399 | +{ |
2400 | + return (regs->tstate &= ~TSTATE_SYSCALL); |
2401 | +} |
2402 | + |
2403 | #define UREG_G0 0 |
2404 | #define UREG_G1 1 |
2405 | #define UREG_G2 2 |
2406 | @@ -263,6 +275,7 @@ extern void __show_regs(struct pt_regs *); |
2407 | #define SF_XXARG 0x5c |
2408 | |
2409 | /* Stuff for the ptrace system call */ |
2410 | +#define PTRACE_SPARC_DETACH 11 |
2411 | #define PTRACE_GETREGS 12 |
2412 | #define PTRACE_SETREGS 13 |
2413 | #define PTRACE_GETFPREGS 14 |
2414 | diff --git a/include/asm-sparc64/signal.h b/include/asm-sparc64/signal.h |
2415 | index fa6f467..c49f32d 100644 |
2416 | --- a/include/asm-sparc64/signal.h |
2417 | +++ b/include/asm-sparc64/signal.h |
2418 | @@ -186,13 +186,7 @@ struct k_sigaction { |
2419 | void __user *ka_restorer; |
2420 | }; |
2421 | |
2422 | -struct signal_deliver_cookie { |
2423 | - int restart_syscall; |
2424 | - unsigned long orig_i0; |
2425 | -}; |
2426 | - |
2427 | -struct pt_regs; |
2428 | -extern void ptrace_signal_deliver(struct pt_regs *regs, void *cookie); |
2429 | +#define ptrace_signal_deliver(regs, cookie) do { } while (0) |
2430 | |
2431 | #endif /* !(__KERNEL__) */ |
2432 | |
2433 | diff --git a/include/asm-sparc64/ttable.h b/include/asm-sparc64/ttable.h |
2434 | index bbb9c8f..6ef3d3b 100644 |
2435 | --- a/include/asm-sparc64/ttable.h |
2436 | +++ b/include/asm-sparc64/ttable.h |
2437 | @@ -91,13 +91,14 @@ |
2438 | clr %l6; |
2439 | |
2440 | #define SYSCALL_TRAP(routine, systbl) \ |
2441 | + rdpr %pil, %g2; \ |
2442 | + mov TSTATE_SYSCALL, %g3; \ |
2443 | sethi %hi(109f), %g7; \ |
2444 | - ba,pt %xcc, etrap; \ |
2445 | + ba,pt %xcc, etrap_syscall; \ |
2446 | 109: or %g7, %lo(109b), %g7; \ |
2447 | sethi %hi(systbl), %l7; \ |
2448 | ba,pt %xcc, routine; \ |
2449 | - or %l7, %lo(systbl), %l7; \ |
2450 | - nop; nop; |
2451 | + or %l7, %lo(systbl), %l7; |
2452 | |
2453 | #define INDIRECT_SOLARIS_SYSCALL(num) \ |
2454 | sethi %hi(109f), %g7; \ |
2455 | diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h |
2456 | index 8af05a9..db684e1 100644 |
2457 | --- a/include/asm-x86/topology.h |
2458 | +++ b/include/asm-x86/topology.h |
2459 | @@ -25,6 +25,16 @@ |
2460 | #ifndef _ASM_X86_TOPOLOGY_H |
2461 | #define _ASM_X86_TOPOLOGY_H |
2462 | |
2463 | +#ifdef CONFIG_X86_32 |
2464 | +# ifdef CONFIG_X86_HT |
2465 | +# define ENABLE_TOPO_DEFINES |
2466 | +# endif |
2467 | +#else |
2468 | +# ifdef CONFIG_SMP |
2469 | +# define ENABLE_TOPO_DEFINES |
2470 | +# endif |
2471 | +#endif |
2472 | + |
2473 | #ifdef CONFIG_NUMA |
2474 | #include <linux/cpumask.h> |
2475 | #include <asm/mpspec.h> |
2476 | @@ -112,10 +122,6 @@ extern unsigned long node_end_pfn[]; |
2477 | extern unsigned long node_remap_size[]; |
2478 | #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid]) |
2479 | |
2480 | -# ifdef CONFIG_X86_HT |
2481 | -# define ENABLE_TOPO_DEFINES |
2482 | -# endif |
2483 | - |
2484 | # define SD_CACHE_NICE_TRIES 1 |
2485 | # define SD_IDLE_IDX 1 |
2486 | # define SD_NEWIDLE_IDX 2 |
2487 | @@ -123,10 +129,6 @@ extern unsigned long node_remap_size[]; |
2488 | |
2489 | #else |
2490 | |
2491 | -# ifdef CONFIG_SMP |
2492 | -# define ENABLE_TOPO_DEFINES |
2493 | -# endif |
2494 | - |
2495 | # define SD_CACHE_NICE_TRIES 2 |
2496 | # define SD_IDLE_IDX 2 |
2497 | # define SD_NEWIDLE_IDX 0 |
2498 | diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h |
2499 | index 56f3c94..9a51eba 100644 |
2500 | --- a/include/net/ip_vs.h |
2501 | +++ b/include/net/ip_vs.h |
2502 | @@ -405,7 +405,8 @@ struct sk_buff; |
2503 | struct ip_vs_protocol { |
2504 | struct ip_vs_protocol *next; |
2505 | char *name; |
2506 | - __u16 protocol; |
2507 | + u16 protocol; |
2508 | + u16 num_states; |
2509 | int dont_defrag; |
2510 | atomic_t appcnt; /* counter of proto app incs */ |
2511 | int *timeout_table; /* protocol timeout table */ |
2512 | diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h |
2513 | index e69ab2e..d9a4f7f 100644 |
2514 | --- a/include/net/netfilter/nf_conntrack_tuple.h |
2515 | +++ b/include/net/netfilter/nf_conntrack_tuple.h |
2516 | @@ -101,16 +101,6 @@ struct nf_conntrack_tuple_mask |
2517 | } src; |
2518 | }; |
2519 | |
2520 | -/* This is optimized opposed to a memset of the whole structure. Everything we |
2521 | - * really care about is the source/destination unions */ |
2522 | -#define NF_CT_TUPLE_U_BLANK(tuple) \ |
2523 | - do { \ |
2524 | - (tuple)->src.u.all = 0; \ |
2525 | - (tuple)->dst.u.all = 0; \ |
2526 | - memset(&(tuple)->src.u3, 0, sizeof((tuple)->src.u3)); \ |
2527 | - memset(&(tuple)->dst.u3, 0, sizeof((tuple)->dst.u3)); \ |
2528 | - } while (0) |
2529 | - |
2530 | #ifdef __KERNEL__ |
2531 | |
2532 | #define NF_CT_DUMP_TUPLE(tp) \ |
2533 | diff --git a/net/can/af_can.c b/net/can/af_can.c |
2534 | index 36b9f22..6b956f5 100644 |
2535 | --- a/net/can/af_can.c |
2536 | +++ b/net/can/af_can.c |
2537 | @@ -208,6 +208,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol) |
2538 | */ |
2539 | int can_send(struct sk_buff *skb, int loop) |
2540 | { |
2541 | + struct sk_buff *newskb = NULL; |
2542 | int err; |
2543 | |
2544 | if (skb->dev->type != ARPHRD_CAN) { |
2545 | @@ -244,8 +245,7 @@ int can_send(struct sk_buff *skb, int loop) |
2546 | * If the interface is not capable to do loopback |
2547 | * itself, we do it here. |
2548 | */ |
2549 | - struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); |
2550 | - |
2551 | + newskb = skb_clone(skb, GFP_ATOMIC); |
2552 | if (!newskb) { |
2553 | kfree_skb(skb); |
2554 | return -ENOMEM; |
2555 | @@ -254,7 +254,6 @@ int can_send(struct sk_buff *skb, int loop) |
2556 | newskb->sk = skb->sk; |
2557 | newskb->ip_summed = CHECKSUM_UNNECESSARY; |
2558 | newskb->pkt_type = PACKET_BROADCAST; |
2559 | - netif_rx(newskb); |
2560 | } |
2561 | } else { |
2562 | /* indication for the CAN driver: no loopback required */ |
2563 | @@ -266,11 +265,20 @@ int can_send(struct sk_buff *skb, int loop) |
2564 | if (err > 0) |
2565 | err = net_xmit_errno(err); |
2566 | |
2567 | + if (err) { |
2568 | + if (newskb) |
2569 | + kfree_skb(newskb); |
2570 | + return err; |
2571 | + } |
2572 | + |
2573 | + if (newskb) |
2574 | + netif_rx(newskb); |
2575 | + |
2576 | /* update statistics */ |
2577 | can_stats.tx_frames++; |
2578 | can_stats.tx_frames_delta++; |
2579 | |
2580 | - return err; |
2581 | + return 0; |
2582 | } |
2583 | EXPORT_SYMBOL(can_send); |
2584 | |
2585 | diff --git a/net/dccp/feat.c b/net/dccp/feat.c |
2586 | index 4a4f6ce..933a0ec 100644 |
2587 | --- a/net/dccp/feat.c |
2588 | +++ b/net/dccp/feat.c |
2589 | @@ -32,7 +32,7 @@ int dccp_feat_change(struct dccp_minisock *dmsk, u8 type, u8 feature, |
2590 | |
2591 | if (len > 3) { |
2592 | DCCP_WARN("invalid length %d\n", len); |
2593 | - return 1; |
2594 | + return -EINVAL; |
2595 | } |
2596 | /* XXX add further sanity checks */ |
2597 | |
2598 | diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c |
2599 | index dde28a2..4b1c16c 100644 |
2600 | --- a/net/ipv4/ipvs/ip_vs_proto.c |
2601 | +++ b/net/ipv4/ipvs/ip_vs_proto.c |
2602 | @@ -148,7 +148,7 @@ const char * ip_vs_state_name(__u16 proto, int state) |
2603 | struct ip_vs_protocol *pp = ip_vs_proto_get(proto); |
2604 | |
2605 | if (pp == NULL || pp->state_name == NULL) |
2606 | - return "ERR!"; |
2607 | + return (IPPROTO_IP == proto) ? "NONE" : "ERR!"; |
2608 | return pp->state_name(state); |
2609 | } |
2610 | |
2611 | diff --git a/net/ipv4/ipvs/ip_vs_proto_ah.c b/net/ipv4/ipvs/ip_vs_proto_ah.c |
2612 | index a842676..4bf835e 100644 |
2613 | --- a/net/ipv4/ipvs/ip_vs_proto_ah.c |
2614 | +++ b/net/ipv4/ipvs/ip_vs_proto_ah.c |
2615 | @@ -160,6 +160,7 @@ static void ah_exit(struct ip_vs_protocol *pp) |
2616 | struct ip_vs_protocol ip_vs_protocol_ah = { |
2617 | .name = "AH", |
2618 | .protocol = IPPROTO_AH, |
2619 | + .num_states = 1, |
2620 | .dont_defrag = 1, |
2621 | .init = ah_init, |
2622 | .exit = ah_exit, |
2623 | diff --git a/net/ipv4/ipvs/ip_vs_proto_esp.c b/net/ipv4/ipvs/ip_vs_proto_esp.c |
2624 | index aef0d3e..db6a6b7 100644 |
2625 | --- a/net/ipv4/ipvs/ip_vs_proto_esp.c |
2626 | +++ b/net/ipv4/ipvs/ip_vs_proto_esp.c |
2627 | @@ -159,6 +159,7 @@ static void esp_exit(struct ip_vs_protocol *pp) |
2628 | struct ip_vs_protocol ip_vs_protocol_esp = { |
2629 | .name = "ESP", |
2630 | .protocol = IPPROTO_ESP, |
2631 | + .num_states = 1, |
2632 | .dont_defrag = 1, |
2633 | .init = esp_init, |
2634 | .exit = esp_exit, |
2635 | diff --git a/net/ipv4/ipvs/ip_vs_proto_tcp.c b/net/ipv4/ipvs/ip_vs_proto_tcp.c |
2636 | index 12dc0d6..480f876 100644 |
2637 | --- a/net/ipv4/ipvs/ip_vs_proto_tcp.c |
2638 | +++ b/net/ipv4/ipvs/ip_vs_proto_tcp.c |
2639 | @@ -594,6 +594,7 @@ static void ip_vs_tcp_exit(struct ip_vs_protocol *pp) |
2640 | struct ip_vs_protocol ip_vs_protocol_tcp = { |
2641 | .name = "TCP", |
2642 | .protocol = IPPROTO_TCP, |
2643 | + .num_states = IP_VS_TCP_S_LAST, |
2644 | .dont_defrag = 0, |
2645 | .appcnt = ATOMIC_INIT(0), |
2646 | .init = ip_vs_tcp_init, |
2647 | diff --git a/net/ipv4/ipvs/ip_vs_proto_udp.c b/net/ipv4/ipvs/ip_vs_proto_udp.c |
2648 | index 1fa7b33..8e3b059 100644 |
2649 | --- a/net/ipv4/ipvs/ip_vs_proto_udp.c |
2650 | +++ b/net/ipv4/ipvs/ip_vs_proto_udp.c |
2651 | @@ -409,6 +409,7 @@ static void udp_exit(struct ip_vs_protocol *pp) |
2652 | struct ip_vs_protocol ip_vs_protocol_udp = { |
2653 | .name = "UDP", |
2654 | .protocol = IPPROTO_UDP, |
2655 | + .num_states = IP_VS_UDP_S_LAST, |
2656 | .dont_defrag = 0, |
2657 | .init = udp_init, |
2658 | .exit = udp_exit, |
2659 | diff --git a/net/ipv4/ipvs/ip_vs_sync.c b/net/ipv4/ipvs/ip_vs_sync.c |
2660 | index 948378d..a392d6e 100644 |
2661 | --- a/net/ipv4/ipvs/ip_vs_sync.c |
2662 | +++ b/net/ipv4/ipvs/ip_vs_sync.c |
2663 | @@ -288,11 +288,16 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) |
2664 | char *p; |
2665 | int i; |
2666 | |
2667 | + if (buflen < sizeof(struct ip_vs_sync_mesg)) { |
2668 | + IP_VS_ERR_RL("sync message header too short\n"); |
2669 | + return; |
2670 | + } |
2671 | + |
2672 | /* Convert size back to host byte order */ |
2673 | m->size = ntohs(m->size); |
2674 | |
2675 | if (buflen != m->size) { |
2676 | - IP_VS_ERR("bogus message\n"); |
2677 | + IP_VS_ERR_RL("bogus sync message size\n"); |
2678 | return; |
2679 | } |
2680 | |
2681 | @@ -307,9 +312,48 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) |
2682 | for (i=0; i<m->nr_conns; i++) { |
2683 | unsigned flags, state; |
2684 | |
2685 | - s = (struct ip_vs_sync_conn *)p; |
2686 | + if (p + SIMPLE_CONN_SIZE > buffer+buflen) { |
2687 | + IP_VS_ERR_RL("bogus conn in sync message\n"); |
2688 | + return; |
2689 | + } |
2690 | + s = (struct ip_vs_sync_conn *) p; |
2691 | flags = ntohs(s->flags) | IP_VS_CONN_F_SYNC; |
2692 | + flags &= ~IP_VS_CONN_F_HASHED; |
2693 | + if (flags & IP_VS_CONN_F_SEQ_MASK) { |
2694 | + opt = (struct ip_vs_sync_conn_options *)&s[1]; |
2695 | + p += FULL_CONN_SIZE; |
2696 | + if (p > buffer+buflen) { |
2697 | + IP_VS_ERR_RL("bogus conn options in sync message\n"); |
2698 | + return; |
2699 | + } |
2700 | + } else { |
2701 | + opt = NULL; |
2702 | + p += SIMPLE_CONN_SIZE; |
2703 | + } |
2704 | + |
2705 | state = ntohs(s->state); |
2706 | + if (!(flags & IP_VS_CONN_F_TEMPLATE)) { |
2707 | + pp = ip_vs_proto_get(s->protocol); |
2708 | + if (!pp) { |
2709 | + IP_VS_ERR_RL("Unsupported protocol %u in sync msg\n", |
2710 | + s->protocol); |
2711 | + continue; |
2712 | + } |
2713 | + if (state >= pp->num_states) { |
2714 | + IP_VS_DBG(2, "Invalid %s state %u in sync msg\n", |
2715 | + pp->name, state); |
2716 | + continue; |
2717 | + } |
2718 | + } else { |
2719 | + /* protocol in templates is not used for state/timeout */ |
2720 | + pp = NULL; |
2721 | + if (state > 0) { |
2722 | + IP_VS_DBG(2, "Invalid template state %u in sync msg\n", |
2723 | + state); |
2724 | + state = 0; |
2725 | + } |
2726 | + } |
2727 | + |
2728 | if (!(flags & IP_VS_CONN_F_TEMPLATE)) |
2729 | cp = ip_vs_conn_in_get(s->protocol, |
2730 | s->caddr, s->cport, |
2731 | @@ -345,14 +389,9 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) |
2732 | IP_VS_ERR("ip_vs_conn_new failed\n"); |
2733 | return; |
2734 | } |
2735 | - cp->state = state; |
2736 | } else if (!cp->dest) { |
2737 | dest = ip_vs_try_bind_dest(cp); |
2738 | - if (!dest) { |
2739 | - /* it is an unbound entry created by |
2740 | - * synchronization */ |
2741 | - cp->flags = flags | IP_VS_CONN_F_HASHED; |
2742 | - } else |
2743 | + if (dest) |
2744 | atomic_dec(&dest->refcnt); |
2745 | } else if ((cp->dest) && (cp->protocol == IPPROTO_TCP) && |
2746 | (cp->state != state)) { |
2747 | @@ -371,23 +410,22 @@ static void ip_vs_process_message(const char *buffer, const size_t buflen) |
2748 | } |
2749 | } |
2750 | |
2751 | - if (flags & IP_VS_CONN_F_SEQ_MASK) { |
2752 | - opt = (struct ip_vs_sync_conn_options *)&s[1]; |
2753 | + if (opt) |
2754 | memcpy(&cp->in_seq, opt, sizeof(*opt)); |
2755 | - p += FULL_CONN_SIZE; |
2756 | - } else |
2757 | - p += SIMPLE_CONN_SIZE; |
2758 | - |
2759 | atomic_set(&cp->in_pkts, sysctl_ip_vs_sync_threshold[0]); |
2760 | cp->state = state; |
2761 | - pp = ip_vs_proto_get(s->protocol); |
2762 | - cp->timeout = pp->timeout_table[cp->state]; |
2763 | + cp->old_state = cp->state; |
2764 | + /* |
2765 | + * We can not recover the right timeout for templates |
2766 | + * in all cases, we can not find the right fwmark |
2767 | + * virtual service. If needed, we can do it for |
2768 | + * non-fwmark persistent services. |
2769 | + */ |
2770 | + if (!(flags & IP_VS_CONN_F_TEMPLATE) && pp->timeout_table) |
2771 | + cp->timeout = pp->timeout_table[state]; |
2772 | + else |
2773 | + cp->timeout = (3*60*HZ); |
2774 | ip_vs_conn_put(cp); |
2775 | - |
2776 | - if (p > buffer+buflen) { |
2777 | - IP_VS_ERR("bogus message\n"); |
2778 | - return; |
2779 | - } |
2780 | } |
2781 | } |
2782 | |
2783 | diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c |
2784 | index 4dc1628..e46d8fa 100644 |
2785 | --- a/net/ipv4/netfilter/ip_queue.c |
2786 | +++ b/net/ipv4/netfilter/ip_queue.c |
2787 | @@ -296,9 +296,8 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, struct nf_queue_entry *e) |
2788 | if (v->data_len > 0xFFFF) |
2789 | return -EINVAL; |
2790 | if (diff > skb_tailroom(e->skb)) { |
2791 | - nskb = skb_copy_expand(e->skb, 0, |
2792 | - diff - skb_tailroom(e->skb), |
2793 | - GFP_ATOMIC); |
2794 | + nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
2795 | + diff, GFP_ATOMIC); |
2796 | if (!nskb) { |
2797 | printk(KERN_WARNING "ip_queue: error " |
2798 | "in mangle, dropping packet\n"); |
2799 | diff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2800 | index a65b845..50ad6ef 100644 |
2801 | --- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2802 | +++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |
2803 | @@ -305,7 +305,7 @@ getorigdst(struct sock *sk, int optval, void __user *user, int *len) |
2804 | const struct nf_conntrack_tuple_hash *h; |
2805 | struct nf_conntrack_tuple tuple; |
2806 | |
2807 | - NF_CT_TUPLE_U_BLANK(&tuple); |
2808 | + memset(&tuple, 0, sizeof(tuple)); |
2809 | tuple.src.u3.ip = inet->rcv_saddr; |
2810 | tuple.src.u.tcp.port = inet->sport; |
2811 | tuple.dst.u3.ip = inet->daddr; |
2812 | diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c |
2813 | index 8d366f7..12b4dc5 100644 |
2814 | --- a/net/ipv6/netfilter/ip6_queue.c |
2815 | +++ b/net/ipv6/netfilter/ip6_queue.c |
2816 | @@ -298,9 +298,8 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, struct nf_queue_entry *e) |
2817 | if (v->data_len > 0xFFFF) |
2818 | return -EINVAL; |
2819 | if (diff > skb_tailroom(e->skb)) { |
2820 | - nskb = skb_copy_expand(e->skb, 0, |
2821 | - diff - skb_tailroom(e->skb), |
2822 | - GFP_ATOMIC); |
2823 | + nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
2824 | + diff, GFP_ATOMIC); |
2825 | if (!nskb) { |
2826 | printk(KERN_WARNING "ip6_queue: OOM " |
2827 | "in mangle, dropping packet\n"); |
2828 | diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c |
2829 | index b77eb56..4147de6 100644 |
2830 | --- a/net/netfilter/nf_conntrack_core.c |
2831 | +++ b/net/netfilter/nf_conntrack_core.c |
2832 | @@ -104,7 +104,7 @@ nf_ct_get_tuple(const struct sk_buff *skb, |
2833 | const struct nf_conntrack_l3proto *l3proto, |
2834 | const struct nf_conntrack_l4proto *l4proto) |
2835 | { |
2836 | - NF_CT_TUPLE_U_BLANK(tuple); |
2837 | + memset(tuple, 0, sizeof(*tuple)); |
2838 | |
2839 | tuple->src.l3num = l3num; |
2840 | if (l3proto->pkt_to_tuple(skb, nhoff, tuple) == 0) |
2841 | @@ -153,7 +153,7 @@ nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, |
2842 | const struct nf_conntrack_l3proto *l3proto, |
2843 | const struct nf_conntrack_l4proto *l4proto) |
2844 | { |
2845 | - NF_CT_TUPLE_U_BLANK(inverse); |
2846 | + memset(inverse, 0, sizeof(*inverse)); |
2847 | |
2848 | inverse->src.l3num = orig->src.l3num; |
2849 | if (l3proto->invert_tuple(inverse, orig) == 0) |
2850 | diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c |
2851 | index 10522c0..bcaf967 100644 |
2852 | --- a/net/netfilter/nfnetlink_queue.c |
2853 | +++ b/net/netfilter/nfnetlink_queue.c |
2854 | @@ -454,9 +454,8 @@ nfqnl_mangle(void *data, int data_len, struct nf_queue_entry *e) |
2855 | if (data_len > 0xFFFF) |
2856 | return -EINVAL; |
2857 | if (diff > skb_tailroom(e->skb)) { |
2858 | - nskb = skb_copy_expand(e->skb, 0, |
2859 | - diff - skb_tailroom(e->skb), |
2860 | - GFP_ATOMIC); |
2861 | + nskb = skb_copy_expand(e->skb, skb_headroom(e->skb), |
2862 | + diff, GFP_ATOMIC); |
2863 | if (!nskb) { |
2864 | printk(KERN_WARNING "nf_queue: OOM " |
2865 | "in mangle, dropping packet\n"); |
2866 | diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c |
2867 | index 66148cc..5bc1ed4 100644 |
2868 | --- a/net/sched/sch_htb.c |
2869 | +++ b/net/sched/sch_htb.c |
2870 | @@ -1197,12 +1197,16 @@ static inline int htb_parent_last_child(struct htb_class *cl) |
2871 | return 1; |
2872 | } |
2873 | |
2874 | -static void htb_parent_to_leaf(struct htb_class *cl, struct Qdisc *new_q) |
2875 | +static void htb_parent_to_leaf(struct htb_sched *q, struct htb_class *cl, |
2876 | + struct Qdisc *new_q) |
2877 | { |
2878 | struct htb_class *parent = cl->parent; |
2879 | |
2880 | BUG_TRAP(!cl->level && cl->un.leaf.q && !cl->prio_activity); |
2881 | |
2882 | + if (parent->cmode != HTB_CAN_SEND) |
2883 | + htb_safe_rb_erase(&parent->pq_node, q->wait_pq + parent->level); |
2884 | + |
2885 | parent->level = 0; |
2886 | memset(&parent->un.inner, 0, sizeof(parent->un.inner)); |
2887 | INIT_LIST_HEAD(&parent->un.leaf.drop_list); |
2888 | @@ -1300,7 +1304,7 @@ static int htb_delete(struct Qdisc *sch, unsigned long arg) |
2889 | htb_deactivate(q, cl); |
2890 | |
2891 | if (last_child) |
2892 | - htb_parent_to_leaf(cl, new_q); |
2893 | + htb_parent_to_leaf(q, cl, new_q); |
2894 | |
2895 | if (--cl->refcnt == 0) |
2896 | htb_destroy_class(sch, cl); |
2897 | diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c |
2898 | index 58f1f93..413885c 100644 |
2899 | --- a/net/xfrm/xfrm_state.c |
2900 | +++ b/net/xfrm/xfrm_state.c |
2901 | @@ -2093,7 +2093,7 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, |
2902 | iph6 = ipv6_hdr(skb); |
2903 | audit_log_format(audit_buf, |
2904 | " src=" NIP6_FMT " dst=" NIP6_FMT |
2905 | - " flowlbl=0x%x%x%x", |
2906 | + " flowlbl=0x%x%02x%02x", |
2907 | NIP6(iph6->saddr), |
2908 | NIP6(iph6->daddr), |
2909 | iph6->flow_lbl[0] & 0x0f, |