aboutsummaryrefslogtreecommitdiff
path: root/fs/proc
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/proc/proc_sysctl.c11
2 files changed, 11 insertions, 4 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index b5918ae8ca7..486cf3fe713 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1712,9 +1712,9 @@ static struct dentry *proc_fd_instantiate(struct inode *dir,
file = fcheck_files(files, fd);
if (!file)
goto out_unlock;
- if (file->f_mode & 1)
+ if (file->f_mode & FMODE_READ)
inode->i_mode |= S_IRUSR | S_IXUSR;
- if (file->f_mode & 2)
+ if (file->f_mode & FMODE_WRITE)
inode->i_mode |= S_IWUSR | S_IXUSR;
spin_unlock(&files->file_lock);
put_files_struct(files);
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 41b5063e28d..94fcfff6863 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -298,13 +298,19 @@ static int proc_sys_permission(struct inode *inode, int mask)
* sysctl entries that are not writeable,
* are _NOT_ writeable, capabilities or not.
*/
- struct ctl_table_header *head = grab_header(inode);
- struct ctl_table *table = PROC_I(inode)->sysctl_entry;
+ struct ctl_table_header *head;
+ struct ctl_table *table;
int error;
+ /* Executable files are not allowed under /proc/sys/ */
+ if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode))
+ return -EACCES;
+
+ head = grab_header(inode);
if (IS_ERR(head))
return PTR_ERR(head);
+ table = PROC_I(inode)->sysctl_entry;
if (!table) /* global root - r-xr-xr-x */
error = mask & MAY_WRITE ? -EACCES : 0;
else /* Use the permissions on the sysctl table entry */
@@ -353,6 +359,7 @@ static const struct file_operations proc_sys_file_operations = {
static const struct file_operations proc_sys_dir_file_operations = {
.readdir = proc_sys_readdir,
+ .llseek = generic_file_llseek,
};
static const struct inode_operations proc_sys_inode_operations = {