@@ -697,9 +697,9 @@ SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
697
697
int error ;
698
698
699
699
CLASS (fd , f )(fd );
700
- if (!fd_file (f ))
701
- return - EBADF ;
702
700
701
+ if (fd_empty (f ))
702
+ return - EBADF ;
703
703
audit_file (fd_file (f ));
704
704
error = setxattr_copy (name , & ctx );
705
705
if (error )
@@ -809,16 +809,13 @@ SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
809
809
SYSCALL_DEFINE4 (fgetxattr , int , fd , const char __user * , name ,
810
810
void __user * , value , size_t , size )
811
811
{
812
- struct fd f = fdget (fd );
813
- ssize_t error = - EBADF ;
812
+ CLASS (fd , f )(fd );
814
813
815
- if (! fd_file (f ))
816
- return error ;
814
+ if (fd_empty (f ))
815
+ return - EBADF ;
817
816
audit_file (fd_file (f ));
818
- error = getxattr (file_mnt_idmap (fd_file (f )), fd_file (f )-> f_path .dentry ,
817
+ return getxattr (file_mnt_idmap (fd_file (f )), fd_file (f )-> f_path .dentry ,
819
818
name , value , size );
820
- fdput (f );
821
- return error ;
822
819
}
823
820
824
821
/*
@@ -885,15 +882,12 @@ SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
885
882
886
883
SYSCALL_DEFINE3 (flistxattr , int , fd , char __user * , list , size_t , size )
887
884
{
888
- struct fd f = fdget (fd );
889
- ssize_t error = - EBADF ;
885
+ CLASS (fd , f )(fd );
890
886
891
- if (! fd_file (f ))
892
- return error ;
887
+ if (fd_empty (f ))
888
+ return - EBADF ;
893
889
audit_file (fd_file (f ));
894
- error = listxattr (fd_file (f )-> f_path .dentry , list , size );
895
- fdput (f );
896
- return error ;
890
+ return listxattr (fd_file (f )-> f_path .dentry , list , size );
897
891
}
898
892
899
893
/*
@@ -950,12 +944,12 @@ SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
950
944
951
945
SYSCALL_DEFINE2 (fremovexattr , int , fd , const char __user * , name )
952
946
{
953
- struct fd f = fdget (fd );
947
+ CLASS ( fd , f ) (fd );
954
948
char kname [XATTR_NAME_MAX + 1 ];
955
- int error = - EBADF ;
949
+ int error ;
956
950
957
- if (! fd_file (f ))
958
- return error ;
951
+ if (fd_empty (f ))
952
+ return - EBADF ;
959
953
audit_file (fd_file (f ));
960
954
961
955
error = strncpy_from_user (kname , name , sizeof (kname ));
@@ -970,7 +964,6 @@ SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
970
964
fd_file (f )-> f_path .dentry , kname );
971
965
mnt_drop_write_file (fd_file (f ));
972
966
}
973
- fdput (f );
974
967
return error ;
975
968
}
976
969
0 commit comments