diff mbox

affs: add kunmap in error path

Message ID 1454378117-14999-1-git-send-email-wuninsu@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Insu Yun Feb. 2, 2016, 1:55 a.m. UTC
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(-)

Comments

Al Viro Feb. 2, 2016, 2:24 a.m. UTC | #1
On Mon, Feb 01, 2016 at 08:55:17PM -0500, Insu Yun wrote:
> When error occurs, it needs to unmap page.

Point, but...  I'm not sure there's any point in keeping it mapped all
along.  After all, what we are doing is a bunch of memcpy() into the
parts of page, so kmap_atomic()/kunmap_atomic() just around memcpy
would do just fine.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);