aboutsummaryrefslogtreecommitdiffstats
path: root/fs/open.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/open.c')
-rw-r--r--fs/open.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/open.c b/fs/open.c
index b6542516a0ca..2fac58c51910 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -24,6 +24,7 @@
24#include <linux/personality.h> 24#include <linux/personality.h>
25#include <linux/pagemap.h> 25#include <linux/pagemap.h>
26#include <linux/syscalls.h> 26#include <linux/syscalls.h>
27#include <linux/rcupdate.h>
27 28
28#include <asm/unistd.h> 29#include <asm/unistd.h>
29 30
@@ -930,9 +931,8 @@ void fastcall fd_install(unsigned int fd, struct file * file)
930 struct fdtable *fdt; 931 struct fdtable *fdt;
931 spin_lock(&files->file_lock); 932 spin_lock(&files->file_lock);
932 fdt = files_fdtable(files); 933 fdt = files_fdtable(files);
933 if (unlikely(fdt->fd[fd] != NULL)) 934 BUG_ON(fdt->fd[fd] != NULL);
934 BUG(); 935 rcu_assign_pointer(fdt->fd[fd], file);
935 fdt->fd[fd] = file;
936 spin_unlock(&files->file_lock); 936 spin_unlock(&files->file_lock);
937} 937}
938 938
@@ -1024,7 +1024,7 @@ asmlinkage long sys_close(unsigned int fd)
1024 filp = fdt->fd[fd]; 1024 filp = fdt->fd[fd];
1025 if (!filp) 1025 if (!filp)
1026 goto out_unlock; 1026 goto out_unlock;
1027 fdt->fd[fd] = NULL; 1027 rcu_assign_pointer(fdt->fd[fd], NULL);
1028 FD_CLR(fd, fdt->close_on_exec); 1028 FD_CLR(fd, fdt->close_on_exec);
1029 __put_unused_fd(files, fd); 1029 __put_unused_fd(files, fd);
1030 spin_unlock(&files->file_lock); 1030 spin_unlock(&files->file_lock);