Skip to contentSkip to conversation

+ ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Oct 30, 2013 OCFS2

lore
Share & tools
lore
#0 lore raw

Subject: + ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Wed, 30 Oct 2013 15:52:36 -0700

The patch titled
Subject: ocfs2: fix possible double free in ocfs2_write_begin_nolock
has been added to the -mm tree. Its filename is
ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Xue jiufei <[email protected]>
Subject: ocfs2: fix possible double free in ocfs2_write_begin_nolock

When ocfs2_write_cluster_by_desc() failed in ocfs2_write_begin_nolock() because of ENOSPC, it goes to out_quota, freeing data_ac(meta_ac). Then it calls ocfs2_try_to_free_truncate_log() to free space. If enough space freed, it will try to write again. Unfortunately, some error happenes before ocfs2_lock_allocators(), it goes to out and free data_ac(meta_ac) again.

---

 fs/ocfs2/aops.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/aops.c renamed from fs/ocfs2/aops.c~ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock +6 -2
diff -puN fs/ocfs2/aops.c~ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock fs/ocfs2/aops.c
@@ -1898,10 +1898,14 @@ out_commit:
 out:
 	ocfs2_free_write_ctxt(wc);
 
-	if (data_ac)
+	if (data_ac) {
 		ocfs2_free_alloc_context(data_ac);
-	if (meta_ac)
+		data_ac = NULL;
+	}
+	if (meta_ac) {
 		ocfs2_free_alloc_context(meta_ac);
+		meta_ac = NULL;
+	}
 
 	if (ret == -ENOSPC && try_free) {
 		/*

_

Patches currently in -mm which might be from [email protected] are

ocfs2-skip-locks-in-the-blocked-list.patch ocfs2-delay-migration-when-the-lockres-is-in-migration-state.patch ocfs2-fix-possible-double-free-in-ocfs2_write_begin_nolock.patch