Commit 093d63c1 authored by Zizhi Wo's avatar Zizhi Wo Committed by Baokun Li
Browse files

cachefiles: modify inappropriate error return value in cachefiles_daemon_secctx

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT



--------------------------------

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: 9ae326a6 ("CacheFiles: A cache that backs onto a mounted filesystem")
Signed-off-by: default avatarZizhi Wo <wozizhi@huawei.com>
Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
parent 375c758a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -594,7 +594,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);