Skip to content

Commit 6d2fb47

Browse files
l0kodpcmoore
authored andcommitted
apparmor: fix lsm_get_self_attr()
In apparmor_getselfattr() when an invalid AppArmor attribute is requested, or a value hasn't been explicitly set for the requested attribute, the label passed to aa_put_label() is not properly initialized which can cause problems when the pointer value is non-NULL and AppArmor attempts to drop a reference on the bogus label object. Cc: Casey Schaufler <casey@schaufler-ca.com> Cc: John Johansen <john.johansen@canonical.com> Fixes: 223981d ("AppArmor: Add selfattr hooks") Signed-off-by: Mickaël Salaün <mic@digikod.net> Reviewed-by: Paul Moore <paul@paul-moore.com> [PM: description changes as discussed with MS] Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 86dc969 commit 6d2fb47

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/apparmor/lsm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ static int apparmor_getselfattr(unsigned int attr, struct lsm_ctx __user *lx,
782782
int error = -ENOENT;
783783
struct aa_task_ctx *ctx = task_ctx(current);
784784
struct aa_label *label = NULL;
785-
char *value;
785+
char *value = NULL;
786786

787787
switch (attr) {
788788
case LSM_ATTR_CURRENT:

0 commit comments

Comments
 (0)