From: John Johansen Date: Tue, 14 Apr 2026 02:56:26 +0000 (-0700) Subject: apparmor: fix unpack_tags to properly return error in failure cases X-Git-Tag: v7.1-rc1~32^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72971e6f745ad5c366629b0affbe3a6b619dcd8b;p=thirdparty%2Fkernel%2Flinux.git apparmor: fix unpack_tags to properly return error in failure cases error is initialized to -EPROTO but set by some of the internal functions, unfortunately the last two checks assume error is set to -EPROTO already for the failure case. Ensure it is by setting it before these checks. Fixes: 3d28e2397af7a ("apparmor: add support loading per permission tagging") Reported-by: Dan Carpenter Signed-off-by: John Johansen --- diff --git a/security/apparmor/policy_unpack.c b/security/apparmor/policy_unpack.c index ff517bc7e275..dd445c25f8e9 100644 --- a/security/apparmor/policy_unpack.c +++ b/security/apparmor/policy_unpack.c @@ -863,6 +863,7 @@ static int unpack_tags(struct aa_ext *e, struct aa_tags_struct *tags, *info = "failed to unpack profile tag.sets"; goto fail; } + error = -EPROTO; if (!aa_unpack_nameX(e, AA_STRUCTEND, NULL)) goto fail;