cachefiles: return -EEXIST for a repeated secctx command
Subsystems (3)
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")
Signed-off-by Jianping Liu <[email protected]>
--- fs/cachefiles/daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cachefiles/daemon.c +1 -1
@@ -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