apparmor: Fix aa_label_build() error handling for failed merges
commit865c798a37bfacafd35e6c0f2d5d5e5bb572a07d
authorJohn Johansen <john.johansen@canonical.com>
Thu, 24 Jan 2019 21:53:05 +0000 (24 13:53 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:03:16 +0000 (13 14:03 -0700)
treee50ee6a7a4855236134a0ef317b1a3886c5fd6b2
parentc72b4dcd26795d6941db0cedd2c2212bb9b32d2f
apparmor: Fix aa_label_build() error handling for failed merges

[ 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