Skip to content

Commit 70d91dc

Browse files
cgzonespcmoore
authored andcommitted
selinux: set next pointer before attaching to list
Set the next pointer in filename_trans_read_helper() before attaching the new node under construction to the list, otherwise garbage would be dereferenced on subsequent failure during cleanup in the out goto label. Cc: <stable@vger.kernel.org> Fixes: 4300590 ("selinux: implement new format of filename transitions") Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent 06c2afb commit 70d91dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

security/selinux/ss/policydb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2005,6 +2005,7 @@ static int filename_trans_read_helper(struct policydb *p, void *fp)
20052005
if (!datum)
20062006
goto out;
20072007

2008+
datum->next = NULL;
20082009
*dst = datum;
20092010

20102011
/* ebitmap_read() will at least init the bitmap */
@@ -2017,7 +2018,6 @@ static int filename_trans_read_helper(struct policydb *p, void *fp)
20172018
goto out;
20182019

20192020
datum->otype = le32_to_cpu(buf[0]);
2020-
datum->next = NULL;
20212021

20222022
dst = &datum->next;
20232023
}

0 commit comments

Comments
 (0)