Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90951
b: refs/heads/master
c: 18f335a
h: refs/heads/master
i:
  90949: f0fcf2b
  90947: a5f90e4
  90943: 873d820
v: v3
  • Loading branch information
Dave Hansen authored and Al Viro committed Apr 19, 2008
1 parent ec19ba1 commit 2cee23f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9079b1eb1753f217c3de9f1b7dd7fd549cc3f0cf
refs/heads/master: 18f335aff86913de3c76f88d32c8135c1da62ce6
7 changes: 6 additions & 1 deletion trunk/fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,19 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
return status;
}
}
status = mnt_want_write(cstate->current_fh.fh_export->ex_path.mnt);
if (status)
return status;
status = nfs_ok;
if (setattr->sa_acl != NULL)
status = nfsd4_set_nfs4_acl(rqstp, &cstate->current_fh,
setattr->sa_acl);
if (status)
return status;
goto out;
status = nfsd_setattr(rqstp, &cstate->current_fh, &setattr->sa_iattr,
0, (time_t)0);
out:
mnt_drop_write(cstate->current_fh.fh_export->ex_path.mnt);
return status;
}

Expand Down
4 changes: 4 additions & 0 deletions trunk/fs/nfsd/vfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2086,6 +2086,9 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
} else
size = 0;

error = mnt_want_write(fhp->fh_export->ex_path.mnt);
if (error)
goto getout;
if (size)
error = vfs_setxattr(fhp->fh_dentry, name, value, size, 0);
else {
Expand All @@ -2097,6 +2100,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
error = 0;
}
}
mnt_drop_write(fhp->fh_export->ex_path.mnt);

getout:
kfree(value);
Expand Down
40 changes: 32 additions & 8 deletions trunk/fs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/xattr.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/security.h>
#include <linux/syscalls.h>
Expand All @@ -32,8 +33,6 @@ xattr_permission(struct inode *inode, const char *name, int mask)
* filesystem or on an immutable / append-only inode.
*/
if (mask & MAY_WRITE) {
if (IS_RDONLY(inode))
return -EROFS;
if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
return -EPERM;
}
Expand Down Expand Up @@ -262,7 +261,11 @@ sys_setxattr(char __user *path, char __user *name, void __user *value,
error = user_path_walk(path, &nd);
if (error)
return error;
error = setxattr(nd.path.dentry, name, value, size, flags);
error = mnt_want_write(nd.path.mnt);
if (!error) {
error = setxattr(nd.path.dentry, name, value, size, flags);
mnt_drop_write(nd.path.mnt);
}
path_put(&nd.path);
return error;
}
Expand All @@ -277,7 +280,11 @@ sys_lsetxattr(char __user *path, char __user *name, void __user *value,
error = user_path_walk_link(path, &nd);
if (error)
return error;
error = setxattr(nd.path.dentry, name, value, size, flags);
error = mnt_want_write(nd.path.mnt);
if (!error) {
error = setxattr(nd.path.dentry, name, value, size, flags);
mnt_drop_write(nd.path.mnt);
}
path_put(&nd.path);
return error;
}
Expand All @@ -295,7 +302,12 @@ sys_fsetxattr(int fd, char __user *name, void __user *value,
return error;
dentry = f->f_path.dentry;
audit_inode(NULL, dentry);
error = setxattr(dentry, name, value, size, flags);
error = mnt_want_write(f->f_path.mnt);
if (!error) {
error = setxattr(dentry, name, value, size, flags);
mnt_drop_write(f->f_path.mnt);
}
out_fput:
fput(f);
return error;
}
Expand Down Expand Up @@ -482,7 +494,11 @@ sys_removexattr(char __user *path, char __user *name)
error = user_path_walk(path, &nd);
if (error)
return error;
error = removexattr(nd.path.dentry, name);
error = mnt_want_write(nd.path.mnt);
if (!error) {
error = removexattr(nd.path.dentry, name);
mnt_drop_write(nd.path.mnt);
}
path_put(&nd.path);
return error;
}
Expand All @@ -496,7 +512,11 @@ sys_lremovexattr(char __user *path, char __user *name)
error = user_path_walk_link(path, &nd);
if (error)
return error;
error = removexattr(nd.path.dentry, name);
error = mnt_want_write(nd.path.mnt);
if (!error) {
error = removexattr(nd.path.dentry, name);
mnt_drop_write(nd.path.mnt);
}
path_put(&nd.path);
return error;
}
Expand All @@ -513,7 +533,11 @@ sys_fremovexattr(int fd, char __user *name)
return error;
dentry = f->f_path.dentry;
audit_inode(NULL, dentry);
error = removexattr(dentry, name);
error = mnt_want_write(f->f_path.mnt);
if (!error) {
error = removexattr(dentry, name);
mnt_drop_write(f->f_path.mnt);
}
fput(f);
return error;
}
Expand Down

0 comments on commit 2cee23f

Please sign in to comment.