linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Insu Yun <wuninsu@gmail.com>
To: akpm@linux-foundation.org, viro@zeniv.linux.org.uk,
	fabf@skynet.be, osandov@osandov.com, geert@linux-m68k.org,
	tsgatesv@gmail.com, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu,
	changwoo@gatech.edu, Insu Yun <wuninsu@gmail.com>
Subject: [PATCH] affs: add kunmap in error path
Date: Mon,  1 Feb 2016 20:55:17 -0500	[thread overview]
Message-ID: <1454378117-14999-1-git-send-email-wuninsu@gmail.com> (raw)

When error occurs, it needs to unmap page.

Signed-off-by: Insu Yun <wuninsu@gmail.com>
---
 fs/affs/file.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/affs/file.c b/fs/affs/file.c
index 0548c53..fa4f24e 100644
--- a/fs/affs/file.c
+++ b/fs/affs/file.c
@@ -520,8 +520,10 @@ affs_do_readpage_ofs(struct page *page, unsigned to)
 
 	while (pos < to) {
 		bh = affs_bread_ino(inode, bidx, 0);
-		if (IS_ERR(bh))
+		if (IS_ERR(bh)) {
+			kunmap(page);
 			return PTR_ERR(bh);
+		}
 		tmp = min(bsize - boff, to - pos);
 		BUG_ON(pos + tmp > to || tmp > bsize);
 		memcpy(data + pos, AFFS_DATA(bh) + boff, tmp);
-- 
1.9.1

             reply	other threads:[~2016-02-02  1:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02  1:55 Insu Yun [this message]
2016-02-02  2:24 ` [PATCH] affs: add kunmap in error path Al Viro
2016-02-02  2:28   ` Al Viro

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=1454378117-14999-1-git-send-email-wuninsu@gmail.com \
    --to=wuninsu@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=changwoo@gatech.edu \
    --cc=fabf@skynet.be \
    --cc=geert@linux-m68k.org \
    --cc=insu@gatech.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=osandov@osandov.com \
    --cc=taesoo@gatech.edu \
    --cc=tsgatesv@gmail.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=yeongjin.jang@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;
as well as URLs for NNTP newsgroup(s).