diff options
author | Dipankar Sarma <dipankar@in.ibm.com> | 2005-09-16 22:28:13 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-17 14:50:02 -0400 |
commit | 4fb3a53860cee2aaaf81186c451b7da0b95b45c1 (patch) | |
tree | db66ba7d3886644729707586aed781c445e12c16 /arch | |
parent | af4e5a218e18ad588d60a4f9d6f8fb5db1a32587 (diff) |
[PATCH] files: fix preemption issues
With the new fdtable locking rules, you have to protect fdtable with either
->file_lock or rcu_read_lock/unlock(). There are some places where we
aren't doing either. This patch fixes those places.
Signed-off-by: Dipankar Sarma <dipankar@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/osf_sys.c | 7 | ||||
-rw-r--r-- | arch/ia64/kernel/perfmon.c | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 0636116210d2..01fe990d3e54 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/namei.h> | 37 | #include <linux/namei.h> |
38 | #include <linux/uio.h> | 38 | #include <linux/uio.h> |
39 | #include <linux/vfs.h> | 39 | #include <linux/vfs.h> |
40 | #include <linux/rcupdate.h> | ||
40 | 41 | ||
41 | #include <asm/fpu.h> | 42 | #include <asm/fpu.h> |
42 | #include <asm/io.h> | 43 | #include <asm/io.h> |
@@ -975,6 +976,7 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, | |||
975 | long timeout; | 976 | long timeout; |
976 | int ret = -EINVAL; | 977 | int ret = -EINVAL; |
977 | struct fdtable *fdt; | 978 | struct fdtable *fdt; |
979 | int max_fdset; | ||
978 | 980 | ||
979 | timeout = MAX_SCHEDULE_TIMEOUT; | 981 | timeout = MAX_SCHEDULE_TIMEOUT; |
980 | if (tvp) { | 982 | if (tvp) { |
@@ -996,8 +998,11 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, | |||
996 | } | 998 | } |
997 | } | 999 | } |
998 | 1000 | ||
1001 | rcu_read_lock(); | ||
999 | fdt = files_fdtable(current->files); | 1002 | fdt = files_fdtable(current->files); |
1000 | if (n < 0 || n > fdt->max_fdset) | 1003 | max_fdset = fdt->max_fdset; |
1004 | rcu_read_unlock(); | ||
1005 | if (n < 0 || n > max_fdset) | ||
1001 | goto out_nofds; | 1006 | goto out_nofds; |
1002 | 1007 | ||
1003 | /* | 1008 | /* |
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c index af42cda6be80..d71731ee5b61 100644 --- a/arch/ia64/kernel/perfmon.c +++ b/arch/ia64/kernel/perfmon.c | |||
@@ -2218,12 +2218,13 @@ static void | |||
2218 | pfm_free_fd(int fd, struct file *file) | 2218 | pfm_free_fd(int fd, struct file *file) |
2219 | { | 2219 | { |
2220 | struct files_struct *files = current->files; | 2220 | struct files_struct *files = current->files; |
2221 | struct fdtable *fdt = files_fdtable(files); | 2221 | struct fdtable *fdt; |
2222 | 2222 | ||
2223 | /* | 2223 | /* |
2224 | * there ie no fd_uninstall(), so we do it here | 2224 | * there ie no fd_uninstall(), so we do it here |
2225 | */ | 2225 | */ |
2226 | spin_lock(&files->file_lock); | 2226 | spin_lock(&files->file_lock); |
2227 | fdt = files_fdtable(files); | ||
2227 | rcu_assign_pointer(fdt->fd[fd], NULL); | 2228 | rcu_assign_pointer(fdt->fd[fd], NULL); |
2228 | spin_unlock(&files->file_lock); | 2229 | spin_unlock(&files->file_lock); |
2229 | 2230 | ||