mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chengyu Song <csong84@gatech.edu>
To: dushistov@mail.ru, linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, changwoo@gatech.edu, sanidhya@gatech.edu,
	blee@gatech.edu, csong84@gatech.edu
Subject: [PATCH 1/1] ufs: missing check for block_truncate_page
Date: Tue, 24 Mar 2015 21:31:16 -0400	[thread overview]
Message-ID: <1427247076-9873-1-git-send-email-csong84@gatech.edu> (raw)

block_truncate_page may fail under certain circumstances, so its result
should be checked.

Signed-off-by: Chengyu Song <csong84@gatech.edu>
---
 fs/ufs/truncate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index f04f89f..8b41f07 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -464,7 +464,12 @@ int ufs_truncate(struct inode *inode, loff_t old_i_size)
 		goto out;
 	}
 
-	block_truncate_page(inode->i_mapping, inode->i_size, ufs_getfrag_block);
+	err = block_truncate_page(inode->i_mapping, inode->i_size, ufs_getfrag_block);
+
+	if (err) {
+		i_size_write(inode, old_i_size);
+		goto out;
+	}
 
 	while (1) {
 		retry = ufs_trunc_direct(inode);
-- 
2.1.0


                 reply	other threads:[~2015-03-25  1:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1427247076-9873-1-git-send-email-csong84@gatech.edu \
    --to=csong84@gatech.edu \
    --cc=blee@gatech.edu \
    --cc=changwoo@gatech.edu \
    --cc=dushistov@mail.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sanidhya@gatech.edu \
    --cc=taesoo@gatech.edu \
    /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

all inboxes | Powered by JetHome®