Skip to contentSkip to conversation

fs: prevent use after free in auditing when symlink following was denied

PATCH Applied Sasha Levin 3 participants 3 messages Oct 4, 2012 – Oct 5, 2012 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/namei.c +1 -1
index aa30d19..6d47fac 100644
@@ -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;
 }
 
Signature · 1 line
1.7.12
maintainer Applied
#2 lore raw
In reply to Sasha Levin
Quoted 3 lines · Sasha Levin

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.

Applied, and it's -stable fodder as well.