diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-21 18:41:25 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-29 23:28:30 -0400 |
commit | 7449af1e8b795abf4ef829ac507861f34dca30b4 (patch) | |
tree | 5c27e6730c2b314cfc75322e4919212aa4b1969a /fs/xattr.c | |
parent | 863ced7fe762f80e67bc9171e47c7d80032cce12 (diff) |
switch xattr syscalls to fget_light/fput_light
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xattr.c')
-rw-r--r-- | fs/xattr.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/fs/xattr.c b/fs/xattr.c index 3c8c1cc333c7..1d7ac3790458 100644 --- a/fs/xattr.c +++ b/fs/xattr.c | |||
@@ -399,11 +399,12 @@ SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname, | |||
399 | SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, | 399 | SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, |
400 | const void __user *,value, size_t, size, int, flags) | 400 | const void __user *,value, size_t, size, int, flags) |
401 | { | 401 | { |
402 | int fput_needed; | ||
402 | struct file *f; | 403 | struct file *f; |
403 | struct dentry *dentry; | 404 | struct dentry *dentry; |
404 | int error = -EBADF; | 405 | int error = -EBADF; |
405 | 406 | ||
406 | f = fget(fd); | 407 | f = fget_light(fd, &fput_needed); |
407 | if (!f) | 408 | if (!f) |
408 | return error; | 409 | return error; |
409 | dentry = f->f_path.dentry; | 410 | dentry = f->f_path.dentry; |
@@ -413,7 +414,7 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name, | |||
413 | error = setxattr(dentry, name, value, size, flags); | 414 | error = setxattr(dentry, name, value, size, flags); |
414 | mnt_drop_write_file(f); | 415 | mnt_drop_write_file(f); |
415 | } | 416 | } |
416 | fput(f); | 417 | fput_light(f, fput_needed); |
417 | return error; | 418 | return error; |
418 | } | 419 | } |
419 | 420 | ||
@@ -486,15 +487,16 @@ SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname, | |||
486 | SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, | 487 | SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name, |
487 | void __user *, value, size_t, size) | 488 | void __user *, value, size_t, size) |
488 | { | 489 | { |
490 | int fput_needed; | ||
489 | struct file *f; | 491 | struct file *f; |
490 | ssize_t error = -EBADF; | 492 | ssize_t error = -EBADF; |
491 | 493 | ||
492 | f = fget(fd); | 494 | f = fget_light(fd, &fput_needed); |
493 | if (!f) | 495 | if (!f) |
494 | return error; | 496 | return error; |
495 | audit_inode(NULL, f->f_path.dentry); | 497 | audit_inode(NULL, f->f_path.dentry); |
496 | error = getxattr(f->f_path.dentry, name, value, size); | 498 | error = getxattr(f->f_path.dentry, name, value, size); |
497 | fput(f); | 499 | fput_light(f, fput_needed); |
498 | return error; | 500 | return error; |
499 | } | 501 | } |
500 | 502 | ||
@@ -566,15 +568,16 @@ SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list, | |||
566 | 568 | ||
567 | SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) | 569 | SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size) |
568 | { | 570 | { |
571 | int fput_needed; | ||
569 | struct file *f; | 572 | struct file *f; |
570 | ssize_t error = -EBADF; | 573 | ssize_t error = -EBADF; |
571 | 574 | ||
572 | f = fget(fd); | 575 | f = fget_light(fd, &fput_needed); |
573 | if (!f) | 576 | if (!f) |
574 | return error; | 577 | return error; |
575 | audit_inode(NULL, f->f_path.dentry); | 578 | audit_inode(NULL, f->f_path.dentry); |
576 | error = listxattr(f->f_path.dentry, list, size); | 579 | error = listxattr(f->f_path.dentry, list, size); |
577 | fput(f); | 580 | fput_light(f, fput_needed); |
578 | return error; | 581 | return error; |
579 | } | 582 | } |
580 | 583 | ||
@@ -634,11 +637,12 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname, | |||
634 | 637 | ||
635 | SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) | 638 | SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) |
636 | { | 639 | { |
640 | int fput_needed; | ||
637 | struct file *f; | 641 | struct file *f; |
638 | struct dentry *dentry; | 642 | struct dentry *dentry; |
639 | int error = -EBADF; | 643 | int error = -EBADF; |
640 | 644 | ||
641 | f = fget(fd); | 645 | f = fget_light(fd, &fput_needed); |
642 | if (!f) | 646 | if (!f) |
643 | return error; | 647 | return error; |
644 | dentry = f->f_path.dentry; | 648 | dentry = f->f_path.dentry; |
@@ -648,7 +652,7 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name) | |||
648 | error = removexattr(dentry, name); | 652 | error = removexattr(dentry, name); |
649 | mnt_drop_write_file(f); | 653 | mnt_drop_write_file(f); |
650 | } | 654 | } |
651 | fput(f); | 655 | fput_light(f, fput_needed); |
652 | return error; | 656 | return error; |
653 | } | 657 | } |
654 | 658 | ||