Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp3668434ima; Mon, 4 Feb 2019 03:08:24 -0800 (PST) X-Google-Smtp-Source: ALg8bN4du6GzExB2gOwFTd5RippLL514aedcOqfsW1L/B0fNN4za4PjGGVpYJ4k2/eCigcUr5EL5 X-Received: by 2002:a17:902:2867:: with SMTP id e94mr51832358plb.264.1549278504724; Mon, 04 Feb 2019 03:08:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549278504; cv=none; d=google.com; s=arc-20160816; b=UjZMkA7jrV8KET6Y7ezXsn0QmB01RqwwVlip2dKwQp7TV7GN88q+KDWeUz1sMTd+Ss OqmhyqntMkfLnoUu4M3IBqRUhtjPz/h9PHJYgN2qPDu/aTm1t8aPFbd/LZkwa61Wk7Z4 fgzsUqjCa8bBIWvVX0jbiO61yHR345FpfosieCLjTnlW2all5LYYcZZO8orlKV++FPcq ctspQP4esjxBlwOI0NRtCq/nkrVAiYiO90N5y5xYaT0GMv9LV1UI718GlyvxYMwDWCXE uRESmKOmE4ahyU9LTgll1S7jh3TSt/Uv3olnHvvxc7C7duUDdlY3l3rtK+on4pxD4wtA qvvA== 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=j2ZkiZ8uJJ3eTg4aptYXOqhXydNnqAbosq6m28f62d8=; b=k5M91CfA6VKUqvvt+ZWZKB/7HCNarScTrLL2o58UpYM9bn/DpyIf0AHftU2UGDqhmg 6MsmWtOzPlOYW/sz58ps8y3CN7r9AoPhBnBzyC/A43Q5Y2+k562JLuJC9ANAFbniLoD/ hwK8MjpqJHMcmfOilgdF1l0JQzeuIldYBh/87RJUcqJcONkRqmDRHroY8QL1ZdmR0aCc 8MVm5TXTQ898/NPu7GjsjI3il6OoVzj1W/HtUccSDYT7H78JcjRhzDu4KEGLbGyP0HOf GNZbpIIoGXdCCyQiRMy90jBL4aeWouXtp2/1YaHudyL7QVk0UTgqqHlc6XHieoWV7+en 36Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Fvup3GSY; 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 133si7978779pgc.588.2019.02.04.03.08.08; Mon, 04 Feb 2019 03:08:24 -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=Fvup3GSY; 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 S1730209AbfBDLHU (ORCPT + 99 others); Mon, 4 Feb 2019 06:07:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:40766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730058AbfBDKmv (ORCPT ); Mon, 4 Feb 2019 05:42:51 -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 448392075B; Mon, 4 Feb 2019 10:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549276970; bh=WC3lcSfXq+qepRddDR5APUERI/tIxULighkF1x31Y20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fvup3GSY0OKLwc+kO0K1HTvDeh2mOcesf0Bm5uPdTiU4kW5XHmAHsnM7QYog9EaOf Q4Hum26AV3DHx5Bk85iGNYSvJ+umDtdzf0anPV1SXTD6SLsZsTK9rwvV688Ul594bm 8lvux7AWlrL273W33BjggaCW4uMC193UpLt83bZA= 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.9 02/30] fs: add the fsnotify call to vfs_iter_write Date: Mon, 4 Feb 2019 11:36:40 +0100 Message-Id: <20190204103605.753504085@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190204103605.271746870@linuxfoundation.org> References: <20190204103605.271746870@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.9-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 @@ -392,8 +392,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);