aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xattr.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-10-31 17:44:57 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-11-19 13:01:26 -0500
commit9f45f5bf302daad6835ce64701fb3c286a2cc6af (patch)
treef267e8363c8c9db15195f1698997179a1370687c /fs/xattr.c
parent6f4e0d5aaa9efaa701f4c3c0bb9b22d7943157c9 (diff)
new helper: audit_file()
... for situations when we don't have any candidate in pathnames - basically, in descriptor-based syscalls. [Folded the build fix for !CONFIG_AUDITSYSCALL configs from Chen Gang] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r--fs/xattr.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/xattr.c b/fs/xattr.c
index 64e83efb742d..4ef698549e31 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -405,16 +405,14 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
405 const void __user *,value, size_t, size, int, flags) 405 const void __user *,value, size_t, size, int, flags)
406{ 406{
407 struct fd f = fdget(fd); 407 struct fd f = fdget(fd);
408 struct dentry *dentry;
409 int error = -EBADF; 408 int error = -EBADF;
410 409
411 if (!f.file) 410 if (!f.file)
412 return error; 411 return error;
413 dentry = f.file->f_path.dentry; 412 audit_file(f.file);
414 audit_inode(NULL, dentry, 0);
415 error = mnt_want_write_file(f.file); 413 error = mnt_want_write_file(f.file);
416 if (!error) { 414 if (!error) {
417 error = setxattr(dentry, name, value, size, flags); 415 error = setxattr(f.file->f_path.dentry, name, value, size, flags);
418 mnt_drop_write_file(f.file); 416 mnt_drop_write_file(f.file);
419 } 417 }
420 fdput(f); 418 fdput(f);
@@ -509,7 +507,7 @@ SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
509 507
510 if (!f.file) 508 if (!f.file)
511 return error; 509 return error;
512 audit_inode(NULL, f.file->f_path.dentry, 0); 510 audit_file(f.file);
513 error = getxattr(f.file->f_path.dentry, name, value, size); 511 error = getxattr(f.file->f_path.dentry, name, value, size);
514 fdput(f); 512 fdput(f);
515 return error; 513 return error;
@@ -590,7 +588,7 @@ SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
590 588
591 if (!f.file) 589 if (!f.file)
592 return error; 590 return error;
593 audit_inode(NULL, f.file->f_path.dentry, 0); 591 audit_file(f.file);
594 error = listxattr(f.file->f_path.dentry, list, size); 592 error = listxattr(f.file->f_path.dentry, list, size);
595 fdput(f); 593 fdput(f);
596 return error; 594 return error;
@@ -651,16 +649,14 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
651SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) 649SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
652{ 650{
653 struct fd f = fdget(fd); 651 struct fd f = fdget(fd);
654 struct dentry *dentry;
655 int error = -EBADF; 652 int error = -EBADF;
656 653
657 if (!f.file) 654 if (!f.file)
658 return error; 655 return error;
659 dentry = f.file->f_path.dentry; 656 audit_file(f.file);
660 audit_inode(NULL, dentry, 0);
661 error = mnt_want_write_file(f.file); 657 error = mnt_want_write_file(f.file);
662 if (!error) { 658 if (!error) {
663 error = removexattr(dentry, name); 659 error = removexattr(f.file->f_path.dentry, name);
664 mnt_drop_write_file(f.file); 660 mnt_drop_write_file(f.file);
665 } 661 }
666 fdput(f); 662 fdput(f);