lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Wed, 18 Mar 2015 11:33:32 +0100
From:	Lukas Czerner <lczerner@...hat.com>
To:	linux-ext4@...r.kernel.org
Cc:	Lukas Czerner <lczerner@...hat.com>
Subject: [PATCH] jbd: Fix possible uninitialized memory access when tracing

Currently in journal_commit_transaction() if trace point
trace_jbd_end_commit() is enabled, it can access already freed part of
the memory via commit_transaction because it might have already been
freed earlier using __journal_drop_transaction().

Fix it by moving the tracepoint before the point where we can free
commit_transaction and set the commit_transaction to NULL after we free
it to make such cases easier to detect in the future.

Signed-off-by: Lukas Czerner <lczerner@...hat.com>
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
---
 fs/jbd/commit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/jbd/commit.c b/fs/jbd/commit.c
index bb217dc..169cf72 100644
--- a/fs/jbd/commit.c
+++ b/fs/jbd/commit.c
@@ -991,10 +991,12 @@ restart_loop:
 		journal->j_average_commit_time = commit_time;
 
 	spin_unlock(&journal->j_state_lock);
+	trace_jbd_end_commit(journal, commit_transaction);
 
 	if (commit_transaction->t_checkpoint_list == NULL &&
 	    commit_transaction->t_checkpoint_io_list == NULL) {
 		__journal_drop_transaction(journal, commit_transaction);
+		commit_transaction = NULL;
 	} else {
 		if (journal->j_checkpoint_transactions == NULL) {
 			journal->j_checkpoint_transactions = commit_transaction;
@@ -1013,7 +1015,6 @@ restart_loop:
 	}
 	spin_unlock(&journal->j_list_lock);
 
-	trace_jbd_end_commit(journal, commit_transaction);
 	jbd_debug(1, "JBD: commit %d complete, head %d\n",
 		  journal->j_commit_sequence, journal->j_tail_sequence);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ