Commit ffac1de6 authored by Dan Carpenter's avatar Dan Carpenter Committed by John Johansen

apparmor: Fix error cod in __aa_fs_profile_mkdir()

We can either return PTR_ERR(NULL) or a PTR_ERR(a valid pointer) here.
Returning NULL is probably not good, but since this happens at boot
then we are probably already toasted if we were to hit this bug in real
life.  In other words, it seems like a very low severity bug to me.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJohn Johansen <john.johansen@canonical.com>
parent 47dbd1cd
...@@ -727,8 +727,10 @@ int __aa_fs_profile_mkdir(struct aa_profile *profile, struct dentry *parent) ...@@ -727,8 +727,10 @@ int __aa_fs_profile_mkdir(struct aa_profile *profile, struct dentry *parent)
id_len = snprintf(NULL, 0, ".%ld", profile->ns->uniq_id); id_len = snprintf(NULL, 0, ".%ld", profile->ns->uniq_id);
profile->dirname = kmalloc(len + id_len + 1, GFP_KERNEL); profile->dirname = kmalloc(len + id_len + 1, GFP_KERNEL);
if (!profile->dirname) if (!profile->dirname) {
goto fail; error = -ENOMEM;
goto fail2;
}
mangle_name(profile->base.name, profile->dirname); mangle_name(profile->base.name, profile->dirname);
sprintf(profile->dirname + len, ".%ld", profile->ns->uniq_id++); sprintf(profile->dirname + len, ".%ld", profile->ns->uniq_id++);
......
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