From: Jan Kara Date: Tue, 24 Feb 2009 21:13:18 +0000 (-0500) Subject: jbd2: Avoid possible NULL dereference in jbd2_journal_begin_ordered_truncate() X-Git-Tag: v2.6.27.20~9 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fb05f46cabf4c96f5f8648c6a85d897ed57b1c94;p=pandora-kernel.git jbd2: Avoid possible NULL dereference in jbd2_journal_begin_ordered_truncate() (cherry picked from commit 7f5aa215088b817add9c71914b83650bdd49f8a9) If we race with commit code setting i_transaction to NULL, we could possibly dereference it. Proper locking requires the journal pointer (to access journal->j_list_lock), which we don't have. So we have to change the prototype of the function so that filesystem passes us the journal pointer. Also add a more detailed comment about why the function jbd2_journal_begin_ordered_truncate() does what it does and how it should be used. Thanks to Dan Carpenter for pointing to the suspitious code. Signed-off-by: Jan Kara Signed-off-by: "Theodore Ts'o" Acked-by: Joel Becker CC: linux-ext4@vger.kernel.org CC: mfasheh@suse.de CC: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed