Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1662080pxj; Wed, 19 May 2021 10:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2K7u2wI9aFFLXerceAKeDHCaCWgAVqXDBHTXk4BQjuktNEAQVvBAE06Hx8oJGAu5uVnCZ X-Received: by 2002:a05:6402:2814:: with SMTP id h20mr297004ede.102.1621446873467; Wed, 19 May 2021 10:54:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621446873; cv=none; d=google.com; s=arc-20160816; b=u2u1Dd2Utijo4vuyWo46aMDTMulU/eWM6cFvlFflgb3uce6DAZHZpeDTS7ow5jIsF5 eJjvXmoaiSPkm0ccNmgVGHQbA9zArclACcCMd4FtH+gCyAsccw2bJFdjhXXNfugAOALQ bTZIhcvviK+pj4kRlj5wJ/paEVi9UrH2NWDFhC2TVTKtmUek5LIJMb+j8niqFIDk2y9g KKUTno+LcLujbB3LcVT/HgZXn946sUTmZqNnnH5V4bXyEHwr4efcVWWnjsTXFDFXoiZg XURmuYA1CwCVJ4dp/7nCPvBil8EGTRMZhzAXyJAAVr9C/cM0Gxj9O102apm13k2ulltz EMpw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=BhaFf8xy+GXPFMZGO8zcjXeHUnTk89Nqhj2mh+DpfWA=; b=vpBo8I/XhtvUQ0p0XX7ReStJKoSDIGnIrIILbFBYdmen+Y2JkMOz2HBO+mg5tgWpQn D9PcMWyxytK/0n4PAXd1xfhg6UqJw/lX9hmx6i3AhVpAJcwUnhI83ySw9InEs0UeLhkt i7clwTLUchxAluvhwx2xil4v2PJoLkFlhM2tXjpOqRSvIbVkao+cxVLJMyb35pfVqBXf Dz+dZtIGQ6S/jk5DjTXFbmiFmm+i++Hm9efe7n9s2bxjUrikqLrGbHv0orVJx+OIx7Py pHXee+3WyzFwFETmxiocEB6nIHx5/D7+XSc24lMKzTUsdHltF6MAPrfoR/Q6lnvapwMY +4GQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si295639ejj.290.2021.05.19.10.54.09; Wed, 19 May 2021 10:54:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243846AbhERLMX (ORCPT + 99 others); Tue, 18 May 2021 07:12:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:58458 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241330AbhERLMW (ORCPT ); Tue, 18 May 2021 07:12:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 9E575AF19; Tue, 18 May 2021 11:11:03 +0000 (UTC) Received: from localhost (brahms [local]) by brahms (OpenSMTPD) with ESMTPA id 17e25bfa; Tue, 18 May 2021 11:10:57 +0000 (UTC) From: Luis Henriques To: Alexander Viro Cc: Nicolas Boichat , Amir Goldstein , Olga Kornievskaia , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, 0day robot , kernel test robot , Luis Henriques Subject: [PATCH] vfs: fix early copy_file_range return when len is zero Date: Tue, 18 May 2021 12:10:55 +0100 Message-Id: <20210518111055.16079-1-lhenriques@suse.de> In-Reply-To: <877dk1zibo.fsf@suse.de> References: <877dk1zibo.fsf@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The early return from copy_file_range when len is zero should check if the filesystem really implements this syscall, returning -EOPNOTSUPP if it doesn't, and 0 otherwise. Reported-by: kernel test robot Signed-off-by: Luis Henriques --- Hi! Since I got not feedback, I'm sending a patch that should fix this issue reported by 0day. Probably this should simply be squashed into v9, I can send v10 if you prefer that. Cheers, -- Luis fs/read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index 9db7adf160d2..24b4bf704765 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -1498,7 +1498,7 @@ ssize_t vfs_copy_file_range(struct file *file_in, loff_t pos_in, return ret; if (len == 0) - return 0; + return file_out->f_op->copy_file_range ? 0 : -EOPNOTSUPP; file_start_write(file_out);