linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 19/35] jbd2: correctly unescape journal data blocks
@ 2008-03-20  0:00 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2008-03-20  0:00 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, duaneg, jack, linux-ext4, stable

From: "Duane Griffin" <duaneg@dghda.com>

Fix a long-standing typo (predating git) that will cause data corruption if a
journal data block needs unescaping.  At the moment the wrong buffer head's
data is being unescaped.

To test this case mount a filesystem with data=journal, start creating and
deleting a bunch of files containing only JBD2_MAGIC_NUMBER (0xc03b3998), then
pull the plug on the device.  Without this patch the files will contain zeros
instead of the correct data after recovery.

Signed-off-by: Duane Griffin <duaneg@dghda.com>
Acked-by: Jan Kara <jack@suse.cz>
Cc: <linux-ext4@vger.kernel.org>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/jbd2/recovery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN fs/jbd2/recovery.c~jbd2-correctly-unescape-journal-data-blocks fs/jbd2/recovery.c
--- a/fs/jbd2/recovery.c~jbd2-correctly-unescape-journal-data-blocks
+++ a/fs/jbd2/recovery.c
@@ -535,7 +535,7 @@ static int do_one_pass(journal_t *journa
 					memcpy(nbh->b_data, obh->b_data,
 							journal->j_blocksize);
 					if (flags & JBD2_FLAG_ESCAPE) {
-						*((__be32 *)bh->b_data) =
+						*((__be32 *)nbh->b_data) =
 						cpu_to_be32(JBD2_MAGIC_NUMBER);
 					}
 
_

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-20  0:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-20  0:00 [patch 19/35] jbd2: correctly unescape journal data blocks akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).