diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-03-29 19:58:22 -0500 | 
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-03-29 19:58:22 -0500 | 
| commit | 79072f38909e3d9883317238887460c39ddcc4cb (patch) | |
| tree | 28369f5a844535ff836565eefd62695b0e890fa3 /fs/open.c | |
| parent | 200d5a7684cc49ef4be40e832daf3f217e70dfbb (diff) | |
| parent | 55d8ca4f8094246da6e71889a4e04bfafaa78b10 (diff) | |
Merge branch 'upstream'
Diffstat (limited to 'fs/open.c')
| -rw-r--r-- | fs/open.c | 20 | 
1 files changed, 15 insertions, 5 deletions
| @@ -27,6 +27,7 @@ | |||
| 27 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> | 
| 28 | #include <linux/syscalls.h> | 28 | #include <linux/syscalls.h> | 
| 29 | #include <linux/rcupdate.h> | 29 | #include <linux/rcupdate.h> | 
| 30 | #include <linux/audit.h> | ||
| 30 | 31 | ||
| 31 | #include <asm/unistd.h> | 32 | #include <asm/unistd.h> | 
| 32 | 33 | ||
| @@ -626,6 +627,8 @@ asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) | |||
| 626 | dentry = file->f_dentry; | 627 | dentry = file->f_dentry; | 
| 627 | inode = dentry->d_inode; | 628 | inode = dentry->d_inode; | 
| 628 | 629 | ||
| 630 | audit_inode(NULL, inode, 0); | ||
| 631 | |||
| 629 | err = -EROFS; | 632 | err = -EROFS; | 
| 630 | if (IS_RDONLY(inode)) | 633 | if (IS_RDONLY(inode)) | 
| 631 | goto out_putf; | 634 | goto out_putf; | 
| @@ -775,7 +778,10 @@ asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group) | |||
| 775 | 778 | ||
| 776 | file = fget(fd); | 779 | file = fget(fd); | 
| 777 | if (file) { | 780 | if (file) { | 
| 778 | error = chown_common(file->f_dentry, user, group); | 781 | struct dentry * dentry; | 
| 782 | dentry = file->f_dentry; | ||
| 783 | audit_inode(NULL, dentry->d_inode, 0); | ||
| 784 | error = chown_common(dentry, user, group); | ||
| 779 | fput(file); | 785 | fput(file); | 
| 780 | } | 786 | } | 
| 781 | return error; | 787 | return error; | 
| @@ -890,6 +896,10 @@ EXPORT_SYMBOL(filp_open); | |||
| 890 | * a fully instantiated struct file to the caller. | 896 | * a fully instantiated struct file to the caller. | 
| 891 | * This function is meant to be called from within a filesystem's | 897 | * This function is meant to be called from within a filesystem's | 
| 892 | * lookup method. | 898 | * lookup method. | 
| 899 | * Beware of calling it for non-regular files! Those ->open methods might block | ||
| 900 | * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo, | ||
| 901 | * leading to a deadlock, as nobody can open that fifo anymore, because | ||
| 902 | * another process to open fifo will block on locked parent when doing lookup). | ||
| 893 | * Note that in case of error, nd->intent.open.file is destroyed, but the | 903 | * Note that in case of error, nd->intent.open.file is destroyed, but the | 
| 894 | * path information remains valid. | 904 | * path information remains valid. | 
| 895 | * If the open callback is set to NULL, then the standard f_op->open() | 905 | * If the open callback is set to NULL, then the standard f_op->open() | 
| @@ -973,7 +983,7 @@ repeat: | |||
| 973 | fdt = files_fdtable(files); | 983 | fdt = files_fdtable(files); | 
| 974 | fd = find_next_zero_bit(fdt->open_fds->fds_bits, | 984 | fd = find_next_zero_bit(fdt->open_fds->fds_bits, | 
| 975 | fdt->max_fdset, | 985 | fdt->max_fdset, | 
| 976 | fdt->next_fd); | 986 | files->next_fd); | 
| 977 | 987 | ||
| 978 | /* | 988 | /* | 
| 979 | * N.B. For clone tasks sharing a files structure, this test | 989 | * N.B. For clone tasks sharing a files structure, this test | 
| @@ -998,7 +1008,7 @@ repeat: | |||
| 998 | 1008 | ||
| 999 | FD_SET(fd, fdt->open_fds); | 1009 | FD_SET(fd, fdt->open_fds); | 
| 1000 | FD_CLR(fd, fdt->close_on_exec); | 1010 | FD_CLR(fd, fdt->close_on_exec); | 
| 1001 | fdt->next_fd = fd + 1; | 1011 | files->next_fd = fd + 1; | 
| 1002 | #if 1 | 1012 | #if 1 | 
| 1003 | /* Sanity check */ | 1013 | /* Sanity check */ | 
| 1004 | if (fdt->fd[fd] != NULL) { | 1014 | if (fdt->fd[fd] != NULL) { | 
| @@ -1019,8 +1029,8 @@ static void __put_unused_fd(struct files_struct *files, unsigned int fd) | |||
| 1019 | { | 1029 | { | 
| 1020 | struct fdtable *fdt = files_fdtable(files); | 1030 | struct fdtable *fdt = files_fdtable(files); | 
| 1021 | __FD_CLR(fd, fdt->open_fds); | 1031 | __FD_CLR(fd, fdt->open_fds); | 
| 1022 | if (fd < fdt->next_fd) | 1032 | if (fd < files->next_fd) | 
| 1023 | fdt->next_fd = fd; | 1033 | files->next_fd = fd; | 
| 1024 | } | 1034 | } | 
| 1025 | 1035 | ||
| 1026 | void fastcall put_unused_fd(unsigned int fd) | 1036 | void fastcall put_unused_fd(unsigned int fd) | 
