Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2745689imj; Mon, 11 Feb 2019 07:52:49 -0800 (PST) X-Google-Smtp-Source: AHgI3IYsdlHA42g8fv4m5Lc1Cj9rvRsioUjwqabclRACOucCQYY15vkUXhJku6MLFZ8s80lMs/9G X-Received: by 2002:a62:39c5:: with SMTP id u66mr10066487pfj.245.1549900369531; Mon, 11 Feb 2019 07:52:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900369; cv=none; d=google.com; s=arc-20160816; b=Zl9UCsc6Bj6TRBIwXuIEj1NZUycNUzTxHkjmZJPFRwGTxKrVTdLsVvh4EpPS1BOSng CX4l0hKE1F3t5knnvmW88baIKh+ZOzs87FnS2HRG9W9n4+kYtq6fbnmysicHN1gpl8AH 83H6NnIESVxwMVxLqiIIQdISHgqDgrh918n4NdDDsoaGYo1c41VdwRk/A2rB4ZidJ1wJ 9dukQBS8Lps7FoqdplQYd1opJxEo5aEgDOdXudr0lm+O5ge7PPPy2hu8oovFVRh5qi0Q k0F79vuSE5pDr9iFTK8rcdA2unOcQib/soNifXOtgyh+U1b46EDJWli4VJWVlhGfM3wL jGqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=98goJ+m3VqNNAJveKbppqGFoUkiZMDRragrlWfcvIO8=; b=ahNrxGJzRV2rCRKSqx6qIbW+iADHS8TjAmId7o1RWHW9jNV/lWF+F42E92xdTiSo/P 4z45etGPQMiwmxpwHbtWvZohlAb95mbMF8gFWbtoHJK/syx5LWa1kUejmep9uvGDfU1Z JtXyDTzo5pB4RVFQ9dvGflEMS4iqx+Wmdg6tVC99bEJn3R+RTaLEnc0GdoVpI7xsetIZ cQ+2pOY4yVaHCokktscCfjjlzg3pa4KUgVhZlmp5EN8rhjqvlY4UTBw8BQB+E6sb6jLW KYfR7n9pl7T1lam0FVUEShPjU1hGgcZYG9jix1i4KpStb9+wrV3QFFgQY5li1mqnqWzX hnzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0K5S66hm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z29si10567122pfi.9.2019.02.11.07.52.32; Mon, 11 Feb 2019 07:52:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0K5S66hm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732092AbfBKPvm (ORCPT + 99 others); Mon, 11 Feb 2019 10:51:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:47402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731553AbfBKOhx (ORCPT ); Mon, 11 Feb 2019 09:37:53 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BE18D20844; Mon, 11 Feb 2019 14:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895873; bh=CvxiI0nAxvN+iYp7nAoz9JMbZ6ZRnka4PQCjBLnkrUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0K5S66hmZOADU2UW/Eb0lznOWrdTXgOkRLxnhJkjh+5iTwyxWUHOdQdZr5cans1wC qNY9m/Mbh/BJYasP5KFCAAzY0ooUxKoVH+oA7xzOIy651afbknischMfHOsivarqeE qXm0dYtuGXBCR2QZRluJvMjnG2qWqiWtd1IMaxWY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , "J. Bruce Fields" Subject: [PATCH 4.20 352/352] nfsd: Fix error return values for nfsd4_clone_file_range() Date: Mon, 11 Feb 2019 15:19:39 +0100 Message-Id: <20190211141909.565234680@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Trond Myklebust commit e3fdc89ca47ef34dfb6fd5101fec084c3dba5486 upstream. If the parameter 'count' is non-zero, nfsd4_clone_file_range() will currently clobber all errors returned by vfs_clone_file_range() and replace them with EINVAL. Fixes: 42ec3d4c0218 ("vfs: make remap_file_range functions take and...") Signed-off-by: Trond Myklebust Cc: stable@vger.kernel.org # v4.20+ Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/vfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -544,9 +544,11 @@ __be32 nfsd4_clone_file_range(struct fil loff_t cloned; cloned = vfs_clone_file_range(src, src_pos, dst, dst_pos, count, 0); + if (cloned < 0) + return nfserrno(cloned); if (count && cloned != count) - cloned = -EINVAL; - return nfserrno(cloned < 0 ? cloned : 0); + return nfserrno(-EINVAL); + return 0; } ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,