diff options
author | Eric Paris <eparis@redhat.com> | 2009-05-11 13:59:16 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-05-11 21:06:04 -0400 |
commit | f06dd16a03f6f7f72fab4db03be36e28c28c6fd6 (patch) | |
tree | 6542e8474a2eff0543b20ac4eb2bb2811d23fc3e /security/integrity/ima/ima_main.c | |
parent | 37bcbf13d32e4e453e9def79ee72bd953b88302f (diff) |
IMA: Handle dentry_open failures
Currently IMA does not handle failures from dentry_open(). This means that we
leave a pointer set to ERR_PTR(errno) and then try to use it just a few lines
later in fput(). Oops.
Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Mimi Zohar <zohar@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/integrity/ima/ima_main.c')
-rw-r--r-- | security/integrity/ima/ima_main.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c index cdae13c5ae05..1987424623c2 100644 --- a/security/integrity/ima/ima_main.c +++ b/security/integrity/ima/ima_main.c | |||
@@ -116,10 +116,6 @@ static int get_path_measurement(struct ima_iint_cache *iint, struct file *file, | |||
116 | { | 116 | { |
117 | int rc = 0; | 117 | int rc = 0; |
118 | 118 | ||
119 | if (IS_ERR(file)) { | ||
120 | pr_info("%s dentry_open failed\n", filename); | ||
121 | return rc; | ||
122 | } | ||
123 | iint->opencount++; | 119 | iint->opencount++; |
124 | iint->readcount++; | 120 | iint->readcount++; |
125 | 121 | ||
@@ -185,6 +181,12 @@ int ima_path_check(struct path *path, int mask) | |||
185 | struct vfsmount *mnt = mntget(path->mnt); | 181 | struct vfsmount *mnt = mntget(path->mnt); |
186 | 182 | ||
187 | file = dentry_open(dentry, mnt, O_RDONLY, current_cred()); | 183 | file = dentry_open(dentry, mnt, O_RDONLY, current_cred()); |
184 | if (IS_ERR(file)) { | ||
185 | pr_info("%s dentry_open failed\n", dentry->d_name.name); | ||
186 | rc = PTR_ERR(file); | ||
187 | file = NULL; | ||
188 | goto out; | ||
189 | } | ||
188 | rc = get_path_measurement(iint, file, dentry->d_name.name); | 190 | rc = get_path_measurement(iint, file, dentry->d_name.name); |
189 | } | 191 | } |
190 | out: | 192 | out: |