stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Miklos Szeredi <mszeredi@redhat.com>
Subject: [PATCH 4.4 04/31] fuse: fix fuse_write_end() if zero bytes were copied
Date: Thu, 24 Nov 2016 15:55:25 +0100	[thread overview]
Message-ID: <20161124145447.202586482@linuxfoundation.org> (raw)
In-Reply-To: <20161124145446.993225208@linuxfoundation.org>

4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Miklos Szeredi <mszeredi@redhat.com>

commit 59c3b76cc61d1d676f965c192cc7969aa5cb2744 upstream.

If pos is at the beginning of a page and copied is zero then page is not
zeroed but is marked uptodate.

Fix by skipping everything except unlock/put of page if zero bytes were
copied.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Fixes: 6b12c1b37e55 ("fuse: Implement write_begin/write_end callbacks")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/fuse/file.c |    6 ++++++
 1 file changed, 6 insertions(+)

--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1997,6 +1997,10 @@ static int fuse_write_end(struct file *f
 {
 	struct inode *inode = page->mapping->host;
 
+	/* Haven't copied anything?  Skip zeroing, size extending, dirtying. */
+	if (!copied)
+		goto unlock;
+
 	if (!PageUptodate(page)) {
 		/* Zero any unwritten bytes at the end of the page */
 		size_t endoff = (pos + copied) & ~PAGE_CACHE_MASK;
@@ -2007,6 +2011,8 @@ static int fuse_write_end(struct file *f
 
 	fuse_write_update_size(inode, pos + copied);
 	set_page_dirty(page);
+
+unlock:
 	unlock_page(page);
 	page_cache_release(page);
 



  parent reply	other threads:[~2016-11-24 14:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161124145446.993225208@linuxfoundation.org>
2016-11-24 14:55 ` [PATCH 4.4 01/31] x86/cpu/AMD: Fix cpu_llc_id for AMD Fam17h systems Greg Kroah-Hartman
2016-11-24 14:55 ` Greg Kroah-Hartman [this message]
2016-11-24 14:55 ` [PATCH 4.4 05/31] mfd: intel-lpss: Do not put device in reset state on suspend Greg Kroah-Hartman
2016-11-24 15:25   ` Shaikh, Azhar
2016-11-24 14:55 ` [PATCH 4.4 06/31] can: bcm: fix warning in bcm_connect/proc_register Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 07/31] i2c: mux: fix up dependencies Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 09/31] scripts/has-stack-protector: add -fno-PIE Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 10/31] x86/kexec: " Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 11/31] kbuild: Steal gccs pie from the very beginning Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 12/31] ext4: sanity check the block and cluster size at mount time Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 15/31] clk: mmp: pxa910: fix return value check in pxa910_clk_init() Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 16/31] clk: mmp: pxa168: fix return value check in pxa168_clk_init() Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 17/31] clk: mmp: mmp2: fix return value check in mmp2_clk_init() Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 18/31] rtc: omap: Fix selecting external osc Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 19/31] iwlwifi: pcie: fix SPLC structure parsing Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 20/31] mfd: core: Fix device reference leak in mfd_clone_cell Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 21/31] uwb: fix device reference leaks Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 22/31] PM / sleep: fix device reference leak in test_suspend Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 23/31] PM / sleep: dont suspend parent when async child suspend_{noirq, late} fails Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 24/31] IB/mlx4: Check gid_index return value Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 25/31] IB/mlx4: Fix create CQ error flow Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 26/31] IB/mlx5: Use cache line size to select CQE stride Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 27/31] IB/mlx5: Fix fatal error dispatching Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 28/31] IB/core: Avoid unsigned int overflow in sg_alloc_table Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 29/31] IB/uverbs: Fix leak of XRC target QPs Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 30/31] IB/cm: Mark stale CM ids whenever the mad agent was unregistered Greg Kroah-Hartman
2016-11-24 14:55 ` [PATCH 4.4 31/31] netfilter: nft_dynset: fix element timeout for HZ != 1000 Greg Kroah-Hartman
2016-11-24 23:13 ` [PATCH 4.4 00/31] 4.4.35-stable review Guenter Roeck
     [not found] ` <5837c0c8.54161c0a.7b168.f7d1@mx.google.com>
2016-11-25  9:47   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161124145447.202586482@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mszeredi@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).