mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 03:50:24 +09:00
ANDROID: vfs: Add permission2 for filesystems with per mount permissions
This allows filesystems to use their mount private data to influence the permssions they return in permission2. It has been separated into a new call to avoid disrupting current permission users. Change-Id: I9d416e3b8b6eca84ef3e336bd2af89ddd51df6ca Signed-off-by: Daniel Rosenberg <drosen@google.com>
This commit is contained in:
committed by
Dmitry Shmidt
parent
2757e9bdf4
commit
bbcd0ffae5
10
ipc/mqueue.c
10
ipc/mqueue.c
@@ -745,7 +745,7 @@ static struct file *do_create(struct ipc_namespace *ipc_ns, struct inode *dir,
|
||||
}
|
||||
|
||||
mode &= ~current_umask();
|
||||
ret = vfs_create(dir, path->dentry, mode, true);
|
||||
ret = vfs_create2(path->mnt, dir, path->dentry, mode, true);
|
||||
path->dentry->d_fsdata = NULL;
|
||||
if (ret)
|
||||
return ERR_PTR(ret);
|
||||
@@ -761,7 +761,7 @@ static struct file *do_open(struct path *path, int oflag)
|
||||
if ((oflag & O_ACCMODE) == (O_RDWR | O_WRONLY))
|
||||
return ERR_PTR(-EINVAL);
|
||||
acc = oflag2acc[oflag & O_ACCMODE];
|
||||
if (inode_permission(d_inode(path->dentry), acc))
|
||||
if (inode_permission2(path->mnt, d_inode(path->dentry), acc))
|
||||
return ERR_PTR(-EACCES);
|
||||
return dentry_open(path, oflag, current_cred());
|
||||
}
|
||||
@@ -794,7 +794,7 @@ SYSCALL_DEFINE4(mq_open, const char __user *, u_name, int, oflag, umode_t, mode,
|
||||
ro = mnt_want_write(mnt); /* we'll drop it in any case */
|
||||
error = 0;
|
||||
inode_lock(d_inode(root));
|
||||
path.dentry = lookup_one_len(name->name, root, strlen(name->name));
|
||||
path.dentry = lookup_one_len2(name->name, mnt, root, strlen(name->name));
|
||||
if (IS_ERR(path.dentry)) {
|
||||
error = PTR_ERR(path.dentry);
|
||||
goto out_putfd;
|
||||
@@ -865,7 +865,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
|
||||
if (err)
|
||||
goto out_name;
|
||||
inode_lock_nested(d_inode(mnt->mnt_root), I_MUTEX_PARENT);
|
||||
dentry = lookup_one_len(name->name, mnt->mnt_root,
|
||||
dentry = lookup_one_len2(name->name, mnt, mnt->mnt_root,
|
||||
strlen(name->name));
|
||||
if (IS_ERR(dentry)) {
|
||||
err = PTR_ERR(dentry);
|
||||
@@ -877,7 +877,7 @@ SYSCALL_DEFINE1(mq_unlink, const char __user *, u_name)
|
||||
err = -ENOENT;
|
||||
} else {
|
||||
ihold(inode);
|
||||
err = vfs_unlink(d_inode(dentry->d_parent), dentry, NULL);
|
||||
err = vfs_unlink2(mnt, d_inode(dentry->d_parent), dentry, NULL);
|
||||
}
|
||||
dput(dentry);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user