Magellan Linux

Contents of /trunk/kernel26-alx/patches-2.6.27-r3/0122-2.6.27.23-all-fixes.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1176 - (show annotations) (download)
Thu Oct 14 15:11:06 2010 UTC (13 years, 7 months ago) by niro
File size: 44470 byte(s)
-2.6.27-alx-r3: new magellan 0.5.2 kernel
1 diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
2 index 1e06d23..952f051 100644
3 --- a/arch/mips/Kconfig
4 +++ b/arch/mips/Kconfig
5 @@ -1293,6 +1293,7 @@ config 32BIT
6 config 64BIT
7 bool "64-bit kernel"
8 depends on CPU_SUPPORTS_64BIT_KERNEL && SYS_SUPPORTS_64BIT_KERNEL
9 + select HAVE_SYSCALL_WRAPPERS
10 help
11 Select this option if you want to build a 64-bit kernel.
12
13 diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
14 index 2fefb14..645f6d2 100644
15 --- a/arch/mips/kernel/linux32.c
16 +++ b/arch/mips/kernel/linux32.c
17 @@ -32,6 +32,7 @@
18 #include <linux/module.h>
19 #include <linux/binfmts.h>
20 #include <linux/security.h>
21 +#include <linux/syscalls.h>
22 #include <linux/compat.h>
23 #include <linux/vfs.h>
24 #include <linux/ipc.h>
25 @@ -98,9 +99,9 @@ int cp_compat_stat(struct kstat *stat, struct compat_stat __user *statbuf)
26 return copy_to_user(statbuf, &tmp, sizeof(tmp)) ? -EFAULT : 0;
27 }
28
29 -asmlinkage unsigned long
30 -sys32_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
31 - unsigned long flags, unsigned long fd, unsigned long pgoff)
32 +SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
33 + unsigned long, prot, unsigned long, flags, unsigned long, fd,
34 + unsigned long, pgoff)
35 {
36 struct file * file = NULL;
37 unsigned long error;
38 @@ -156,14 +157,14 @@ struct rlimit32 {
39 int rlim_max;
40 };
41
42 -asmlinkage long sys32_truncate64(const char __user * path,
43 - unsigned long __dummy, int a2, int a3)
44 +SYSCALL_DEFINE4(32_truncate64, const char __user *, path,
45 + unsigned long, __dummy, unsigned long, a2, unsigned long, a3)
46 {
47 return sys_truncate(path, merge_64(a2, a3));
48 }
49
50 -asmlinkage long sys32_ftruncate64(unsigned int fd, unsigned long __dummy,
51 - int a2, int a3)
52 +SYSCALL_DEFINE4(32_ftruncate64, unsigned long, fd, unsigned long, __dummy,
53 + unsigned long, a2, unsigned long, a3)
54 {
55 return sys_ftruncate(fd, merge_64(a2, a3));
56 }
57 @@ -234,9 +235,9 @@ sys32_settimeofday(struct compat_timeval __user *tv, struct timezone __user *tz)
58 return do_sys_settimeofday(tv ? &kts : NULL, tz ? &ktz : NULL);
59 }
60
61 -asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
62 - unsigned int offset_low, loff_t __user * result,
63 - unsigned int origin)
64 +SYSCALL_DEFINE5(32_llseek, unsigned int, fd, unsigned int, offset_high,
65 + unsigned int, offset_low, loff_t __user *, result,
66 + unsigned int, origin)
67 {
68 return sys_llseek(fd, offset_high, offset_low, result, origin);
69 }
70 @@ -245,20 +246,20 @@ asmlinkage int sys32_llseek(unsigned int fd, unsigned int offset_high,
71 lseek back to original location. They fail just like lseek does on
72 non-seekable files. */
73
74 -asmlinkage ssize_t sys32_pread(unsigned int fd, char __user * buf,
75 - size_t count, u32 unused, u64 a4, u64 a5)
76 +SYSCALL_DEFINE6(32_pread, unsigned long, fd, char __user *, buf, size_t, count,
77 + unsigned long, unused, unsigned long, a4, unsigned long, a5)
78 {
79 return sys_pread64(fd, buf, count, merge_64(a4, a5));
80 }
81
82 -asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char __user * buf,
83 - size_t count, u32 unused, u64 a4, u64 a5)
84 +SYSCALL_DEFINE6(32_pwrite, unsigned int, fd, const char __user *, buf,
85 + size_t, count, u32, unused, u64, a4, u64, a5)
86 {
87 return sys_pwrite64(fd, buf, count, merge_64(a4, a5));
88 }
89
90 -asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
91 - struct compat_timespec __user *interval)
92 +SYSCALL_DEFINE2(32_sched_rr_get_interval, compat_pid_t, pid,
93 + struct compat_timespec __user *, interval)
94 {
95 struct timespec t;
96 int ret;
97 @@ -275,8 +276,8 @@ asmlinkage int sys32_sched_rr_get_interval(compat_pid_t pid,
98
99 #ifdef CONFIG_SYSVIPC
100
101 -asmlinkage long
102 -sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
103 +SYSCALL_DEFINE6(32_ipc, u32, call, long, first, long, second, long, third,
104 + unsigned long, ptr, unsigned long, fifth)
105 {
106 int version, err;
107
108 @@ -334,8 +335,8 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
109
110 #else
111
112 -asmlinkage long
113 -sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
114 +SYSCALL_DEFINE6(32_ipc, u32, call, int, first, int, second, int, third,
115 + u32, ptr, u32, fifth)
116 {
117 return -ENOSYS;
118 }
119 @@ -343,7 +344,7 @@ sys32_ipc(u32 call, int first, int second, int third, u32 ptr, u32 fifth)
120 #endif /* CONFIG_SYSVIPC */
121
122 #ifdef CONFIG_MIPS32_N32
123 -asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
124 +SYSCALL_DEFINE4(n32_semctl, int, semid, int, semnum, int, cmd, u32, arg)
125 {
126 /* compat_sys_semctl expects a pointer to union semun */
127 u32 __user *uptr = compat_alloc_user_space(sizeof(u32));
128 @@ -352,13 +353,14 @@ asmlinkage long sysn32_semctl(int semid, int semnum, int cmd, u32 arg)
129 return compat_sys_semctl(semid, semnum, cmd, uptr);
130 }
131
132 -asmlinkage long sysn32_msgsnd(int msqid, u32 msgp, unsigned msgsz, int msgflg)
133 +SYSCALL_DEFINE4(n32_msgsnd, int, msqid, u32, msgp, unsigned int, msgsz,
134 + int, msgflg)
135 {
136 return compat_sys_msgsnd(msqid, msgsz, msgflg, compat_ptr(msgp));
137 }
138
139 -asmlinkage long sysn32_msgrcv(int msqid, u32 msgp, size_t msgsz, int msgtyp,
140 - int msgflg)
141 +SYSCALL_DEFINE5(n32_msgrcv, int, msqid, u32, msgp, size_t, msgsz,
142 + int, msgtyp, int, msgflg)
143 {
144 return compat_sys_msgrcv(msqid, msgsz, msgtyp, msgflg, IPC_64,
145 compat_ptr(msgp));
146 @@ -378,7 +380,7 @@ struct sysctl_args32
147
148 #ifdef CONFIG_SYSCTL_SYSCALL
149
150 -asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
151 +SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
152 {
153 struct sysctl_args32 tmp;
154 int error;
155 @@ -417,9 +419,16 @@ asmlinkage long sys32_sysctl(struct sysctl_args32 __user *args)
156 return error;
157 }
158
159 +#else
160 +
161 +SYSCALL_DEFINE1(32_sysctl, struct sysctl_args32 __user *, args)
162 +{
163 + return -ENOSYS;
164 +}
165 +
166 #endif /* CONFIG_SYSCTL_SYSCALL */
167
168 -asmlinkage long sys32_newuname(struct new_utsname __user * name)
169 +SYSCALL_DEFINE1(32_newuname, struct new_utsname __user *, name)
170 {
171 int ret = 0;
172
173 @@ -435,7 +444,7 @@ asmlinkage long sys32_newuname(struct new_utsname __user * name)
174 return ret;
175 }
176
177 -asmlinkage int sys32_personality(unsigned long personality)
178 +SYSCALL_DEFINE1(32_personality, unsigned long, personality)
179 {
180 int ret;
181 personality &= 0xffffffff;
182 @@ -458,7 +467,7 @@ struct ustat32 {
183
184 extern asmlinkage long sys_ustat(dev_t dev, struct ustat __user * ubuf);
185
186 -asmlinkage int sys32_ustat(dev_t dev, struct ustat32 __user * ubuf32)
187 +SYSCALL_DEFINE2(32_ustat, dev_t, dev, struct ustat32 __user *, ubuf32)
188 {
189 int err;
190 struct ustat tmp;
191 @@ -482,8 +491,8 @@ out:
192 return err;
193 }
194
195 -asmlinkage int sys32_sendfile(int out_fd, int in_fd, compat_off_t __user *offset,
196 - s32 count)
197 +SYSCALL_DEFINE4(32_sendfile, long, out_fd, long, in_fd,
198 + compat_off_t __user *, offset, s32, count)
199 {
200 mm_segment_t old_fs = get_fs();
201 int ret;
202 diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
203 index 61906f6..e6115c6 100644
204 --- a/arch/mips/kernel/scall32-o32.S
205 +++ b/arch/mips/kernel/scall32-o32.S
206 @@ -402,7 +402,7 @@ einval: li v0, -EINVAL
207 sys sys_swapon 2
208 sys sys_reboot 3
209 sys sys_old_readdir 3
210 - sys old_mmap 6 /* 4090 */
211 + sys sys_mips_mmap 6 /* 4090 */
212 sys sys_munmap 2
213 sys sys_truncate 2
214 sys sys_ftruncate 2
215 @@ -522,7 +522,7 @@ einval: li v0, -EINVAL
216 sys sys_sendfile 4
217 sys sys_ni_syscall 0
218 sys sys_ni_syscall 0
219 - sys sys_mmap2 6 /* 4210 */
220 + sys sys_mips_mmap2 6 /* 4210 */
221 sys sys_truncate64 4
222 sys sys_ftruncate64 4
223 sys sys_stat64 2
224 diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
225 index 3d58204..96d27af 100644
226 --- a/arch/mips/kernel/scall64-64.S
227 +++ b/arch/mips/kernel/scall64-64.S
228 @@ -207,7 +207,7 @@ sys_call_table:
229 PTR sys_newlstat
230 PTR sys_poll
231 PTR sys_lseek
232 - PTR old_mmap
233 + PTR sys_mips_mmap
234 PTR sys_mprotect /* 5010 */
235 PTR sys_munmap
236 PTR sys_brk
237 diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
238 index da7f1b6..06941b3 100644
239 --- a/arch/mips/kernel/scall64-n32.S
240 +++ b/arch/mips/kernel/scall64-n32.S
241 @@ -129,12 +129,12 @@ EXPORT(sysn32_call_table)
242 PTR sys_newlstat
243 PTR sys_poll
244 PTR sys_lseek
245 - PTR old_mmap
246 + PTR sys_mips_mmap
247 PTR sys_mprotect /* 6010 */
248 PTR sys_munmap
249 PTR sys_brk
250 - PTR sys32_rt_sigaction
251 - PTR sys32_rt_sigprocmask
252 + PTR sys_32_rt_sigaction
253 + PTR sys_32_rt_sigprocmask
254 PTR compat_sys_ioctl /* 6015 */
255 PTR sys_pread64
256 PTR sys_pwrite64
257 @@ -159,7 +159,7 @@ EXPORT(sysn32_call_table)
258 PTR compat_sys_setitimer
259 PTR sys_alarm
260 PTR sys_getpid
261 - PTR sys32_sendfile
262 + PTR sys_32_sendfile
263 PTR sys_socket /* 6040 */
264 PTR sys_connect
265 PTR sys_accept
266 @@ -181,14 +181,14 @@ EXPORT(sysn32_call_table)
267 PTR sys_exit
268 PTR compat_sys_wait4
269 PTR sys_kill /* 6060 */
270 - PTR sys32_newuname
271 + PTR sys_32_newuname
272 PTR sys_semget
273 PTR sys_semop
274 - PTR sysn32_semctl
275 + PTR sys_n32_semctl
276 PTR sys_shmdt /* 6065 */
277 PTR sys_msgget
278 - PTR sysn32_msgsnd
279 - PTR sysn32_msgrcv
280 + PTR sys_n32_msgsnd
281 + PTR sys_n32_msgrcv
282 PTR compat_sys_msgctl
283 PTR compat_sys_fcntl /* 6070 */
284 PTR sys_flock
285 @@ -245,15 +245,15 @@ EXPORT(sysn32_call_table)
286 PTR sys_getsid
287 PTR sys_capget
288 PTR sys_capset
289 - PTR sys32_rt_sigpending /* 6125 */
290 + PTR sys_32_rt_sigpending /* 6125 */
291 PTR compat_sys_rt_sigtimedwait
292 - PTR sys32_rt_sigqueueinfo
293 + PTR sys_32_rt_sigqueueinfo
294 PTR sysn32_rt_sigsuspend
295 PTR sys32_sigaltstack
296 PTR compat_sys_utime /* 6130 */
297 PTR sys_mknod
298 - PTR sys32_personality
299 - PTR sys32_ustat
300 + PTR sys_32_personality
301 + PTR sys_32_ustat
302 PTR compat_sys_statfs
303 PTR compat_sys_fstatfs /* 6135 */
304 PTR sys_sysfs
305 @@ -265,14 +265,14 @@ EXPORT(sysn32_call_table)
306 PTR sys_sched_getscheduler
307 PTR sys_sched_get_priority_max
308 PTR sys_sched_get_priority_min
309 - PTR sys32_sched_rr_get_interval /* 6145 */
310 + PTR sys_32_sched_rr_get_interval /* 6145 */
311 PTR sys_mlock
312 PTR sys_munlock
313 PTR sys_mlockall
314 PTR sys_munlockall
315 PTR sys_vhangup /* 6150 */
316 PTR sys_pivot_root
317 - PTR sys32_sysctl
318 + PTR sys_32_sysctl
319 PTR sys_prctl
320 PTR compat_sys_adjtimex
321 PTR compat_sys_setrlimit /* 6155 */
322 diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
323 index d7cd1aa..ddb52e6 100644
324 --- a/arch/mips/kernel/scall64-o32.S
325 +++ b/arch/mips/kernel/scall64-o32.S
326 @@ -267,12 +267,12 @@ sys_call_table:
327 PTR sys_olduname
328 PTR sys_umask /* 4060 */
329 PTR sys_chroot
330 - PTR sys32_ustat
331 + PTR sys_32_ustat
332 PTR sys_dup2
333 PTR sys_getppid
334 PTR sys_getpgrp /* 4065 */
335 PTR sys_setsid
336 - PTR sys32_sigaction
337 + PTR sys_32_sigaction
338 PTR sys_sgetmask
339 PTR sys_ssetmask
340 PTR sys_setreuid /* 4070 */
341 @@ -295,7 +295,7 @@ sys_call_table:
342 PTR sys_swapon
343 PTR sys_reboot
344 PTR compat_sys_old_readdir
345 - PTR old_mmap /* 4090 */
346 + PTR sys_mips_mmap /* 4090 */
347 PTR sys_munmap
348 PTR sys_truncate
349 PTR sys_ftruncate
350 @@ -322,12 +322,12 @@ sys_call_table:
351 PTR compat_sys_wait4
352 PTR sys_swapoff /* 4115 */
353 PTR compat_sys_sysinfo
354 - PTR sys32_ipc
355 + PTR sys_32_ipc
356 PTR sys_fsync
357 PTR sys32_sigreturn
358 PTR sys32_clone /* 4120 */
359 PTR sys_setdomainname
360 - PTR sys32_newuname
361 + PTR sys_32_newuname
362 PTR sys_ni_syscall /* sys_modify_ldt */
363 PTR compat_sys_adjtimex
364 PTR sys_mprotect /* 4125 */
365 @@ -341,11 +341,11 @@ sys_call_table:
366 PTR sys_fchdir
367 PTR sys_bdflush
368 PTR sys_sysfs /* 4135 */
369 - PTR sys32_personality
370 + PTR sys_32_personality
371 PTR sys_ni_syscall /* for afs_syscall */
372 PTR sys_setfsuid
373 PTR sys_setfsgid
374 - PTR sys32_llseek /* 4140 */
375 + PTR sys_32_llseek /* 4140 */
376 PTR compat_sys_getdents
377 PTR compat_sys_select
378 PTR sys_flock
379 @@ -358,7 +358,7 @@ sys_call_table:
380 PTR sys_ni_syscall /* 4150 */
381 PTR sys_getsid
382 PTR sys_fdatasync
383 - PTR sys32_sysctl
384 + PTR sys_32_sysctl
385 PTR sys_mlock
386 PTR sys_munlock /* 4155 */
387 PTR sys_mlockall
388 @@ -370,7 +370,7 @@ sys_call_table:
389 PTR sys_sched_yield
390 PTR sys_sched_get_priority_max
391 PTR sys_sched_get_priority_min
392 - PTR sys32_sched_rr_get_interval /* 4165 */
393 + PTR sys_32_sched_rr_get_interval /* 4165 */
394 PTR compat_sys_nanosleep
395 PTR sys_mremap
396 PTR sys_accept
397 @@ -399,25 +399,25 @@ sys_call_table:
398 PTR sys_getresgid
399 PTR sys_prctl
400 PTR sys32_rt_sigreturn
401 - PTR sys32_rt_sigaction
402 - PTR sys32_rt_sigprocmask /* 4195 */
403 - PTR sys32_rt_sigpending
404 + PTR sys_32_rt_sigaction
405 + PTR sys_32_rt_sigprocmask /* 4195 */
406 + PTR sys_32_rt_sigpending
407 PTR compat_sys_rt_sigtimedwait
408 - PTR sys32_rt_sigqueueinfo
409 + PTR sys_32_rt_sigqueueinfo
410 PTR sys32_rt_sigsuspend
411 - PTR sys32_pread /* 4200 */
412 - PTR sys32_pwrite
413 + PTR sys_32_pread /* 4200 */
414 + PTR sys_32_pwrite
415 PTR sys_chown
416 PTR sys_getcwd
417 PTR sys_capget
418 PTR sys_capset /* 4205 */
419 PTR sys32_sigaltstack
420 - PTR sys32_sendfile
421 + PTR sys_32_sendfile
422 PTR sys_ni_syscall
423 PTR sys_ni_syscall
424 - PTR sys32_mmap2 /* 4210 */
425 - PTR sys32_truncate64
426 - PTR sys32_ftruncate64
427 + PTR sys_mips_mmap2 /* 4210 */
428 + PTR sys_32_truncate64
429 + PTR sys_32_ftruncate64
430 PTR sys_newstat
431 PTR sys_newlstat
432 PTR sys_newfstat /* 4215 */
433 @@ -483,7 +483,7 @@ sys_call_table:
434 PTR compat_sys_mq_notify /* 4275 */
435 PTR compat_sys_mq_getsetattr
436 PTR sys_ni_syscall /* sys_vserver */
437 - PTR sys32_waitid
438 + PTR sys_32_waitid
439 PTR sys_ni_syscall /* available, was setaltroot */
440 PTR sys_add_key /* 4280 */
441 PTR sys_request_key
442 diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
443 index a4e106c..830c5ef 100644
444 --- a/arch/mips/kernel/signal.c
445 +++ b/arch/mips/kernel/signal.c
446 @@ -19,6 +19,7 @@
447 #include <linux/ptrace.h>
448 #include <linux/unistd.h>
449 #include <linux/compiler.h>
450 +#include <linux/syscalls.h>
451 #include <linux/uaccess.h>
452
453 #include <asm/abi.h>
454 @@ -338,8 +339,8 @@ asmlinkage int sys_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
455 }
456
457 #ifdef CONFIG_TRAD_SIGNALS
458 -asmlinkage int sys_sigaction(int sig, const struct sigaction __user *act,
459 - struct sigaction __user *oact)
460 +SYSCALL_DEFINE3(sigaction, int, sig, const struct sigaction __user *, act,
461 + struct sigaction __user *, oact)
462 {
463 struct k_sigaction new_ka, old_ka;
464 int ret;
465 diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
466 index 572c610..86d23ea 100644
467 --- a/arch/mips/kernel/signal32.c
468 +++ b/arch/mips/kernel/signal32.c
469 @@ -349,8 +349,8 @@ asmlinkage int sys32_rt_sigsuspend(nabi_no_regargs struct pt_regs regs)
470 return -ERESTARTNOHAND;
471 }
472
473 -asmlinkage int sys32_sigaction(int sig, const struct sigaction32 __user *act,
474 - struct sigaction32 __user *oact)
475 +SYSCALL_DEFINE3(32_sigaction, long, sig, const struct sigaction32 __user *, act,
476 + struct sigaction32 __user *, oact)
477 {
478 struct k_sigaction new_ka, old_ka;
479 int ret;
480 @@ -692,9 +692,9 @@ struct mips_abi mips_abi_32 = {
481 .restart = __NR_O32_restart_syscall
482 };
483
484 -asmlinkage int sys32_rt_sigaction(int sig, const struct sigaction32 __user *act,
485 - struct sigaction32 __user *oact,
486 - unsigned int sigsetsize)
487 +SYSCALL_DEFINE4(32_rt_sigaction, int, sig,
488 + const struct sigaction32 __user *, act,
489 + struct sigaction32 __user *, oact, unsigned int, sigsetsize)
490 {
491 struct k_sigaction new_sa, old_sa;
492 int ret = -EINVAL;
493 @@ -736,8 +736,8 @@ out:
494 return ret;
495 }
496
497 -asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
498 - compat_sigset_t __user *oset, unsigned int sigsetsize)
499 +SYSCALL_DEFINE4(32_rt_sigprocmask, int, how, compat_sigset_t __user *, set,
500 + compat_sigset_t __user *, oset, unsigned int, sigsetsize)
501 {
502 sigset_t old_set, new_set;
503 int ret;
504 @@ -758,8 +758,8 @@ asmlinkage int sys32_rt_sigprocmask(int how, compat_sigset_t __user *set,
505 return ret;
506 }
507
508 -asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
509 - unsigned int sigsetsize)
510 +SYSCALL_DEFINE2(32_rt_sigpending, compat_sigset_t __user *, uset,
511 + unsigned int, sigsetsize)
512 {
513 int ret;
514 sigset_t set;
515 @@ -775,7 +775,8 @@ asmlinkage int sys32_rt_sigpending(compat_sigset_t __user *uset,
516 return ret;
517 }
518
519 -asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *uinfo)
520 +SYSCALL_DEFINE3(32_rt_sigqueueinfo, int, pid, int, sig,
521 + compat_siginfo_t __user *, uinfo)
522 {
523 siginfo_t info;
524 int ret;
525 @@ -790,10 +791,9 @@ asmlinkage int sys32_rt_sigqueueinfo(int pid, int sig, compat_siginfo_t __user *
526 return ret;
527 }
528
529 -asmlinkage long
530 -sys32_waitid(int which, compat_pid_t pid,
531 - compat_siginfo_t __user *uinfo, int options,
532 - struct compat_rusage __user *uru)
533 +SYSCALL_DEFINE5(32_waitid, int, which, compat_pid_t, pid,
534 + compat_siginfo_t __user *, uinfo, int, options,
535 + struct compat_rusage __user *, uru)
536 {
537 siginfo_t info;
538 struct rusage ru;
539 diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
540 index 343015a..e43e843 100644
541 --- a/arch/mips/kernel/syscall.c
542 +++ b/arch/mips/kernel/syscall.c
543 @@ -153,9 +153,9 @@ out:
544 return error;
545 }
546
547 -asmlinkage unsigned long
548 -old_mmap(unsigned long addr, unsigned long len, int prot,
549 - int flags, int fd, off_t offset)
550 +SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
551 + unsigned long, prot, unsigned long, flags, unsigned long,
552 + fd, off_t, offset)
553 {
554 unsigned long result;
555
556 @@ -169,9 +169,9 @@ out:
557 return result;
558 }
559
560 -asmlinkage unsigned long
561 -sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
562 - unsigned long flags, unsigned long fd, unsigned long pgoff)
563 +SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
564 + unsigned long, prot, unsigned long, flags, unsigned long, fd,
565 + unsigned long, pgoff)
566 {
567 if (pgoff & (~PAGE_MASK >> 12))
568 return -EINVAL;
569 @@ -241,7 +241,7 @@ out:
570 /*
571 * Compacrapability ...
572 */
573 -asmlinkage int sys_uname(struct old_utsname __user * name)
574 +SYSCALL_DEFINE1(uname, struct old_utsname __user *, name)
575 {
576 if (name && !copy_to_user(name, utsname(), sizeof (*name)))
577 return 0;
578 @@ -251,7 +251,7 @@ asmlinkage int sys_uname(struct old_utsname __user * name)
579 /*
580 * Compacrapability ...
581 */
582 -asmlinkage int sys_olduname(struct oldold_utsname __user * name)
583 +SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name)
584 {
585 int error;
586
587 @@ -280,7 +280,7 @@ asmlinkage int sys_olduname(struct oldold_utsname __user * name)
588 return error;
589 }
590
591 -asmlinkage int sys_set_thread_area(unsigned long addr)
592 +SYSCALL_DEFINE1(set_thread_area, unsigned long, addr)
593 {
594 struct thread_info *ti = task_thread_info(current);
595
596 @@ -291,7 +291,7 @@ asmlinkage int sys_set_thread_area(unsigned long addr)
597 return 0;
598 }
599
600 -asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
601 +asmlinkage int _sys_sysmips(long cmd, long arg1, long arg2, long arg3)
602 {
603 switch (cmd) {
604 case MIPS_ATOMIC_SET:
605 @@ -326,8 +326,8 @@ asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
606 *
607 * This is really horribly ugly.
608 */
609 -asmlinkage int sys_ipc(unsigned int call, int first, int second,
610 - unsigned long third, void __user *ptr, long fifth)
611 +SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, int, second,
612 + unsigned long, third, void __user *, ptr, long, fifth)
613 {
614 int version, ret;
615
616 @@ -412,7 +412,7 @@ asmlinkage int sys_ipc(unsigned int call, int first, int second,
617 /*
618 * No implemented yet ...
619 */
620 -asmlinkage int sys_cachectl(char *addr, int nbytes, int op)
621 +SYSCALL_DEFINE3(cachectl, char *, addr, int, nbytes, int, op)
622 {
623 return -ENOSYS;
624 }
625 diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
626 index 1eb7c71..789c97a 100644
627 --- a/arch/mips/mm/cache.c
628 +++ b/arch/mips/mm/cache.c
629 @@ -13,6 +13,7 @@
630 #include <linux/linkage.h>
631 #include <linux/module.h>
632 #include <linux/sched.h>
633 +#include <linux/syscalls.h>
634 #include <linux/mm.h>
635
636 #include <asm/cacheflush.h>
637 @@ -58,8 +59,8 @@ EXPORT_SYMBOL(_dma_cache_wback_inv);
638 * We could optimize the case where the cache argument is not BCACHE but
639 * that seems very atypical use ...
640 */
641 -asmlinkage int sys_cacheflush(unsigned long addr,
642 - unsigned long bytes, unsigned int cache)
643 +SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes,
644 + unsigned int, cache)
645 {
646 if (bytes == 0)
647 return 0;
648 diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
649 index d963576..76d49eb 100644
650 --- a/arch/x86/pci/mmconfig-shared.c
651 +++ b/arch/x86/pci/mmconfig-shared.c
652 @@ -255,7 +255,7 @@ static acpi_status __init check_mcfg_resource(struct acpi_resource *res,
653 if (!fixmem32)
654 return AE_OK;
655 if ((mcfg_res->start >= fixmem32->address) &&
656 - (mcfg_res->end < (fixmem32->address +
657 + (mcfg_res->end <= (fixmem32->address +
658 fixmem32->address_length))) {
659 mcfg_res->flags = 1;
660 return AE_CTRL_TERMINATE;
661 @@ -272,7 +272,7 @@ static acpi_status __init check_mcfg_resource(struct acpi_resource *res,
662 return AE_OK;
663
664 if ((mcfg_res->start >= address.minimum) &&
665 - (mcfg_res->end < (address.minimum + address.address_length))) {
666 + (mcfg_res->end <= (address.minimum + address.address_length))) {
667 mcfg_res->flags = 1;
668 return AE_CTRL_TERMINATE;
669 }
670 @@ -319,7 +319,7 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved,
671 u64 old_size = size;
672 int valid = 0;
673
674 - while (!is_reserved(addr, addr + size - 1, E820_RESERVED)) {
675 + while (!is_reserved(addr, addr + size, E820_RESERVED)) {
676 size >>= 1;
677 if (size < (16UL<<20))
678 break;
679 diff --git a/drivers/acpi/resources/rscreate.c b/drivers/acpi/resources/rscreate.c
680 index 7804a8c..c277455 100644
681 --- a/drivers/acpi/resources/rscreate.c
682 +++ b/drivers/acpi/resources/rscreate.c
683 @@ -191,8 +191,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
684 user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
685
686 for (index = 0; index < number_of_elements; index++) {
687 - int source_name_index = 2;
688 - int source_index_index = 3;
689
690 /*
691 * Point user_prt past this current structure
692 @@ -261,27 +259,6 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
693 return_ACPI_STATUS(AE_BAD_DATA);
694 }
695
696 - /*
697 - * If BIOS erroneously reversed the _PRT source_name and source_index,
698 - * then reverse them back.
699 - */
700 - if (ACPI_GET_OBJECT_TYPE(sub_object_list[3]) !=
701 - ACPI_TYPE_INTEGER) {
702 - if (acpi_gbl_enable_interpreter_slack) {
703 - source_name_index = 3;
704 - source_index_index = 2;
705 - printk(KERN_WARNING
706 - "ACPI: Handling Garbled _PRT entry\n");
707 - } else {
708 - ACPI_ERROR((AE_INFO,
709 - "(PRT[%X].source_index) Need Integer, found %s",
710 - index,
711 - acpi_ut_get_object_type_name
712 - (sub_object_list[3])));
713 - return_ACPI_STATUS(AE_BAD_DATA);
714 - }
715 - }
716 -
717 user_prt->pin = (u32) obj_desc->integer.value;
718
719 /*
720 @@ -305,7 +282,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
721 * 3) Third subobject: Dereference the PRT.source_name
722 * The name may be unresolved (slack mode), so allow a null object
723 */
724 - obj_desc = sub_object_list[source_name_index];
725 + obj_desc = sub_object_list[2];
726 if (obj_desc) {
727 switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
728 case ACPI_TYPE_LOCAL_REFERENCE:
729 @@ -380,7 +357,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
730
731 /* 4) Fourth subobject: Dereference the PRT.source_index */
732
733 - obj_desc = sub_object_list[source_index_index];
734 + obj_desc = sub_object_list[3];
735 if (ACPI_GET_OBJECT_TYPE(obj_desc) != ACPI_TYPE_INTEGER) {
736 ACPI_ERROR((AE_INFO,
737 "(PRT[%X].SourceIndex) Need Integer, found %s",
738 diff --git a/drivers/char/hw_random/virtio-rng.c b/drivers/char/hw_random/virtio-rng.c
739 index d0e563e..86e83f8 100644
740 --- a/drivers/char/hw_random/virtio-rng.c
741 +++ b/drivers/char/hw_random/virtio-rng.c
742 @@ -37,9 +37,9 @@ static void random_recv_done(struct virtqueue *vq)
743 {
744 int len;
745
746 - /* We never get spurious callbacks. */
747 + /* We can get spurious callbacks, e.g. shared IRQs + virtio_pci. */
748 if (!vq->vq_ops->get_buf(vq, &len))
749 - BUG();
750 + return;
751
752 data_left = len / sizeof(random_data[0]);
753 complete(&have_data);
754 diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
755 index d7326d9..83dee5a 100644
756 --- a/drivers/gpu/drm/i915/i915_drv.h
757 +++ b/drivers/gpu/drm/i915/i915_drv.h
758 @@ -1115,7 +1115,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
759 (dev)->pci_device == 0x2A42 || \
760 (dev)->pci_device == 0x2E02 || \
761 (dev)->pci_device == 0x2E12 || \
762 - (dev)->pci_device == 0x2E22)
763 + (dev)->pci_device == 0x2E22 || \
764 + (dev)->pci_device == 0x2E32)
765
766 #define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
767
768 @@ -1123,7 +1124,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
769
770 #define IS_G4X(dev) ((dev)->pci_device == 0x2E02 || \
771 (dev)->pci_device == 0x2E12 || \
772 - (dev)->pci_device == 0x2E22)
773 + (dev)->pci_device == 0x2E22 || \
774 + (dev)->pci_device == 0x2E32)
775
776 #define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
777 (dev)->pci_device == 0x29B2 || \
778 diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
779 index eeb55ed..bf76dec 100644
780 --- a/drivers/net/forcedeth.c
781 +++ b/drivers/net/forcedeth.c
782 @@ -5967,6 +5967,9 @@ static int nv_resume(struct pci_dev *pdev)
783 for (i = 0;i <= np->register_size/sizeof(u32); i++)
784 writel(np->saved_config_space[i], base+i*sizeof(u32));
785
786 + /* restore phy state, including autoneg */
787 + phy_init(dev);
788 +
789 netif_device_attach(dev);
790 if (netif_running(dev)) {
791 rc = nv_open(dev);
792 diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
793 index 0a18b9e..abd5a89 100644
794 --- a/drivers/net/mv643xx_eth.c
795 +++ b/drivers/net/mv643xx_eth.c
796 @@ -1060,7 +1060,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
797 struct mib_counters *p = &mp->mib_counters;
798
799 p->good_octets_received += mib_read(mp, 0x00);
800 - p->good_octets_received += (u64)mib_read(mp, 0x04) << 32;
801 p->bad_octets_received += mib_read(mp, 0x08);
802 p->internal_mac_transmit_err += mib_read(mp, 0x0c);
803 p->good_frames_received += mib_read(mp, 0x10);
804 @@ -1074,7 +1073,6 @@ static void mib_counters_update(struct mv643xx_eth_private *mp)
805 p->frames_512_to_1023_octets += mib_read(mp, 0x30);
806 p->frames_1024_to_max_octets += mib_read(mp, 0x34);
807 p->good_octets_sent += mib_read(mp, 0x38);
808 - p->good_octets_sent += (u64)mib_read(mp, 0x3c) << 32;
809 p->good_frames_sent += mib_read(mp, 0x40);
810 p->excessive_collision += mib_read(mp, 0x44);
811 p->multicast_frames_sent += mib_read(mp, 0x48);
812 diff --git a/drivers/net/wireless/b43/dma.c b/drivers/net/wireless/b43/dma.c
813 index 098f886..b64d701 100644
814 --- a/drivers/net/wireless/b43/dma.c
815 +++ b/drivers/net/wireless/b43/dma.c
816 @@ -551,11 +551,32 @@ address_error:
817 return 1;
818 }
819
820 +static bool b43_rx_buffer_is_poisoned(struct b43_dmaring *ring, struct sk_buff *skb)
821 +{
822 + unsigned char *f = skb->data + ring->frameoffset;
823 +
824 + return ((f[0] & f[1] & f[2] & f[3] & f[4] & f[5] & f[6] & f[7]) == 0xFF);
825 +}
826 +
827 +static void b43_poison_rx_buffer(struct b43_dmaring *ring, struct sk_buff *skb)
828 +{
829 + struct b43_rxhdr_fw4 *rxhdr;
830 + unsigned char *frame;
831 +
832 + /* This poisons the RX buffer to detect DMA failures. */
833 +
834 + rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
835 + rxhdr->frame_len = 0;
836 +
837 + B43_WARN_ON(ring->rx_buffersize < ring->frameoffset + sizeof(struct b43_plcp_hdr6) + 2);
838 + frame = skb->data + ring->frameoffset;
839 + memset(frame, 0xFF, sizeof(struct b43_plcp_hdr6) + 2 /* padding */);
840 +}
841 +
842 static int setup_rx_descbuffer(struct b43_dmaring *ring,
843 struct b43_dmadesc_generic *desc,
844 struct b43_dmadesc_meta *meta, gfp_t gfp_flags)
845 {
846 - struct b43_rxhdr_fw4 *rxhdr;
847 dma_addr_t dmaaddr;
848 struct sk_buff *skb;
849
850 @@ -564,6 +585,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
851 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
852 if (unlikely(!skb))
853 return -ENOMEM;
854 + b43_poison_rx_buffer(ring, skb);
855 dmaaddr = map_descbuffer(ring, skb->data, ring->rx_buffersize, 0);
856 if (b43_dma_mapping_error(ring, dmaaddr, ring->rx_buffersize, 0)) {
857 /* ugh. try to realloc in zone_dma */
858 @@ -574,6 +596,7 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
859 skb = __dev_alloc_skb(ring->rx_buffersize, gfp_flags);
860 if (unlikely(!skb))
861 return -ENOMEM;
862 + b43_poison_rx_buffer(ring, skb);
863 dmaaddr = map_descbuffer(ring, skb->data,
864 ring->rx_buffersize, 0);
865 }
866 @@ -589,9 +612,6 @@ static int setup_rx_descbuffer(struct b43_dmaring *ring,
867 ring->ops->fill_descriptor(ring, desc, dmaaddr,
868 ring->rx_buffersize, 0, 0, 0);
869
870 - rxhdr = (struct b43_rxhdr_fw4 *)(skb->data);
871 - rxhdr->frame_len = 0;
872 -
873 return 0;
874 }
875
876 @@ -1478,12 +1498,17 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
877 len = le16_to_cpu(rxhdr->frame_len);
878 } while (len == 0 && i++ < 5);
879 if (unlikely(len == 0)) {
880 - /* recycle the descriptor buffer. */
881 - sync_descbuffer_for_device(ring, meta->dmaaddr,
882 - ring->rx_buffersize);
883 - goto drop;
884 + dmaaddr = meta->dmaaddr;
885 + goto drop_recycle_buffer;
886 }
887 }
888 + if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) {
889 + /* Something went wrong with the DMA.
890 + * The device did not touch the buffer and did not overwrite the poison. */
891 + b43dbg(ring->dev->wl, "DMA RX: Dropping poisoned buffer.\n");
892 + dmaaddr = meta->dmaaddr;
893 + goto drop_recycle_buffer;
894 + }
895 if (unlikely(len > ring->rx_buffersize)) {
896 /* The data did not fit into one descriptor buffer
897 * and is split over multiple buffers.
898 @@ -1496,6 +1521,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
899 while (1) {
900 desc = ops->idx2desc(ring, *slot, &meta);
901 /* recycle the descriptor buffer. */
902 + b43_poison_rx_buffer(ring, meta->skb);
903 sync_descbuffer_for_device(ring, meta->dmaaddr,
904 ring->rx_buffersize);
905 *slot = next_slot(ring, *slot);
906 @@ -1514,8 +1540,7 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
907 err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC);
908 if (unlikely(err)) {
909 b43dbg(ring->dev->wl, "DMA RX: setup_rx_descbuffer() failed\n");
910 - sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
911 - goto drop;
912 + goto drop_recycle_buffer;
913 }
914
915 unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0);
916 @@ -1525,6 +1550,11 @@ static void dma_rx(struct b43_dmaring *ring, int *slot)
917 b43_rx(ring->dev, skb, rxhdr);
918 drop:
919 return;
920 +
921 +drop_recycle_buffer:
922 + /* Poison and recycle the RX buffer. */
923 + b43_poison_rx_buffer(ring, skb);
924 + sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize);
925 }
926
927 void b43_dma_rx(struct b43_dmaring *ring)
928 diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
929 index 00e965b..49e923d 100644
930 --- a/drivers/net/wireless/rndis_wlan.c
931 +++ b/drivers/net/wireless/rndis_wlan.c
932 @@ -2556,6 +2556,11 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
933 mutex_init(&priv->command_lock);
934 spin_lock_init(&priv->stats_lock);
935
936 + /* because rndis_command() sleeps we need to use workqueue */
937 + priv->workqueue = create_singlethread_workqueue("rndis_wlan");
938 + INIT_WORK(&priv->work, rndis_wext_worker);
939 + INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
940 +
941 /* try bind rndis_host */
942 retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS);
943 if (retval < 0)
944 @@ -2600,16 +2605,17 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
945 disassociate(usbdev, 1);
946 netif_carrier_off(usbdev->net);
947
948 - /* because rndis_command() sleeps we need to use workqueue */
949 - priv->workqueue = create_singlethread_workqueue("rndis_wlan");
950 - INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
951 queue_delayed_work(priv->workqueue, &priv->stats_work,
952 round_jiffies_relative(STATS_UPDATE_JIFFIES));
953 - INIT_WORK(&priv->work, rndis_wext_worker);
954
955 return 0;
956
957 fail:
958 + cancel_delayed_work_sync(&priv->stats_work);
959 + cancel_work_sync(&priv->work);
960 + flush_workqueue(priv->workqueue);
961 + destroy_workqueue(priv->workqueue);
962 +
963 kfree(priv);
964 return retval;
965 }
966 diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
967 index d0e5769..5368689 100644
968 --- a/drivers/pci/quirks.c
969 +++ b/drivers/pci/quirks.c
970 @@ -1832,6 +1832,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS400_200, quirk_di
971 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_RS480, quirk_disable_all_msi);
972 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3336, quirk_disable_all_msi);
973 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3351, quirk_disable_all_msi);
974 +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT3364, quirk_disable_all_msi);
975
976 /* Disable MSI on chipsets that are known to not support it */
977 static void __devinit quirk_disable_msi(struct pci_dev *dev)
978 diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
979 index 4f7f9e3..9fcc272 100644
980 --- a/drivers/usb/serial/usb-serial.c
981 +++ b/drivers/usb/serial/usb-serial.c
982 @@ -136,22 +136,10 @@ static void destroy_serial(struct kref *kref)
983
984 dbg("%s - %s", __func__, serial->type->description);
985
986 - serial->type->shutdown(serial);
987 -
988 /* return the minor range that this device had */
989 if (serial->minor != SERIAL_TTY_NO_MINOR)
990 return_serial(serial);
991
992 - for (i = 0; i < serial->num_ports; ++i)
993 - serial->port[i]->port.count = 0;
994 -
995 - /* the ports are cleaned up and released in port_release() */
996 - for (i = 0; i < serial->num_ports; ++i)
997 - if (serial->port[i]->dev.parent != NULL) {
998 - device_unregister(&serial->port[i]->dev);
999 - serial->port[i] = NULL;
1000 - }
1001 -
1002 /* If this is a "fake" port, we have to clean it up here, as it will
1003 * not get cleaned up in port_release() as it was never registered with
1004 * the driver core */
1005 @@ -186,7 +174,7 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
1006 struct usb_serial *serial;
1007 struct usb_serial_port *port;
1008 unsigned int portNumber;
1009 - int retval;
1010 + int retval = 0;
1011
1012 dbg("%s", __func__);
1013
1014 @@ -197,16 +185,24 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
1015 return -ENODEV;
1016 }
1017
1018 + mutex_lock(&serial->disc_mutex);
1019 portNumber = tty->index - serial->minor;
1020 port = serial->port[portNumber];
1021 - if (!port) {
1022 + if (!port || serial->disconnected)
1023 retval = -ENODEV;
1024 - goto bailout_kref_put;
1025 - }
1026 + else
1027 + get_device(&port->dev);
1028 + /*
1029 + * Note: Our locking order requirement does not allow port->mutex
1030 + * to be acquired while serial->disc_mutex is held.
1031 + */
1032 + mutex_unlock(&serial->disc_mutex);
1033 + if (retval)
1034 + goto bailout_serial_put;
1035
1036 if (mutex_lock_interruptible(&port->mutex)) {
1037 retval = -ERESTARTSYS;
1038 - goto bailout_kref_put;
1039 + goto bailout_port_put;
1040 }
1041
1042 ++port->port.count;
1043 @@ -226,14 +222,20 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
1044 goto bailout_mutex_unlock;
1045 }
1046
1047 - retval = usb_autopm_get_interface(serial->interface);
1048 + mutex_lock(&serial->disc_mutex);
1049 + if (serial->disconnected)
1050 + retval = -ENODEV;
1051 + else
1052 + retval = usb_autopm_get_interface(serial->interface);
1053 if (retval)
1054 goto bailout_module_put;
1055 +
1056 /* only call the device specific open if this
1057 * is the first time the port is opened */
1058 retval = serial->type->open(tty, port, filp);
1059 if (retval)
1060 goto bailout_interface_put;
1061 + mutex_unlock(&serial->disc_mutex);
1062 }
1063
1064 mutex_unlock(&port->mutex);
1065 @@ -242,13 +244,16 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
1066 bailout_interface_put:
1067 usb_autopm_put_interface(serial->interface);
1068 bailout_module_put:
1069 + mutex_unlock(&serial->disc_mutex);
1070 module_put(serial->type->driver.owner);
1071 bailout_mutex_unlock:
1072 port->port.count = 0;
1073 tty->driver_data = NULL;
1074 port->port.tty = NULL;
1075 mutex_unlock(&port->mutex);
1076 -bailout_kref_put:
1077 +bailout_port_put:
1078 + put_device(&port->dev);
1079 +bailout_serial_put:
1080 usb_serial_put(serial);
1081 return retval;
1082 }
1083 @@ -256,6 +261,9 @@ bailout_kref_put:
1084 static void serial_close(struct tty_struct *tty, struct file *filp)
1085 {
1086 struct usb_serial_port *port = tty->driver_data;
1087 + struct usb_serial *serial;
1088 + struct module *owner;
1089 + int count;
1090
1091 if (!port)
1092 return;
1093 @@ -263,6 +271,8 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
1094 dbg("%s - port %d", __func__, port->number);
1095
1096 mutex_lock(&port->mutex);
1097 + serial = port->serial;
1098 + owner = serial->type->driver.owner;
1099
1100 if (port->port.count == 0) {
1101 mutex_unlock(&port->mutex);
1102 @@ -273,7 +283,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
1103 if (port->port.count == 0)
1104 /* only call the device specific close if this
1105 * port is being closed by the last owner */
1106 - port->serial->type->close(tty, port, filp);
1107 + serial->type->close(tty, port, filp);
1108
1109 if (port->port.count == (port->console? 1 : 0)) {
1110 if (port->port.tty) {
1111 @@ -283,16 +293,22 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
1112 }
1113 }
1114
1115 - if (port->port.count == 0) {
1116 - mutex_lock(&port->serial->disc_mutex);
1117 - if (!port->serial->disconnected)
1118 - usb_autopm_put_interface(port->serial->interface);
1119 - mutex_unlock(&port->serial->disc_mutex);
1120 - module_put(port->serial->type->driver.owner);
1121 + count = port->port.count;
1122 + mutex_unlock(&port->mutex);
1123 + put_device(&port->dev);
1124 +
1125 + /* Mustn't dereference port any more */
1126 + if (count == 0) {
1127 + mutex_lock(&serial->disc_mutex);
1128 + if (!serial->disconnected)
1129 + usb_autopm_put_interface(serial->interface);
1130 + mutex_unlock(&serial->disc_mutex);
1131 }
1132 + usb_serial_put(serial);
1133
1134 - mutex_unlock(&port->mutex);
1135 - usb_serial_put(port->serial);
1136 + /* Mustn't dereference serial any more */
1137 + if (count == 0)
1138 + module_put(owner);
1139 }
1140
1141 static int serial_write(struct tty_struct *tty, const unsigned char *buf,
1142 @@ -544,7 +560,13 @@ static void kill_traffic(struct usb_serial_port *port)
1143
1144 static void port_free(struct usb_serial_port *port)
1145 {
1146 + /*
1147 + * Stop all the traffic before cancelling the work, so that
1148 + * nobody will restart it by calling usb_serial_port_softint.
1149 + */
1150 kill_traffic(port);
1151 + cancel_work_sync(&port->work);
1152 +
1153 usb_free_urb(port->read_urb);
1154 usb_free_urb(port->write_urb);
1155 usb_free_urb(port->interrupt_in_urb);
1156 @@ -553,7 +575,6 @@ static void port_free(struct usb_serial_port *port)
1157 kfree(port->bulk_out_buffer);
1158 kfree(port->interrupt_in_buffer);
1159 kfree(port->interrupt_out_buffer);
1160 - flush_scheduled_work(); /* port->work */
1161 kfree(port);
1162 }
1163
1164 @@ -1037,17 +1058,33 @@ void usb_serial_disconnect(struct usb_interface *interface)
1165 usb_set_intfdata(interface, NULL);
1166 /* must set a flag, to signal subdrivers */
1167 serial->disconnected = 1;
1168 + mutex_unlock(&serial->disc_mutex);
1169 +
1170 + /* Unfortunately, many of the sub-drivers expect the port structures
1171 + * to exist when their shutdown method is called, so we have to go
1172 + * through this awkward two-step unregistration procedure.
1173 + */
1174 for (i = 0; i < serial->num_ports; ++i) {
1175 port = serial->port[i];
1176 if (port) {
1177 if (port->port.tty)
1178 tty_hangup(port->port.tty);
1179 kill_traffic(port);
1180 + cancel_work_sync(&port->work);
1181 + device_del(&port->dev);
1182 }
1183 }
1184 + serial->type->shutdown(serial);
1185 + for (i = 0; i < serial->num_ports; ++i) {
1186 + port = serial->port[i];
1187 + if (port) {
1188 + put_device(&port->dev);
1189 + serial->port[i] = NULL;
1190 + }
1191 + }
1192 +
1193 /* let the last holder of this object
1194 * cause it to be cleaned up */
1195 - mutex_unlock(&serial->disc_mutex);
1196 usb_serial_put(serial);
1197 dev_info(dev, "device disconnected\n");
1198 }
1199 diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
1200 index 4cf1617..65115a5 100644
1201 --- a/drivers/usb/storage/unusual_devs.h
1202 +++ b/drivers/usb/storage/unusual_devs.h
1203 @@ -2147,6 +2147,12 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001,
1204 US_SC_DEVICE, US_PR_DEVICE, NULL,
1205 US_FL_CAPACITY_HEURISTICS),
1206
1207 +/* Reported by Alessio Treglia <quadrispro@ubuntu.com> */
1208 +UNUSUAL_DEV( 0xed10, 0x7636, 0x0001, 0x0001,
1209 + "TGE",
1210 + "Digital MP3 Audio Player",
1211 + US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ),
1212 +
1213 /* Control/Bulk transport for all SubClass values */
1214 USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR),
1215 USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR),
1216 diff --git a/fs/proc/array.c b/fs/proc/array.c
1217 index 71c9be5..c0cf3bf 100644
1218 --- a/fs/proc/array.c
1219 +++ b/fs/proc/array.c
1220 @@ -80,6 +80,7 @@
1221 #include <linux/delayacct.h>
1222 #include <linux/seq_file.h>
1223 #include <linux/pid_namespace.h>
1224 +#include <linux/ptrace.h>
1225 #include <linux/tracehook.h>
1226
1227 #include <asm/pgtable.h>
1228 @@ -347,6 +348,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
1229 char state;
1230 pid_t ppid = 0, pgid = -1, sid = -1;
1231 int num_threads = 0;
1232 + int permitted;
1233 struct mm_struct *mm;
1234 unsigned long long start_time;
1235 unsigned long cmin_flt = 0, cmaj_flt = 0;
1236 @@ -359,11 +361,14 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
1237
1238 state = *get_task_state(task);
1239 vsize = eip = esp = 0;
1240 + permitted = ptrace_may_access(task, PTRACE_MODE_READ);
1241 mm = get_task_mm(task);
1242 if (mm) {
1243 vsize = task_vsize(mm);
1244 - eip = KSTK_EIP(task);
1245 - esp = KSTK_ESP(task);
1246 + if (permitted) {
1247 + eip = KSTK_EIP(task);
1248 + esp = KSTK_ESP(task);
1249 + }
1250 }
1251
1252 get_task_comm(tcomm, task);
1253 @@ -419,7 +424,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
1254 unlock_task_sighand(task, &flags);
1255 }
1256
1257 - if (!whole || num_threads < 2)
1258 + if (permitted && (!whole || num_threads < 2))
1259 wchan = get_wchan(task);
1260 if (!whole) {
1261 min_flt = task->min_flt;
1262 @@ -471,7 +476,7 @@ static int do_task_stat(struct seq_file *m, struct pid_namespace *ns,
1263 rsslim,
1264 mm ? mm->start_code : 0,
1265 mm ? mm->end_code : 0,
1266 - mm ? mm->start_stack : 0,
1267 + (permitted && mm) ? mm->start_stack : 0,
1268 esp,
1269 eip,
1270 /* The signal information here is obsolete.
1271 diff --git a/fs/proc/base.c b/fs/proc/base.c
1272 index 0e910b3..a488f61 100644
1273 --- a/fs/proc/base.c
1274 +++ b/fs/proc/base.c
1275 @@ -327,7 +327,10 @@ static int proc_pid_wchan(struct task_struct *task, char *buffer)
1276 wchan = get_wchan(task);
1277
1278 if (lookup_symbol_name(wchan, symname) < 0)
1279 - return sprintf(buffer, "%lu", wchan);
1280 + if (!ptrace_may_access(task, PTRACE_MODE_READ))
1281 + return 0;
1282 + else
1283 + return sprintf(buffer, "%lu", wchan);
1284 else
1285 return sprintf(buffer, "%s", symname);
1286 }
1287 diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
1288 index 8b84227..c7f64a9 100644
1289 --- a/fs/proc/task_mmu.c
1290 +++ b/fs/proc/task_mmu.c
1291 @@ -665,6 +665,10 @@ static ssize_t pagemap_read(struct file *file, char __user *buf,
1292 goto out_task;
1293
1294 ret = 0;
1295 +
1296 + if (!count)
1297 + goto out_task;
1298 +
1299 mm = get_task_mm(task);
1300 if (!mm)
1301 goto out_task;
1302 diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h
1303 index 135bd19..0d97c90 100644
1304 --- a/include/drm/drm_pciids.h
1305 +++ b/include/drm/drm_pciids.h
1306 @@ -412,4 +412,5 @@
1307 {0x8086, 0x2e02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
1308 {0x8086, 0x2e12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
1309 {0x8086, 0x2e22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
1310 + {0x8086, 0x2e32, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
1311 {0, 0, 0}
1312 diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
1313 index df12434..bad22e2 100644
1314 --- a/kernel/time/tick-common.c
1315 +++ b/kernel/time/tick-common.c
1316 @@ -93,7 +93,17 @@ void tick_handle_periodic(struct clock_event_device *dev)
1317 for (;;) {
1318 if (!clockevents_program_event(dev, next, ktime_get()))
1319 return;
1320 - tick_periodic(cpu);
1321 + /*
1322 + * Have to be careful here. If we're in oneshot mode,
1323 + * before we call tick_periodic() in a loop, we need
1324 + * to be sure we're using a real hardware clocksource.
1325 + * Otherwise we could get trapped in an infinite
1326 + * loop, as the tick_periodic() increments jiffies,
1327 + * when then will increment time, posibly causing
1328 + * the loop to trigger again and again.
1329 + */
1330 + if (timekeeping_valid_for_hres())
1331 + tick_periodic(cpu);
1332 next = ktime_add(next, tick_period);
1333 }
1334 }
1335 diff --git a/mm/madvise.c b/mm/madvise.c
1336 index b9ce574..36d6ea2 100644
1337 --- a/mm/madvise.c
1338 +++ b/mm/madvise.c
1339 @@ -112,6 +112,14 @@ static long madvise_willneed(struct vm_area_struct * vma,
1340 if (!file)
1341 return -EBADF;
1342
1343 + /*
1344 + * Page cache readahead assumes page cache pages are order-0 which
1345 + * is not the case for hugetlbfs. Do not give a bad return value
1346 + * but ignore the advice.
1347 + */
1348 + if (vma->vm_flags & VM_HUGETLB)
1349 + return 0;
1350 +
1351 if (file->f_mapping->a_ops->get_xip_mem) {
1352 /* no bad return value, but ignore advice */
1353 return 0;
1354 diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
1355 index 8e0de6a..f05e36a 100644
1356 --- a/scripts/mod/modpost.c
1357 +++ b/scripts/mod/modpost.c
1358 @@ -1997,6 +1997,7 @@ static void read_markers(const char *fname)
1359 if (!mod->skip)
1360 add_marker(mod, marker, fmt);
1361 }
1362 + release_file(file, size);
1363 return;
1364 fail:
1365 fatal("parse error in markers list file\n");