Commit ffd8d101 authored by Sasha Levin's avatar Sasha Levin Committed by Al Viro

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: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 547b1e81
...@@ -692,9 +692,9 @@ static inline int may_follow_link(struct path *link, struct nameidata *nd) ...@@ -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)) if (uid_eq(parent->i_uid, inode->i_uid))
return 0; return 0;
audit_log_link_denied("follow_link", link);
path_put_conditional(link, nd); path_put_conditional(link, nd);
path_put(&nd->path); path_put(&nd->path);
audit_log_link_denied("follow_link", link);
return -EACCES; return -EACCES;
} }
......
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