summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2022-05-19 03:15:35 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2022-05-19 03:15:35 +0300
commit6899c161313671ca37a7a56429a3a80dad56ee8a (patch)
tree2da24fec869bacf725855aff01335ea0544cfb34
parent5494d0eb438a656c89792ac8cd0cdb963576bdda (diff)
parent6254bd3db316c9ccb3b05caa8b438be63245466f (diff)
downloadlinux-6899c161313671ca37a7a56429a3a80dad56ee8a.tar.xz
Merge tag 'selinux-pr-20220518' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux
Pull selinux fix from Paul Moore: "A single SELinux patch to fix an error path that was doing the wrong thing with respect to freeing memory" * tag 'selinux-pr-20220518' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux: selinux: fix bad cleanup on error in hashtab_duplicate()
-rw-r--r--security/selinux/ss/hashtab.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/selinux/ss/hashtab.c b/security/selinux/ss/hashtab.c
index 0ae4e4e57a40..3fb8f9026e9b 100644
--- a/security/selinux/ss/hashtab.c
+++ b/security/selinux/ss/hashtab.c
@@ -179,7 +179,8 @@ int hashtab_duplicate(struct hashtab *new, struct hashtab *orig,
kmem_cache_free(hashtab_node_cachep, cur);
}
}
- kmem_cache_free(hashtab_node_cachep, new);
+ kfree(new->htable);
+ memset(new, 0, sizeof(*new));
return -ENOMEM;
}