]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
apparmor: reset pos on failure to unpack for various functions
authorMike Salvatore <mike.salvatore@canonical.com>
Wed, 12 Jun 2019 21:55:14 +0000 (14:55 -0700)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
commitfe705dd0904f7ef33708e71605560511c0cb8997
treeab9ab203de6c847b33e5978aeb694f0c5c121060
parentc81f94023e66b7beca81ad9e457cd434b0c37dab
apparmor: reset pos on failure to unpack for various functions

BugLink: https://bugs.launchpad.net/bugs/1844558
[ Upstream commit 156e42996bd84eccb6acf319f19ce0cb140d00e3 ]

Each function that manipulates the aa_ext struct should reset it's "pos"
member on failure. This ensures that, on failure, no changes are made to
the state of the aa_ext struct.

There are paths were elements are optional and the error path is
used to indicate the optional element is not present. This means
instead of just aborting on error the unpack stream can become
unsynchronized on optional elements, if using one of the affected
functions.

Cc: stable@vger.kernel.org
Fixes: 736ec752d95e ("AppArmor: policy routines for loading and unpacking policy")
Signed-off-by: Mike Salvatore <mike.salvatore@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
security/apparmor/policy_unpack.c