summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2012-10-04 19:56:40 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-09 23:33:37 -0400
commitffd8d101a3a7d3f2e79deee1e342801703b6dc70 (patch)
treed2ca06ce67886ce0c9498c6fbce05dc11d93fa9c
parent547b1e81afe3119f7daf702cc03b158495535a25 (diff)
fs: prevent use after free in auditing when symlink following was denied
Commit "fs: add link restriction audit reporting" has added auditing of failed attempts to follow symlinks. Unfortunately, the auditing was being done after the struct path structure was released earlier. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index aa30d19e9edd..6d47fac64292 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -692,9 +692,9 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd)
if (uid_eq(parent->i_uid, inode->i_uid))
return 0;
+ audit_log_link_denied("follow_link", link);
path_put_conditional(link, nd);
path_put(&nd->path);
- audit_log_link_denied("follow_link", link);
return -EACCES;
}