Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp387671rwb; Thu, 18 Aug 2022 05:47:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6IjHVmoxR0kvLEXZ+QgmmTyG4QGBONVcW4nTCsrTVrEPSaUyd4hYQvNP4hynEOlzyT39YO X-Received: by 2002:a17:90b:1e50:b0:1f5:4f69:d6b8 with SMTP id pi16-20020a17090b1e5000b001f54f69d6b8mr8755583pjb.34.1660826843364; Thu, 18 Aug 2022 05:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660826843; cv=none; d=google.com; s=arc-20160816; b=qe+vrO69uOoXx+A8esORR/nvZkUqs8D847i8zjiiRhALvCDwksrkeAnb/BmkcXqB3b MGCif/NqywQWX28V1Ysv/D0+DodD39LmU2jclbjq/y1csLKzTdWf2gp0d/2mDPA5soIx MvyattpmM8uDnPc/g5W2CSzNW9D+pQ/VGeorZYZh4WdMvc8obKfrCiv3njPiD9OrcjzW J89/B43Q3DNAOfDw2U0Q7D6fw0dScOv3l5PuKNTxUzmy5WKl9GD3RdWRTpnkUCtvT6sF c5puuyIcOKjLdE59eq/EVsZprR5w5y8RGZtBEf13kmPDfoGmUxjMxCrUcQGGZsZqY9vI a4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=vyDAcWzzPYXACvvwc9C3izvEE/iSzduBpG4cjDO+uO0=; b=h8l1D10966j8IEQO2O+d+4FVq4xjk4kDetYiMv7c37QF32duZ9qxBIGhWbpVENubOf amJ4L/6FgVzBqEVeo/PfEcuh9hRHmXnxRSG+qP2DS2Yv43o1n15zOjIqkvNZOJvJxq4Z Ygmr6yjgxhs/ukx9X8T95V9eovbpAzZY9K+ko+spP8V1HmyDtKn9tufKbFAWpWQjKntQ sDR2hILUL7BKf93APoBX1z//vn2grD88lZk9esuTEiFEGTefvnFLTT87b88Fr0Su4MGW tsGEFQUM8uyaRwhVcdtf0fLxfe/7+cyfIOF2+l/Y6rcFzF4hn+XG4q971AUWNMzeodC7 DdKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k71-20020a63844a000000b0041ba9bc9bdfsi1453159pgd.16.2022.08.18.05.47.12; Thu, 18 Aug 2022 05:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244104AbiHRMjK (ORCPT + 99 others); Thu, 18 Aug 2022 08:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235717AbiHRMjJ (ORCPT ); Thu, 18 Aug 2022 08:39:09 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02F874F6B6; Thu, 18 Aug 2022 05:39:07 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4M7ktN0gHtzGpcG; Thu, 18 Aug 2022 20:37:32 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 18 Aug 2022 20:39:05 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 18 Aug 2022 20:39:04 +0800 From: Sun Ke To: CC: , , , , , Subject: [PATCH v3] cachefiles: fix error return code in cachefiles_ondemand_copen() Date: Thu, 18 Aug 2022 20:50:38 +0800 Message-ID: <20220818125038.2247720-1-sunke32@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The cache_size field of copen is specified by the user daemon. If cache_size < 0, then the OPEN request is expected to fail, while copen itself shall succeed. However, returning 0 is indeed unexpected when cache_size is an invalid error code. Fix this by returning error when cache_size is an invalid error code. Fixes: c8383054506c ("cachefiles: notify the user daemon when looking up cookie") Signed-off-by: Sun Ke --- v3: update the commit log suggested by Jingbo. fs/cachefiles/ondemand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c index 1fee702d5529..ea8a1e8317d9 100644 --- a/fs/cachefiles/ondemand.c +++ b/fs/cachefiles/ondemand.c @@ -159,7 +159,7 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args) /* fail OPEN request if daemon reports an error */ if (size < 0) { if (!IS_ERR_VALUE(size)) - size = -EINVAL; + ret = size = -EINVAL; req->error = size; goto out; } -- 2.31.1