From 7d5dd82a059bcc2948f733750408168989dcd820 Mon Sep 17 00:00:00 2001 From: ngkaho1234 Date: Tue, 1 Dec 2015 16:31:24 +0000 Subject: [PATCH] ext4_journal: do simple verification on jbd superblock. --- lwext4/ext4_journal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lwext4/ext4_journal.c b/lwext4/ext4_journal.c index e798590..83647b7 100644 --- a/lwext4/ext4_journal.c +++ b/lwext4/ext4_journal.c @@ -150,6 +150,12 @@ int jbd_get_fs(struct ext4_fs *fs, if (rc != EOK) { memset(jbd_fs, 0, sizeof(struct jbd_fs)); ext4_fs_put_inode_ref(&jbd_fs->inode_ref); + return rc; + } + if (!jbd_verify_sb(&jbd_fs->sb)) { + memset(jbd_fs, 0, sizeof(struct jbd_fs)); + ext4_fs_put_inode_ref(&jbd_fs->inode_ref); + rc = EIO; } return rc;