Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597061 > unrolled thread

[PATCH 4.9 130/153] f2fs: fix a problem of using memory after free

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-03-10 11:50 +0100
Last post2017-03-10 11:50 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.9 130/153] f2fs: fix a problem of using memory after free Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-10 11:50 +0100

#1597061 — [PATCH 4.9 130/153] f2fs: fix a problem of using memory after free

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-10 11:50 +0100
Subject[PATCH 4.9 130/153] f2fs: fix a problem of using memory after free
Message-ID<tjqht-2KE-29@gated-at.bofh.it>
4.9-stable review patch.  If anyone has any objections, please let me know.

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

From: Yunlei He <heyunlei@huawei.com>

commit 7855eba4d6102f811b6dd142d6c749f53b591fa3 upstream.

This patch fix a problem of using memory after free
in function __try_merge_extent_node.

Fixes: 0f825ee6e873 ("f2fs: add new interfaces for extent tree")
Signed-off-by: Yunlei He <heyunlei@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/f2fs/extent_cache.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--- a/fs/f2fs/extent_cache.c
+++ b/fs/f2fs/extent_cache.c
@@ -352,11 +352,12 @@ static struct extent_node *__try_merge_e
 	}
 
 	if (next_ex && __is_front_mergeable(ei, &next_ex->ei)) {
-		if (en)
-			__release_extent_node(sbi, et, prev_ex);
 		next_ex->ei.fofs = ei->fofs;
 		next_ex->ei.blk = ei->blk;
 		next_ex->ei.len += ei->len;
+		if (en)
+			__release_extent_node(sbi, et, prev_ex);
+
 		en = next_ex;
 	}
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web