aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/namei.c11
-rw-r--r--fs/open.c8
-rw-r--r--fs/xattr.c11
3 files changed, 22 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 712dfc77793b..98dc2e134362 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1353,6 +1353,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
1353 return -ENOENT; 1353 return -ENOENT;
1354 1354
1355 BUG_ON(victim->d_parent->d_inode != dir); 1355 BUG_ON(victim->d_parent->d_inode != dir);
1356 audit_inode_child(victim->d_name.name, victim->d_inode, dir->i_ino);
1356 1357
1357 error = permission(dir,MAY_WRITE | MAY_EXEC, NULL); 1358 error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
1358 if (error) 1359 if (error)
@@ -1472,7 +1473,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1472 DQUOT_INIT(dir); 1473 DQUOT_INIT(dir);
1473 error = dir->i_op->create(dir, dentry, mode, nd); 1474 error = dir->i_op->create(dir, dentry, mode, nd);
1474 if (!error) 1475 if (!error)
1475 fsnotify_create(dir, dentry->d_name.name); 1476 fsnotify_create(dir, dentry);
1476 return error; 1477 return error;
1477} 1478}
1478 1479
@@ -1799,7 +1800,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1799 DQUOT_INIT(dir); 1800 DQUOT_INIT(dir);
1800 error = dir->i_op->mknod(dir, dentry, mode, dev); 1801 error = dir->i_op->mknod(dir, dentry, mode, dev);
1801 if (!error) 1802 if (!error)
1802 fsnotify_create(dir, dentry->d_name.name); 1803 fsnotify_create(dir, dentry);
1803 return error; 1804 return error;
1804} 1805}
1805 1806
@@ -1876,7 +1877,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1876 DQUOT_INIT(dir); 1877 DQUOT_INIT(dir);
1877 error = dir->i_op->mkdir(dir, dentry, mode); 1878 error = dir->i_op->mkdir(dir, dentry, mode);
1878 if (!error) 1879 if (!error)
1879 fsnotify_mkdir(dir, dentry->d_name.name); 1880 fsnotify_mkdir(dir, dentry);
1880 return error; 1881 return error;
1881} 1882}
1882 1883
@@ -2139,7 +2140,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, i
2139 DQUOT_INIT(dir); 2140 DQUOT_INIT(dir);
2140 error = dir->i_op->symlink(dir, dentry, oldname); 2141 error = dir->i_op->symlink(dir, dentry, oldname);
2141 if (!error) 2142 if (!error)
2142 fsnotify_create(dir, dentry->d_name.name); 2143 fsnotify_create(dir, dentry);
2143 return error; 2144 return error;
2144} 2145}
2145 2146
@@ -2216,7 +2217,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2216 error = dir->i_op->link(old_dentry, dir, new_dentry); 2217 error = dir->i_op->link(old_dentry, dir, new_dentry);
2217 mutex_unlock(&old_dentry->d_inode->i_mutex); 2218 mutex_unlock(&old_dentry->d_inode->i_mutex);
2218 if (!error) 2219 if (!error)
2219 fsnotify_create(dir, new_dentry->d_name.name); 2220 fsnotify_create(dir, new_dentry);
2220 return error; 2221 return error;
2221} 2222}
2222 2223
diff --git a/fs/open.c b/fs/open.c
index 7d02d19bd0a2..c32c89d6d8db 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -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;
diff --git a/fs/xattr.c b/fs/xattr.c
index 80eca7d3d69f..e416190f5e9c 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -17,6 +17,7 @@
17#include <linux/syscalls.h> 17#include <linux/syscalls.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/fsnotify.h> 19#include <linux/fsnotify.h>
20#include <linux/audit.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21 22
22 23
@@ -234,12 +235,15 @@ sys_fsetxattr(int fd, char __user *name, void __user *value,
234 size_t size, int flags) 235 size_t size, int flags)
235{ 236{
236 struct file *f; 237 struct file *f;
238 struct dentry *dentry;
237 int error = -EBADF; 239 int error = -EBADF;
238 240
239 f = fget(fd); 241 f = fget(fd);
240 if (!f) 242 if (!f)
241 return error; 243 return error;
242 error = setxattr(f->f_dentry, name, value, size, flags); 244 dentry = f->f_dentry;
245 audit_inode(NULL, dentry->d_inode, 0);
246 error = setxattr(dentry, name, value, size, flags);
243 fput(f); 247 fput(f);
244 return error; 248 return error;
245} 249}
@@ -458,12 +462,15 @@ asmlinkage long
458sys_fremovexattr(int fd, char __user *name) 462sys_fremovexattr(int fd, char __user *name)
459{ 463{
460 struct file *f; 464 struct file *f;
465 struct dentry *dentry;
461 int error = -EBADF; 466 int error = -EBADF;
462 467
463 f = fget(fd); 468 f = fget(fd);
464 if (!f) 469 if (!f)
465 return error; 470 return error;
466 error = removexattr(f->f_dentry, name); 471 dentry = f->f_dentry;
472 audit_inode(NULL, dentry->d_inode, 0);
473 error = removexattr(dentry, name);
467 fput(f); 474 fput(f);
468 return error; 475 return error;
469} 476}