Commit d6d478ae authored by John Johansen's avatar John Johansen

apparmor: Fix aa_label_build() error handling for failed merges

aa_label_merge() can return NULL for memory allocations failures
make sure to handle and set the correct error in this case.
Reported-by: default avatarPeng Hao <peng.hao2@zte.com.cn>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent a1a02062
...@@ -1444,6 +1444,9 @@ int aa_change_profile(const char *fqname, int flags) ...@@ -1444,6 +1444,9 @@ int aa_change_profile(const char *fqname, int flags)
new = aa_label_merge(label, target, GFP_KERNEL); new = aa_label_merge(label, target, GFP_KERNEL);
if (IS_ERR_OR_NULL(new)) { if (IS_ERR_OR_NULL(new)) {
info = "failed to build target label"; info = "failed to build target label";
if (!new)
error = -ENOMEM;
else
error = PTR_ERR(new); error = PTR_ERR(new);
new = NULL; new = NULL;
perms.allow = 0; perms.allow = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment