lkml.org 
[lkml]   [2019]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 4.14 37/45] apparmor: Fix aa_label_build() error handling for failed merges
    Date
    From: John Johansen <john.johansen@canonical.com>

    [ Upstream commit d6d478aee003e19ef90321176552a8ad2929a47f ]

    aa_label_merge() can return NULL for memory allocations failures
    make sure to handle and set the correct error in this case.

    Reported-by: Peng Hao <peng.hao2@zte.com.cn>
    Signed-off-by: John Johansen <john.johansen@canonical.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    security/apparmor/domain.c | 5 ++++-
    1 file changed, 4 insertions(+), 1 deletion(-)

    diff --git a/security/apparmor/domain.c b/security/apparmor/domain.c
    index dd754b7850a82..67bf8b7ee8a28 100644
    --- a/security/apparmor/domain.c
    +++ b/security/apparmor/domain.c
    @@ -1260,7 +1260,10 @@ int aa_change_profile(const char *fqname, int flags)
    aa_get_label(&profile->label));
    if (IS_ERR_OR_NULL(new)) {
    info = "failed to build target label";
    - error = PTR_ERR(new);
    + if (!new)
    + error = -ENOMEM;
    + else
    + error = PTR_ERR(new);
    new = NULL;
    perms.allow = 0;
    goto audit;
    --
    2.19.1
    \
     
     \ /
      Last update: 2019-02-23 22:20    [W:6.685 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site