diff options
Diffstat (limited to 'security/apparmor/policy_unpack.c')
| -rw-r--r-- | security/apparmor/policy_unpack.c | 13 | 
1 files changed, 9 insertions, 4 deletions
diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index 47ec097d6741..5e578ef0ddff 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -478,6 +478,8 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_str_table *strs)  		if (!table)  			goto fail; +		strs->table = table; +		strs->size = size;  		for (i = 0; i < size; i++) {  			char *str;  			int c, j, pos, size2 = aa_unpack_strdup(e, &str, NULL); @@ -520,14 +522,11 @@ static bool unpack_trans_table(struct aa_ext *e, struct aa_str_table *strs)  			goto fail;  		if (!aa_unpack_nameX(e, AA_STRUCTEND, NULL))  			goto fail; - -		strs->table = table; -		strs->size = size;  	}  	return true;  fail: -	kfree_sensitive(table); +	aa_free_str_table(strs);  	e->pos = saved_pos;  	return false;  } @@ -833,6 +832,10 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)  	tmpname = aa_splitn_fqname(name, strlen(name), &tmpns, &ns_len);  	if (tmpns) { +		if (!tmpname) { +			info = "empty profile name"; +			goto fail; +		}  		*ns_name = kstrndup(tmpns, ns_len, GFP_KERNEL);  		if (!*ns_name) {  			info = "out of memory"; @@ -1022,8 +1025,10 @@ static struct aa_profile *unpack_profile(struct aa_ext *e, char **ns_name)  		}  	} else if (rules->policy->dfa &&  		   rules->policy->start[AA_CLASS_FILE]) { +		aa_put_pdb(rules->file);  		rules->file = aa_get_pdb(rules->policy);  	} else { +		aa_put_pdb(rules->file);  		rules->file = aa_get_pdb(nullpdb);  	}  	error = -EPROTO;  |