[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230511123148.722343-1-cgzones@googlemail.com>
Date: Thu, 11 May 2023 14:31:47 +0200
From: Christian Göttsche <cgzones@...glemail.com>
To: selinux@...r.kernel.org
Cc: Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] selinux: keep context struct members in sync
Commit 53f3517ae087 ("selinux: do not leave dangling pointer behind")
reset the `str` field of the `context` struct in an OOM error branch.
In this struct the fields `str` and `len` are coupled and should be kept
in sync. Set the length to zero according to the string be set to NULL.
Fixes: 53f3517ae087 ("selinux: do not leave dangling pointer behind")
Signed-off-by: Christian Göttsche <cgzones@...glemail.com>
---
security/selinux/ss/context.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/security/selinux/ss/context.h b/security/selinux/ss/context.h
index 44179977f434..aed704b8c642 100644
--- a/security/selinux/ss/context.h
+++ b/security/selinux/ss/context.h
@@ -168,6 +168,7 @@ static inline int context_cpy(struct context *dst, const struct context *src)
if (rc) {
kfree(dst->str);
dst->str = NULL;
+ dst->len = 0;
return rc;
}
return 0;
--
2.40.1
Powered by blists - more mailing lists