Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp1417686lqj; Tue, 4 Jun 2024 00:15:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUK6P1PpHfTk2ECo7bfSySCeFMBkEeU4y35qTdZfyiXm7KobfpkqlabsK5WPUUx3ylAeCsOnGhc9FYkRBxt0nq9+lIOZSodr0RKifDUYA== X-Google-Smtp-Source: AGHT+IE2+BjNpUjgVFh9/9MrDqNg4crPPem66nuZ02+J3YZ6xqJkO1qScLtF7C488+VBr5kXNjz7 X-Received: by 2002:a05:6a00:14c3:b0:6f3:ead3:c287 with SMTP id d2e1a72fcca58-70247666e64mr12574818b3a.0.1717485311402; Tue, 04 Jun 2024 00:15:11 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717485311; cv=pass; d=google.com; s=arc-20160816; b=DQofRzqB5P/Z5Cwiv6CkG4Sh6aGBuCGbzyWxGvnvNYzCsY0tgUthpQvj94YKK98pi2 bdpw4gUA6XsTVFgfii3XEDHmrKqYAuGrKT+BZg06O+gEzXDO67jX6iOKoKW+JxbV5iV+ H4RadHo4SG71KyrP3QujWlcPhUyQ8/U9QEq6RwFH+EKIn05XvQNBTqxFPZoyt2pdkwSG xGNWZfCieVv6AxrNGhXj0tf6snqFW/Zyv83reMnm9bgg7YmOQMu9a3OkIa/0yeQwFnfy MlHrI6RPbW/ZFu8FS5SA/j62BmAaVHH2WtdzB/8j0+o46mbcR0Nd+PxPSDQcYW4qkmze gYhw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=VL0H7Shcwl+YIcZBCayGzjoWVEomLjP4K2tJAN9NE9M=; fh=88JOSrUdazrPEXDdVL039GyE+IpoVzHYtodj2bK4eMs=; b=vDpUIRnRvu2yzz2gjy+4MaEBmeBDIrGuZdFxdyTOL7Uh3YpOUOTIgXX/+FDuGSGTGy wjY3+FrijvV3mOPX8t74yW2yAvdNwoNiTCFStwSHRXe6prBZ+FlxZqzpjNNNxE6RQG+F yG/JJxCsBXlYQViE3YIeqDQOVm8TsxCl59hzBJg48xsqtfOGbHWmDjSv7S2yarHIaXkz gIkmV5mI84WeulrLpkRUJ6slCExBOMVoVwPMLkJMfF+mKxw62PIyNV0T9MgJ8cw/+yS9 Am15OgctvetllOoYUbTLrXVEbEelABKXmYWMphuD/+qrLRG/d1UfPAIR0Io7+WNIDcZ8 6xSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-200139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2e1a72fcca58-7025e489cf4si326894b3a.126.2024.06.04.00.15.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 00:15:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-200139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-200139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-200139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EAB94282E8A for ; Tue, 4 Jun 2024 07:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C965D14037C; Tue, 4 Jun 2024 07:15:06 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AB1631384BD for ; Tue, 4 Jun 2024 07:15:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717485306; cv=none; b=AIHjUEtjuYuwohkMTavKMueyANTZ4GmJrT/sQPqYI04+wG1nFEecFNlt1K0YmPiYFAC3v/SBRkru+NRBDWU7GKvNN98uRb8tdvFYIsOf/o4fnBBHYWjbOmXGK/G8cto6Fhfmqtu/zWZplXG1KKl0jRwn/hLH4xX7gBkAbD/kvWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717485306; c=relaxed/simple; bh=BjJkIKcRhJcMNwuFbWpxRrGm5KJOyUquFeQv4/eVuSw=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=aNCMZIXtPkWJApJcMEjjdHETCj2g4hux4OHdoWNmADOKf45EnjkH9APzIQRQBvRWNlpDLvjEYoUlTbeKtFVU/OhBuzdowm51TxIKaj2Ws/ChEe589+cQHpUjis+au6rVIuRd0DI5AdNjW86sRLPnqx1mtpACKV9GhlUtB53fPR8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VthZy5HZBzxRV8; Tue, 4 Jun 2024 15:11:06 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 3E031180AA7; Tue, 4 Jun 2024 15:15:02 +0800 (CST) Received: from localhost.localdomain (10.175.104.67) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Tue, 4 Jun 2024 15:13:31 +0800 From: Zizhi Wo To: , , , CC: , , , Subject: [PATCH] cachefiles: modify inappropriate error return value in cachefiles_daemon_secctx Date: Tue, 4 Jun 2024 15:13:34 +0800 Message-ID: <20240604071334.3982185-1-wozizhi@huawei.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) 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 --- 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