Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 9040
b: refs/heads/master
c: 4fb3a53
h: refs/heads/master
v: v3
  • Loading branch information
Dipankar Sarma authored and Linus Torvalds committed Sep 17, 2005
1 parent cab2458 commit 30b0c41
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: af4e5a218e18ad588d60a4f9d6f8fb5db1a32587
refs/heads/master: 4fb3a53860cee2aaaf81186c451b7da0b95b45c1
7 changes: 6 additions & 1 deletion trunk/arch/alpha/kernel/osf_sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <linux/namei.h>
#include <linux/uio.h>
#include <linux/vfs.h>
#include <linux/rcupdate.h>

#include <asm/fpu.h>
#include <asm/io.h>
Expand Down Expand Up @@ -975,6 +976,7 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
long timeout;
int ret = -EINVAL;
struct fdtable *fdt;
int max_fdset;

timeout = MAX_SCHEDULE_TIMEOUT;
if (tvp) {
Expand All @@ -996,8 +998,11 @@ osf_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp,
}
}

rcu_read_lock();
fdt = files_fdtable(current->files);
if (n < 0 || n > fdt->max_fdset)
max_fdset = fdt->max_fdset;
rcu_read_unlock();
if (n < 0 || n > max_fdset)
goto out_nofds;

/*
Expand Down
3 changes: 2 additions & 1 deletion trunk/arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,12 +2218,13 @@ static void
pfm_free_fd(int fd, struct file *file)
{
struct files_struct *files = current->files;
struct fdtable *fdt = files_fdtable(files);
struct fdtable *fdt;

/*
* there ie no fd_uninstall(), so we do it here
*/
spin_lock(&files->file_lock);
fdt = files_fdtable(files);
rcu_assign_pointer(fdt->fd[fd], NULL);
spin_unlock(&files->file_lock);

Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
#include <linux/smp_lock.h>
#include <linux/syscalls.h>
#include <linux/time.h>
#include <linux/rcupdate.h>

#include <asm/semaphore.h>
#include <asm/uaccess.h>
Expand Down Expand Up @@ -2205,6 +2206,7 @@ void steal_locks(fl_owner_t from)

lock_kernel();
j = 0;
rcu_read_lock();
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
Expand All @@ -2222,6 +2224,7 @@ void steal_locks(fl_owner_t from)
set >>= 1;
}
}
rcu_read_unlock();
unlock_kernel();
}
EXPORT_SYMBOL(steal_locks);
Expand Down
3 changes: 3 additions & 0 deletions trunk/fs/proc/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include <linux/file.h>
#include <linux/times.h>
#include <linux/cpuset.h>
#include <linux/rcupdate.h>

#include <asm/uaccess.h>
#include <asm/pgtable.h>
Expand Down Expand Up @@ -180,12 +181,14 @@ static inline char * task_state(struct task_struct *p, char *buffer)
p->gid, p->egid, p->sgid, p->fsgid);
read_unlock(&tasklist_lock);
task_lock(p);
rcu_read_lock();
if (p->files)
fdt = files_fdtable(p->files);
buffer += sprintf(buffer,
"FDSize:\t%d\n"
"Groups:\t",
fdt ? fdt->max_fds : 0);
rcu_read_unlock();

group_info = p->group_info;
get_group_info(group_info);
Expand Down
6 changes: 6 additions & 0 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,12 @@ static inline void close_files(struct files_struct * files)
struct fdtable *fdt;

j = 0;

/*
* It is safe to dereference the fd table without RCU or
* ->file_lock because this is the last reference to the
* files structure.
*/
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
Expand Down

0 comments on commit 30b0c41

Please sign in to comment.