summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2023-08-18 17:33:58 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-30 16:18:17 +0200
commit22426e1ce679bd80d174fa4874d9a3996dee3290 (patch)
tree3a1715a955d7c5c4601e1ed7362f612e2016d66a /security
parent711595bfdccfcb5f54ae145ba72b9c39adc40f20 (diff)
downloadlinux-22426e1ce679bd80d174fa4874d9a3996dee3290.tar.gz
linux-22426e1ce679bd80d174fa4874d9a3996dee3290.tar.bz2
linux-22426e1ce679bd80d174fa4874d9a3996dee3290.zip
selinux: set next pointer before attaching to list
commit 70d91dc9b2ac91327d0eefd86163abc3548effa6 upstream. 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: 430059024389 ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'security')
-rw-r--r--security/selinux/ss/policydb.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 0ae1b718194a..7f7858593bdb 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2011,6 +2011,7 @@ static int filename_trans_read_helper(struct policydb *p, void *fp)
if (!datum)
goto out;
+ datum->next = NULL;
*dst = datum;
/* ebitmap_read() will at least init the bitmap */
@@ -2023,7 +2024,6 @@ static int filename_trans_read_helper(struct policydb *p, void *fp)
goto out;
datum->otype = le32_to_cpu(buf[0]);
- datum->next = NULL;
dst = &datum->next;
}