diff options
| author | ngkaho1234 <ngkaho1234@gmail.com> | 2016-01-02 10:50:47 +0000 |
|---|---|---|
| committer | gkostka <kostka.grzegorz@gmail.com> | 2016-01-02 12:19:03 +0100 |
| commit | b4f36a128a7826b7343c8181b1ab34fe48ebfc18 (patch) | |
| tree | f7773dd82816772e21e22974492cff562040e43d | |
| parent | c261c575aa8026aa4942cfabd5b61788b80b8ebb (diff) | |
ext4_journal: fix transaction sequence not being checksummed.
| -rw-r--r-- | lwext4/ext4_journal.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lwext4/ext4_journal.c b/lwext4/ext4_journal.c index 47bdf48..93ab885 100644 --- a/lwext4/ext4_journal.c +++ b/lwext4/ext4_journal.c @@ -291,7 +291,8 @@ static bool jbd_verify_commit_csum(struct jbd_fs *jbd_fs, * JBD_FEATURE_COMPAT_CHECKSUM is enabled. */ static uint32_t jbd_block_csum(struct jbd_fs *jbd_fs, const void *buf, - uint32_t csum) + uint32_t csum, + uint32_t sequence) { uint32_t checksum = 0; @@ -300,6 +301,9 @@ static uint32_t jbd_block_csum(struct jbd_fs *jbd_fs, const void *buf, /* First calculate crc32c checksum against fs uuid */ checksum = ext4_crc32c(EXT4_CRC32_INIT, jbd_fs->sb.uuid, sizeof(jbd_fs->sb.uuid)); + /* Then calculate crc32c checksum against sequence no. */ + checksum = ext4_crc32c(checksum, &sequence, + sizeof(uint32_t)); /* Calculate crc32c checksum against tho whole block */ checksum = ext4_crc32c(checksum, buf, block_size); @@ -1697,7 +1701,8 @@ static int jbd_journal_prepare(struct jbd_journal *journal, } checksum = jbd_block_csum(journal->jbd_fs, jbd_buf->block.data, - checksum); + checksum, + trans->trans_id); again: if (!desc_iblock) { struct jbd_bhdr *bhdr; |
