The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] cachefiles: modify inappropriate error return value in cachefiles_daemon_secctx
@ 2024-06-04  7:13 Zizhi Wo
  2024-06-18 13:37 ` Zizhi Wo
  0 siblings, 1 reply; 2+ messages in thread
From: Zizhi Wo @ 2024-06-04  7:13 UTC (permalink / raw)
  To: dhowells, steved, Trond.Myklebust, viro
  Cc: netfs, linux-kernel, wozizhi, yangerkun

In cachefiles_daemon_secctx(), if it is detected that secctx has been
written to the cache, the error code returned is -EINVAL, which is
inappropriate and does not distinguish the situation well.

Like cachefiles_daemon_dir(), fix this issue by return -EEXIST to the user
if it has already been defined once.

Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem")
Signed-off-by: Zizhi Wo <wozizhi@huawei.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 6465e2574230..1b14849804f3 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -586,7 +586,7 @@ static int cachefiles_daemon_secctx(struct cachefiles_cache *cache, char *args)
 
 	if (cache->secctx) {
 		pr_err("Second security context specified\n");
-		return -EINVAL;
+		return -EEXIST;
 	}
 
 	secctx = kstrdup(args, GFP_KERNEL);
-- 
2.39.2


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

end of thread, other threads:[~2024-06-18 13:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-04  7:13 [PATCH] cachefiles: modify inappropriate error return value in cachefiles_daemon_secctx Zizhi Wo
2024-06-18 13:37 ` Zizhi Wo

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