[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240821024301.1058918-7-wozizhi@huawei.com>
Date: Wed, 21 Aug 2024 10:42:59 +0800
From: Zizhi Wo <wozizhi@...wei.com>
To: <netfs@...ts.linux.dev>, <dhowells@...hat.com>, <jlayton@...nel.org>
CC: <hsiangkao@...ux.alibaba.com>, <jefflexu@...ux.alibaba.com>,
<zhujia.zj@...edance.com>, <linux-erofs@...ts.ozlabs.org>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<wozizhi@...wei.com>, <libaokun1@...wei.com>, <yangerkun@...wei.com>,
<houtao1@...wei.com>, <yukuai3@...wei.com>
Subject: [PATCH 6/8] cachefiles: Modify inappropriate error return value in cachefiles_daemon_secctx()
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: 8667d434b2a9 ("cachefiles: Register a miscdev and parse commands over it")
Signed-off-by: Zizhi Wo <wozizhi@...wei.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 89b11336a836..59e576951c68 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -587,7 +587,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
Powered by blists - more mailing lists