public inbox for linux-security-module@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] ipe: return -ESTALE instead of -EINVAL on update when new policy has a lower version
@ 2024-09-25 20:42 luca.boccassi
  2024-09-25 20:42 ` [PATCH v2 2/2] ipe: also reject policy updates with the same version luca.boccassi
  2024-09-25 20:53 ` [PATCH v2 1/2] ipe: return -ESTALE instead of -EINVAL on update when new policy has a lower version Fan Wu
  0 siblings, 2 replies; 4+ messages in thread
From: luca.boccassi @ 2024-09-25 20:42 UTC (permalink / raw)
  To: linux-security-module; +Cc: wufan, paul

From: Luca Boccassi <bluca@debian.org>

When loading policies in userspace we want a recognizable error when an
update attempts to use an old policy, as that is an error that needs
to be treated differently from an invalid policy. Use -ESTALE as it is
clear enough for an update mechanism.

Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
---
 security/ipe/policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/ipe/policy.c b/security/ipe/policy.c
index bf5aa97911e1..3a0069c6d5af 100644
--- a/security/ipe/policy.c
+++ b/security/ipe/policy.c
@@ -107,7 +107,7 @@ int ipe_update_policy(struct inode *root, const char *text, size_t textlen,
 	}
 
 	if (ver_to_u64(old) > ver_to_u64(new)) {
-		rc = -EINVAL;
+		rc = -ESTALE;
 		goto err;
 	}
 
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-25 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 20:42 [PATCH v2 1/2] ipe: return -ESTALE instead of -EINVAL on update when new policy has a lower version luca.boccassi
2024-09-25 20:42 ` [PATCH v2 2/2] ipe: also reject policy updates with the same version luca.boccassi
2024-09-25 20:56   ` Fan Wu
2024-09-25 20:53 ` [PATCH v2 1/2] ipe: return -ESTALE instead of -EINVAL on update when new policy has a lower version Fan Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox