Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352899
b: refs/heads/master
c: c2132c1
h: refs/heads/master
i:
  352897: 3fc4d87
  352895: e61a585
v: v3
  • Loading branch information
Anatol Pomozov authored and Miklos Szeredi committed Jan 31, 2013
1 parent 46a5cbf commit 9acbcf6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 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: fb05f41f5f96f7423c53da4d87913fb44fd0565d
refs/heads/master: c2132c1bc73d9a279cec148f74ea709c960b3d89
22 changes: 9 additions & 13 deletions trunk/fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,

/*
* Calling into a user-controlled filesystem gives the filesystem
* daemon ptrace-like capabilities over the requester process. This
* daemon ptrace-like capabilities over the current process. This
* means, that the filesystem daemon is able to record the exact
* filesystem operations performed, and can also control the behavior
* of the requester process in otherwise impossible ways. For example
Expand All @@ -996,27 +996,23 @@ int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
* for which the owner of the mount has ptrace privilege. This
* excludes processes started by other users, suid or sgid processes.
*/
int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
int fuse_allow_current_process(struct fuse_conn *fc)
{
const struct cred *cred;
int ret;

if (fc->flags & FUSE_ALLOW_OTHER)
return 1;

rcu_read_lock();
ret = 0;
cred = __task_cred(task);
cred = current_cred();
if (uid_eq(cred->euid, fc->user_id) &&
uid_eq(cred->suid, fc->user_id) &&
uid_eq(cred->uid, fc->user_id) &&
gid_eq(cred->egid, fc->group_id) &&
gid_eq(cred->sgid, fc->group_id) &&
gid_eq(cred->gid, fc->group_id))
ret = 1;
rcu_read_unlock();
return 1;

return ret;
return 0;
}

static int fuse_access(struct inode *inode, int mask)
Expand Down Expand Up @@ -1077,7 +1073,7 @@ static int fuse_permission(struct inode *inode, int mask)
bool refreshed = false;
int err = 0;

if (!fuse_allow_task(fc, current))
if (!fuse_allow_current_process(fc))
return -EACCES;

/*
Expand Down Expand Up @@ -1544,7 +1540,7 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr,
loff_t oldsize;
int err;

if (!fuse_allow_task(fc, current))
if (!fuse_allow_current_process(fc))
return -EACCES;

if (!(fc->flags & FUSE_DEFAULT_PERMISSIONS))
Expand Down Expand Up @@ -1653,7 +1649,7 @@ static int fuse_getattr(struct vfsmount *mnt, struct dentry *entry,
struct inode *inode = entry->d_inode;
struct fuse_conn *fc = get_fuse_conn(inode);

if (!fuse_allow_task(fc, current))
if (!fuse_allow_current_process(fc))
return -EACCES;

return fuse_update_attributes(inode, stat, NULL, NULL);
Expand Down Expand Up @@ -1756,7 +1752,7 @@ static ssize_t fuse_listxattr(struct dentry *entry, char *list, size_t size)
struct fuse_getxattr_out outarg;
ssize_t ret;

if (!fuse_allow_task(fc, current))
if (!fuse_allow_current_process(fc))
return -EACCES;

if (fc->no_listxattr)
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -2082,7 +2082,7 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd,
struct inode *inode = file->f_dentry->d_inode;
struct fuse_conn *fc = get_fuse_conn(inode);

if (!fuse_allow_task(fc, current))
if (!fuse_allow_current_process(fc))
return -EACCES;

if (is_bad_inode(inode))
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/fuse/fuse_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -774,9 +774,9 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc);
int fuse_valid_type(int m);

/**
* Is task allowed to perform filesystem operation?
* Is current process allowed to perform filesystem operation?
*/
int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task);
int fuse_allow_current_process(struct fuse_conn *fc);

u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/fuse/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ static int fuse_statfs(struct dentry *dentry, struct kstatfs *buf)
struct fuse_statfs_out outarg;
int err;

if (!fuse_allow_task(fc, current)) {
if (!fuse_allow_current_process(fc)) {
buf->f_type = FUSE_SUPER_MAGIC;
return 0;
}
Expand Down

0 comments on commit 9acbcf6

Please sign in to comment.