diff options
author | Dmitry Kasatkin <dmitry.kasatkin@intel.com> | 2012-09-03 17:40:17 -0400 |
---|---|---|
committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2013-01-16 17:50:03 -0500 |
commit | ea1046d4c57ee6e3d5f68f19dd9a45bbab0b71a0 (patch) | |
tree | 5779ef0eadc9b871f0b1b06cc0107d0c28dfc726 /security/integrity/ima/ima_api.c | |
parent | ee866331749b07373743ce18ceaffb1dd841d855 (diff) |
ima: move full pathname resolution to separate function
Define a new function ima_d_path(), which returns the full pathname.
This function will be used further, for example, by the directory
verification code.
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_api.c')
-rw-r--r-- | security/integrity/ima/ima_api.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index fc722b44c416..9382a4c568b2 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
@@ -237,3 +237,20 @@ void ima_audit_measurement(struct integrity_iint_cache *iint, | |||
237 | 237 | ||
238 | iint->flags |= IMA_AUDITED; | 238 | iint->flags |= IMA_AUDITED; |
239 | } | 239 | } |
240 | |||
241 | const char *ima_d_path(struct path *path, char **pathbuf) | ||
242 | { | ||
243 | char *pathname = NULL; | ||
244 | |||
245 | /* We will allow 11 spaces for ' (deleted)' to be appended */ | ||
246 | *pathbuf = kmalloc(PATH_MAX + 11, GFP_KERNEL); | ||
247 | if (*pathbuf) { | ||
248 | pathname = d_path(path, *pathbuf, PATH_MAX + 11); | ||
249 | if (IS_ERR(pathname)) { | ||
250 | kfree(*pathbuf); | ||
251 | *pathbuf = NULL; | ||
252 | pathname = NULL; | ||
253 | } | ||
254 | } | ||
255 | return pathname; | ||
256 | } | ||