Skip to contentSkip to conversation

cachefiles: return -EEXIST for a repeated secctx command

PATCH New Jianping Liu 1 participant 1 message Oct 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cachefiles: return -EEXIST for a repeated secctx command

From: Jianping Liu <[email protected]>

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")
---
 fs/cachefiles/daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cachefiles/daemon.c +1 -1
index 1a66e0af2837..ef2ec7afd7cf 100644
@@ -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);
Signature · 1 line
2.43.7