VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   30 Branches   50 Tags
author: Richard Guy Briggs <rgb@redhat.com> 2021-08-23 22:04:09 -0400 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2021-09-03 10:23:08 +0200 commit: 4e25ac3793f76aec260a7158f5d897133afd70da parent: f8132a4726df98345594d89666f99a33fec3d00a
Commit Summary:
audit: move put_tree() to avoid trim_trees refcount underflow and UAF
Diffstat:
1 file changed, 1 insertion, 1 deletion
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index 6c91902f4f45..39241207ec04 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -593,7 +593,6 @@ static void prune_tree_chunks(struct audit_tree *victim, bool tagged)
 		spin_lock(&hash_lock);
 	}
 	spin_unlock(&hash_lock);
-	put_tree(victim);
 }
 
 /*
@@ -602,6 +601,7 @@ static void prune_tree_chunks(struct audit_tree *victim, bool tagged)
 static void prune_one(struct audit_tree *victim)
 {
 	prune_tree_chunks(victim, false);
+	put_tree(victim);
 }
 
 /* trim the uncommitted chunks from tree */