mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] cachefiles: return -EEXIST for a repeated secctx command
@ 2026-10-28  9:32 Jianping Liu
  0 siblings, 0 replies; only message in thread
From: Jianping Liu @ 2026-10-28  9:32 UTC (permalink / raw)
  To: dhowells, jlayton, netfs, frankjpliu; +Cc: linux-kernel, stable, stable

From: Jianping Liu <frankjpliu@tencent.com>

cachefiles_daemon_secctx() returns -EINVAL when a security context has
already been set. The same errno is used for an empty argument, so
userspace cannot tell the two failures apart.

Return -EEXIST instead, as cachefiles_daemon_dir() and
cachefiles_daemon_tag() do when their setting has already been given.

Fixes: 8667d434b2a9 ("cachefiles: Register a miscdev and parse commands over it")
Cc: stable@vger.kernel.org
Signed-off-by: Jianping Liu <frankjpliu@tencent.com>
---
 fs/cachefiles/daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c
index 1a66e0af2837..ef2ec7afd7cf 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -513,7 +513,7 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args)
 
 	if (cache->have_secid) {
 		pr_err("Second security context specified\n");
-		return -EINVAL;
+		return -EEXIST;
 	}
 
 	err = security_secctx_to_secid(args, strlen(args), &cache->secid);
-- 
2.43.7


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-28  9:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28  9:32 [PATCH] cachefiles: return -EEXIST for a repeated secctx command Jianping Liu

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

all inboxes | Powered by JetHome®