]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/fuse/dir.c
CRED: Use RCU to access another task's creds and to release a task's own creds
[mirror_ubuntu-artful-kernel.git] / fs / fuse / dir.c
index e97a9898186282c56d3fba0730ff62614cc94b81..95bc22bdd0604e4562ec35b2ae286225530ad0bf 100644 (file)
@@ -869,18 +869,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->cred->euid == fc->user_id &&
-           task->cred->suid == fc->user_id &&
-           task->cred->uid == fc->user_id &&
-           task->cred->egid == fc->group_id &&
-           task->cred->sgid == fc->group_id &&
-           task->cred->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)