summaryrefslogtreecommitdiffstats
path: root/security
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2014-01-08 07:22:32 +0100
committerJames Morris <james.l.morris@oracle.com>2014-01-08 07:22:32 +0100
commit923b49ff69fcbffe6f8b2739de218c45544392a7 (patch)
tree44d03d61cad1edd916e5e0d88641353aa7cd0d4c /security
parentMerge branch 'master' of git://git.infradead.org/users/pcmoore/selinux into next (diff)
parentSELinux: Fix memory leak upon loading policy (diff)
downloadlinux-923b49ff69fcbffe6f8b2739de218c45544392a7.tar.xz
linux-923b49ff69fcbffe6f8b2739de218c45544392a7.zip
Merge branch 'master' of git://git.infradead.org/users/pcmoore/selinux into next
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/policydb.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index dc4011643b55..c0f498842129 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -1995,7 +1995,19 @@ static int filename_trans_read(struct policydb *p, void *fp)
if (rc)
goto out;
- hashtab_insert(p->filename_trans, ft, otype);
+ rc = hashtab_insert(p->filename_trans, ft, otype);
+ if (rc) {
+ /*
+ * Do not return -EEXIST to the caller, or the system
+ * will not boot.
+ */
+ if (rc != -EEXIST)
+ goto out;
+ /* But free memory to avoid memory leak. */
+ kfree(ft);
+ kfree(name);
+ kfree(otype);
+ }
}
hash_eval(p->filename_trans, "filenametr");
return 0;