Skip to content

Commit

Permalink
fs: prevent use after free in auditing when symlink following was denied
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sasha Levin authored and Al Viro committed Oct 10, 2012
1 parent 547b1e8 commit ffd8d10
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit ffd8d10

Please sign in to comment.