diff options
| author | Chris Wright <chrisw@osdl.org> | 2004-07-02 04:48:26 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-07-02 04:48:26 -0700 |
| commit | 9da9210dbc752cf35fa2fe866614a1d5b1266066 (patch) | |
| tree | 63655541650e1f863eaa52a9743c80d53c785df4 | |
| parent | 4e58aec80c31fabdf2704cb54cd28500aeb02146 (diff) | |
[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: Chris Wright <chrisw@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
| -rw-r--r-- | fs/proc/generic.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index b16a42d5f682..72febc00fa3b 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c @@ -231,14 +231,21 @@ out: 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; } |
