Commit 83d49856 authored by Eric Paris's avatar Eric Paris

SELinux: rename dentry_open to file_open

dentry_open takes a file, rename it to file_open
Signed-off-by: default avatarEric Paris <eparis@redhat.com>
parent 95dbf739
...@@ -681,7 +681,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt, ...@@ -681,7 +681,7 @@ static struct file *__dentry_open(struct dentry *dentry, struct vfsmount *mnt,
f->f_op = fops_get(inode->i_fop); f->f_op = fops_get(inode->i_fop);
error = security_dentry_open(f, cred); error = security_file_open(f, cred);
if (error) if (error)
goto cleanup_all; goto cleanup_all;
......
...@@ -639,10 +639,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) ...@@ -639,10 +639,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
* to receive an open file descriptor via socket IPC. * to receive an open file descriptor via socket IPC.
* @file contains the file structure being received. * @file contains the file structure being received.
* Return 0 if permission is granted. * Return 0 if permission is granted.
* * @file_open
* Security hook for dentry
*
* @dentry_open
* Save open-time permission checking state for later use upon * Save open-time permission checking state for later use upon
* file_permission, and recheck access if anything has changed * file_permission, and recheck access if anything has changed
* since inode_permission. * since inode_permission.
...@@ -1497,7 +1494,7 @@ struct security_operations { ...@@ -1497,7 +1494,7 @@ struct security_operations {
int (*file_send_sigiotask) (struct task_struct *tsk, int (*file_send_sigiotask) (struct task_struct *tsk,
struct fown_struct *fown, int sig); struct fown_struct *fown, int sig);
int (*file_receive) (struct file *file); int (*file_receive) (struct file *file);
int (*dentry_open) (struct file *file, const struct cred *cred); int (*file_open) (struct file *file, const struct cred *cred);
int (*task_create) (unsigned long clone_flags); int (*task_create) (unsigned long clone_flags);
void (*task_free) (struct task_struct *task); void (*task_free) (struct task_struct *task);
...@@ -1756,7 +1753,7 @@ int security_file_set_fowner(struct file *file); ...@@ -1756,7 +1753,7 @@ int security_file_set_fowner(struct file *file);
int security_file_send_sigiotask(struct task_struct *tsk, int security_file_send_sigiotask(struct task_struct *tsk,
struct fown_struct *fown, int sig); struct fown_struct *fown, int sig);
int security_file_receive(struct file *file); int security_file_receive(struct file *file);
int security_dentry_open(struct file *file, const struct cred *cred); int security_file_open(struct file *file, const struct cred *cred);
int security_task_create(unsigned long clone_flags); int security_task_create(unsigned long clone_flags);
void security_task_free(struct task_struct *task); void security_task_free(struct task_struct *task);
int security_cred_alloc_blank(struct cred *cred, gfp_t gfp); int security_cred_alloc_blank(struct cred *cred, gfp_t gfp);
...@@ -2227,8 +2224,8 @@ static inline int security_file_receive(struct file *file) ...@@ -2227,8 +2224,8 @@ static inline int security_file_receive(struct file *file)
return 0; return 0;
} }
static inline int security_dentry_open(struct file *file, static inline int security_file_open(struct file *file,
const struct cred *cred) const struct cred *cred)
{ {
return 0; return 0;
} }
......
...@@ -373,7 +373,7 @@ static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) ...@@ -373,7 +373,7 @@ static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry)
AA_MAY_META_READ); AA_MAY_META_READ);
} }
static int apparmor_dentry_open(struct file *file, const struct cred *cred) static int apparmor_file_open(struct file *file, const struct cred *cred)
{ {
struct aa_file_cxt *fcxt = file->f_security; struct aa_file_cxt *fcxt = file->f_security;
struct aa_profile *profile; struct aa_profile *profile;
...@@ -640,9 +640,9 @@ static struct security_operations apparmor_ops = { ...@@ -640,9 +640,9 @@ static struct security_operations apparmor_ops = {
.path_chmod = apparmor_path_chmod, .path_chmod = apparmor_path_chmod,
.path_chown = apparmor_path_chown, .path_chown = apparmor_path_chown,
.path_truncate = apparmor_path_truncate, .path_truncate = apparmor_path_truncate,
.dentry_open = apparmor_dentry_open,
.inode_getattr = apparmor_inode_getattr, .inode_getattr = apparmor_inode_getattr,
.file_open = apparmor_file_open,
.file_permission = apparmor_file_permission, .file_permission = apparmor_file_permission,
.file_alloc_security = apparmor_file_alloc_security, .file_alloc_security = apparmor_file_alloc_security,
.file_free_security = apparmor_file_free_security, .file_free_security = apparmor_file_free_security,
......
...@@ -348,7 +348,7 @@ static int cap_file_receive(struct file *file) ...@@ -348,7 +348,7 @@ static int cap_file_receive(struct file *file)
return 0; return 0;
} }
static int cap_dentry_open(struct file *file, const struct cred *cred) static int cap_file_open(struct file *file, const struct cred *cred)
{ {
return 0; return 0;
} }
...@@ -956,7 +956,7 @@ void __init security_fixup_ops(struct security_operations *ops) ...@@ -956,7 +956,7 @@ void __init security_fixup_ops(struct security_operations *ops)
set_to_cap_if_null(ops, file_set_fowner); set_to_cap_if_null(ops, file_set_fowner);
set_to_cap_if_null(ops, file_send_sigiotask); set_to_cap_if_null(ops, file_send_sigiotask);
set_to_cap_if_null(ops, file_receive); set_to_cap_if_null(ops, file_receive);
set_to_cap_if_null(ops, dentry_open); set_to_cap_if_null(ops, file_open);
set_to_cap_if_null(ops, task_create); set_to_cap_if_null(ops, task_create);
set_to_cap_if_null(ops, task_free); set_to_cap_if_null(ops, task_free);
set_to_cap_if_null(ops, cred_alloc_blank); set_to_cap_if_null(ops, cred_alloc_blank);
......
...@@ -701,11 +701,11 @@ int security_file_receive(struct file *file) ...@@ -701,11 +701,11 @@ int security_file_receive(struct file *file)
return security_ops->file_receive(file); return security_ops->file_receive(file);
} }
int security_dentry_open(struct file *file, const struct cred *cred) int security_file_open(struct file *file, const struct cred *cred)
{ {
int ret; int ret;
ret = security_ops->dentry_open(file, cred); ret = security_ops->file_open(file, cred);
if (ret) if (ret)
return ret; return ret;
......
...@@ -2973,7 +2973,7 @@ static int selinux_file_permission(struct file *file, int mask) ...@@ -2973,7 +2973,7 @@ static int selinux_file_permission(struct file *file, int mask)
if (sid == fsec->sid && fsec->isid == isec->sid && if (sid == fsec->sid && fsec->isid == isec->sid &&
fsec->pseqno == avc_policy_seqno()) fsec->pseqno == avc_policy_seqno())
/* No change since dentry_open check. */ /* No change since file_open check. */
return 0; return 0;
return selinux_revalidate_file_permission(file, mask); return selinux_revalidate_file_permission(file, mask);
...@@ -3232,7 +3232,7 @@ static int selinux_file_receive(struct file *file) ...@@ -3232,7 +3232,7 @@ static int selinux_file_receive(struct file *file)
return file_has_perm(cred, file, file_to_av(file)); return file_has_perm(cred, file, file_to_av(file));
} }
static int selinux_dentry_open(struct file *file, const struct cred *cred) static int selinux_file_open(struct file *file, const struct cred *cred)
{ {
struct file_security_struct *fsec; struct file_security_struct *fsec;
struct inode *inode; struct inode *inode;
...@@ -5596,7 +5596,7 @@ static struct security_operations selinux_ops = { ...@@ -5596,7 +5596,7 @@ static struct security_operations selinux_ops = {
.file_send_sigiotask = selinux_file_send_sigiotask, .file_send_sigiotask = selinux_file_send_sigiotask,
.file_receive = selinux_file_receive, .file_receive = selinux_file_receive,
.dentry_open = selinux_dentry_open, .file_open = selinux_file_open,
.task_create = selinux_task_create, .task_create = selinux_task_create,
.cred_alloc_blank = selinux_cred_alloc_blank, .cred_alloc_blank = selinux_cred_alloc_blank,
......
...@@ -1349,7 +1349,7 @@ static int smack_file_receive(struct file *file) ...@@ -1349,7 +1349,7 @@ static int smack_file_receive(struct file *file)
} }
/** /**
* smack_dentry_open - Smack dentry open processing * smack_file_open - Smack dentry open processing
* @file: the object * @file: the object
* @cred: unused * @cred: unused
* *
...@@ -1357,7 +1357,7 @@ static int smack_file_receive(struct file *file) ...@@ -1357,7 +1357,7 @@ static int smack_file_receive(struct file *file)
* *
* Returns 0 * Returns 0
*/ */
static int smack_dentry_open(struct file *file, const struct cred *cred) static int smack_file_open(struct file *file, const struct cred *cred)
{ {
struct inode_smack *isp = file->f_path.dentry->d_inode->i_security; struct inode_smack *isp = file->f_path.dentry->d_inode->i_security;
...@@ -3538,7 +3538,7 @@ struct security_operations smack_ops = { ...@@ -3538,7 +3538,7 @@ struct security_operations smack_ops = {
.file_send_sigiotask = smack_file_send_sigiotask, .file_send_sigiotask = smack_file_send_sigiotask,
.file_receive = smack_file_receive, .file_receive = smack_file_receive,
.dentry_open = smack_dentry_open, .file_open = smack_file_open,
.cred_alloc_blank = smack_cred_alloc_blank, .cred_alloc_blank = smack_cred_alloc_blank,
.cred_free = smack_cred_free, .cred_free = smack_cred_free,
......
...@@ -319,14 +319,14 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd, ...@@ -319,14 +319,14 @@ static int tomoyo_file_fcntl(struct file *file, unsigned int cmd,
} }
/** /**
* tomoyo_dentry_open - Target for security_dentry_open(). * tomoyo_file_open - Target for security_file_open().
* *
* @f: Pointer to "struct file". * @f: Pointer to "struct file".
* @cred: Pointer to "struct cred". * @cred: Pointer to "struct cred".
* *
* Returns 0 on success, negative value otherwise. * Returns 0 on success, negative value otherwise.
*/ */
static int tomoyo_dentry_open(struct file *f, const struct cred *cred) static int tomoyo_file_open(struct file *f, const struct cred *cred)
{ {
int flags = f->f_flags; int flags = f->f_flags;
/* Don't check read permission here if called from do_execve(). */ /* Don't check read permission here if called from do_execve(). */
...@@ -510,7 +510,7 @@ static struct security_operations tomoyo_security_ops = { ...@@ -510,7 +510,7 @@ static struct security_operations tomoyo_security_ops = {
.bprm_set_creds = tomoyo_bprm_set_creds, .bprm_set_creds = tomoyo_bprm_set_creds,
.bprm_check_security = tomoyo_bprm_check_security, .bprm_check_security = tomoyo_bprm_check_security,
.file_fcntl = tomoyo_file_fcntl, .file_fcntl = tomoyo_file_fcntl,
.dentry_open = tomoyo_dentry_open, .file_open = tomoyo_file_open,
.path_truncate = tomoyo_path_truncate, .path_truncate = tomoyo_path_truncate,
.path_unlink = tomoyo_path_unlink, .path_unlink = tomoyo_path_unlink,
.path_mkdir = tomoyo_path_mkdir, .path_mkdir = tomoyo_path_mkdir,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment