summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2023-10-24 12:38:40 -0400
committerPaul Moore <paul@paul-moore.com>2023-11-12 22:54:42 -0500
commitdc46db78b9747f8114030982ee5c2faf2faaeddd (patch)
treebfea48e1ca1a6c4229e4e156085951d59fa820aa /security
parentaab30be071f7048c9c23c61e6eddd55bba328398 (diff)
lsm: cleanup the size counters in security_getselfattr()
Zero out all of the size counters in the -E2BIG case (buffer too small) to help make the current code a bit more robust in the face of future code changes. Acked-by: Casey Schaufler <casey@schaufler-ca.com> Reviewed-by: Mickaël Salaün <mic@digikod.net> Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'security')
-rw-r--r--security/security.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/security/security.c b/security/security.c
index 7281aa90ca20..74ff9a48bd66 100644
--- a/security/security.c
+++ b/security/security.c
@@ -3950,8 +3950,9 @@ int security_getselfattr(unsigned int attr, struct lsm_ctx __user *uctx,
continue;
}
if (rc == -E2BIG) {
- toobig = true;
+ rc = 0;
left = 0;
+ toobig = true;
} else if (rc < 0)
return rc;
else