Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi...
[linux-2.6.git] / fs / fuse / dir.c
index f310768a02fe550b532ad537ffe3c11ea68e6d1d..fdff346e96fdc9dead4f9a00a081f5488fc4a9e3 100644 (file)
@@ -871,18 +871,25 @@ int fuse_update_attributes(struct inode *inode, struct kstat *stat,
  */
 int fuse_allow_task(struct fuse_conn *fc, struct task_struct *task)
 {
+       const struct cred *cred;
+       int ret;
+
        if (fc->flags & FUSE_ALLOW_OTHER)
                return 1;
 
-       if (task->euid == fc->user_id &&
-           task->suid == fc->user_id &&
-           task->uid == fc->user_id &&
-           task->egid == fc->group_id &&
-           task->sgid == fc->group_id &&
-           task->gid == fc->group_id)
-               return 1;
+       rcu_read_lock();
+       ret = 0;
+       cred = __task_cred(task);
+       if (cred->euid == fc->user_id &&
+           cred->suid == fc->user_id &&
+           cred->uid  == fc->user_id &&
+           cred->egid == fc->group_id &&
+           cred->sgid == fc->group_id &&
+           cred->gid  == fc->group_id)
+               ret = 1;
+       rcu_read_unlock();
 
-       return 0;
+       return ret;
 }
 
 static int fuse_access(struct inode *inode, int mask)