Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3670822ima; Mon, 4 Feb 2019 03:10:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN6FmzT3ZoE+9SyE5narM0GhT9MXG1LW0tK3mMI0AtYbfM6AkZK4KZHOzavMBvuxbcmaV4L4 X-Received: by 2002:a62:4e16:: with SMTP id c22mr49892173pfb.167.1549278631542; Mon, 04 Feb 2019 03:10:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278631; cv=none; d=google.com; s=arc-20160816; b=oAEbwcMcHw4fLneO4WukICkItwHS0+XXjYu9+bCETaAg8zFCBRxfpwhe9kr+P3TroV GZmDMwoSNoCwIb06CuuxYxxNXXtbhcaDNqoTkhfYBsLm7E1hGsyBPEju3Z1r/dOOdfzq U2uTsLsCvfzVVVepm7nSyzV3gKp32kCn6RwpBzZznhBVx8yO3u92UT8aDCaWSeSA0VpL c/ip3ECjWAPUost9ZIQOAHwINJf5tHtu2f1Cj6/mdD/dxkZGavIjkwk1YrPsoBuMfwIn gNXe2nsxuPhBPfayVUGKElZLlqsKXpmC6mhChvl4iW8Koh7AiqqBABP8eie9eYsIesjj CvOA== 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=JBy2bIwVxFQIZxUfK0MMVudiMazDjuyAEzl4fnuAKeE=; b=ckC+pGD8V592i3becBWLec53EPsaditSmPMGMY3ePbvBz3Jt9eaHEFao0cNMQWty9g i7nZtgCA2lQfNbNkeYFpHXGqgQ8+4HK8h8B+ZDVNSPOUDkk3tCAREJA/M0HwlMh9sQIT aD1n/5Xc68tyeeek65sc2+iMjybES3cP4bzuFUR8Xp/F6jTArPSp4d3rHtKR3udbZbi7 q7BCnUO1WhtLJf8zHf1tDaFcvDcxVYQVmq69IRBFuo/FXfDvlsyWpei/XMPz4fAy28fr oP54okKPBSTO7QFqgqQe7SHybfeJNq9GsNIwq+Lw8kbm311330Mdx2aAORZsNxJJ+acj 8srw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AhrUV2rz; 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 bi4si6656311plb.391.2019.02.04.03.10.15; Mon, 04 Feb 2019 03:10:31 -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=AhrUV2rz; 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 S1729984AbfBDLJW (ORCPT + 99 others); Mon, 4 Feb 2019 06:09:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:38718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730076AbfBDKkm (ORCPT ); Mon, 4 Feb 2019 05:40:42 -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 477312075B; Mon, 4 Feb 2019 10:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549276841; bh=KJ9WeQfJEpKfeE9XIRXQTGXFK4VL8Rg3ivyvB9Q0NGU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AhrUV2rzPGel/fE+zFcakXJciGDYxvUbla8OsR6u3U0D++f0bIpRHRGJmDgDCIdMp EYcQt3NS2rPx6zis2PPz6Rn3plHwBINwxGasbOU2kugq2EN3jINDCqnlu8Mb5kWLRr jc/uXelGhMpEJQVXYxouU7/act1r6eog+OFLS9j0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Richard Li , Chad Miller , Stefan Nuernberger , Frank Becker , Jimmy Durand Wesolowski Subject: [PATCH 4.4 33/65] fs: add the fsnotify call to vfs_iter_write Date: Mon, 4 Feb 2019 11:36:26 +0100 Message-Id: <20190204103616.442911772@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103610.583715954@linuxfoundation.org> References: <20190204103610.583715954@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.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jimmy Durand Wesolowski A bug has been discovered when redirecting splice output to regular files on EXT4 and tmpfs. Other filesystems might be affected. This commit fixes the issue for stable series kernel, using one of the change introduced during the rewrite and refactoring of vfs_iter_write in 4.13, specifically in the commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write"). This issue affects v4.4 and v4.9 stable series of kernels. Without this fix for v4.4 and v4.9 stable, the following upstream commits (and their dependencies would need to be backported): * commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write") * commit 18e9710ee59c ("fs: implement vfs_iter_read using do_iter_read") * commit edab5fe38c2c ("fs: move more code into do_iter_read/do_iter_write") * commit 19c735868dd0 ("fs: remove __do_readv_writev") * commit 26c87fb7d10d ("fs: remove do_compat_readv_writev") * commit 251b42a1dc64 ("fs: remove do_readv_writev") as well as the following dependencies: * commit bb7462b6fd64 ("vfs: use helpers for calling f_op->{read,write}_iter()") * commit 0f78d06ac1e9 ("vfs: pass type instead of fn to do_{loop,iter}_readv_writev()") * commit 7687a7a4435f ("vfs: extract common parts of {compat_,}do_readv_writev()") In order to reduce the changes, this commit uses only the part of commit abbb65899aec ("fs: implement vfs_iter_write using do_iter_write") that fixes the issue. This issue and the reproducer can be found on https://bugzilla.kernel.org/show_bug.cgi?id=85381 Reported-by: Richard Li Reported-by: Chad Miller Reviewed-by: Stefan Nuernberger Reviewed-by: Frank Becker Signed-off-by: Jimmy Durand Wesolowski --- fs/read_write.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/read_write.c +++ b/fs/read_write.c @@ -363,8 +363,10 @@ ssize_t vfs_iter_write(struct file *file iter->type |= WRITE; ret = file->f_op->write_iter(&kiocb, iter); BUG_ON(ret == -EIOCBQUEUED); - if (ret > 0) + if (ret > 0) { *ppos = kiocb.ki_pos; + fsnotify_modify(file); + } return ret; } EXPORT_SYMBOL(vfs_iter_write);