mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jianping Liu <frankljpliu@gmail.com>
To: dhowells@redhat.com, jlayton@kernel.org, netfs@lists.linux.dev,
	frankjpliu@tencent.com
Cc: linux-kernel@vger.kernel.org, stable@kernel.org, stable@vger.kernel.org
Subject: [PATCH] cachefiles: return -EEXIST for a repeated secctx command
Date: Wed, 28 Oct 2026 17:32:38 +0800	[thread overview]
Message-ID: <20261028093238.1382712-1-frankljpliu@gmail.com> (raw)

From: Jianping Liu <frankjpliu@tencent.com>

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")
Cc: stable@vger.kernel.org
Signed-off-by: Jianping Liu <frankjpliu@tencent.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 1a66e0af2837..ef2ec7afd7cf 100644
--- a/fs/cachefiles/daemon.c
+++ b/fs/cachefiles/daemon.c
@@ -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);
-- 
2.43.7


                 reply	other threads:[~2026-10-28  9:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261028093238.1382712-1-frankljpliu@gmail.com \
    --to=frankljpliu@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=frankjpliu@tencent.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netfs@lists.linux.dev \
    --cc=stable@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®