Commit f4a4a8b1 authored by Al Viro's avatar Al Viro

file->f_path.dentry is pinned down for as long as the file is open...

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5e9e2040
...@@ -2405,7 +2405,6 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm, ...@@ -2405,7 +2405,6 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
struct audit_aux_data_bprm_fcaps *ax; struct audit_aux_data_bprm_fcaps *ax;
struct audit_context *context = current->audit_context; struct audit_context *context = current->audit_context;
struct cpu_vfs_cap_data vcaps; struct cpu_vfs_cap_data vcaps;
struct dentry *dentry;
ax = kmalloc(sizeof(*ax), GFP_KERNEL); ax = kmalloc(sizeof(*ax), GFP_KERNEL);
if (!ax) if (!ax)
...@@ -2415,9 +2414,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm, ...@@ -2415,9 +2414,7 @@ int __audit_log_bprm_fcaps(struct linux_binprm *bprm,
ax->d.next = context->aux; ax->d.next = context->aux;
context->aux = (void *)ax; context->aux = (void *)ax;
dentry = dget(bprm->file->f_path.dentry); get_vfs_caps_from_disk(bprm->file->f_path.dentry, &vcaps);
get_vfs_caps_from_disk(dentry, &vcaps);
dput(dentry);
ax->fcap.permitted = vcaps.permitted; ax->fcap.permitted = vcaps.permitted;
ax->fcap.inheritable = vcaps.inheritable; ax->fcap.inheritable = vcaps.inheritable;
......
...@@ -434,7 +434,6 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data ...@@ -434,7 +434,6 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
*/ */
static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_cap) static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_cap)
{ {
struct dentry *dentry;
int rc = 0; int rc = 0;
struct cpu_vfs_cap_data vcaps; struct cpu_vfs_cap_data vcaps;
...@@ -446,9 +445,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c ...@@ -446,9 +445,7 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID) if (bprm->file->f_path.mnt->mnt_flags & MNT_NOSUID)
return 0; return 0;
dentry = dget(bprm->file->f_path.dentry); rc = get_vfs_caps_from_disk(bprm->file->f_path.dentry, &vcaps);
rc = get_vfs_caps_from_disk(dentry, &vcaps);
if (rc < 0) { if (rc < 0) {
if (rc == -EINVAL) if (rc == -EINVAL)
printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n", printk(KERN_NOTICE "%s: get_vfs_caps_from_disk returned %d for %s\n",
...@@ -464,7 +461,6 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c ...@@ -464,7 +461,6 @@ static int get_file_caps(struct linux_binprm *bprm, bool *effective, bool *has_c
__func__, rc, bprm->filename); __func__, rc, bprm->filename);
out: out:
dput(dentry);
if (rc) if (rc)
bprm_clear_caps(bprm); bprm_clear_caps(bprm);
......
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