Commit 9da9210d authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds

[PATCH] check attr updates in /proc

Any proc entry with default proc_file_inode_operations allow unauthorized
attribute updates.  This is very dangerous for proc entries that rely
solely on file permissions for open/read/write.
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 4e58aec8
......@@ -231,14 +231,21 @@ proc_file_lseek(struct file *file, loff_t offset, int orig)
static int proc_notify_change(struct dentry *dentry, struct iattr *iattr)
{
struct inode *inode = dentry->d_inode;
int error = inode_setattr(inode, iattr);
if (!error) {
struct proc_dir_entry *de = PDE(inode);
de->uid = inode->i_uid;
de->gid = inode->i_gid;
de->mode = inode->i_mode;
}
struct proc_dir_entry *de = PDE(inode);
int error;
error = inode_change_ok(inode, iattr);
if (error)
goto out;
error = inode_setattr(inode, iattr);
if (error)
goto out;
de->uid = inode->i_uid;
de->gid = inode->i_gid;
de->mode = inode->i_mode;
out:
return error;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment