shithub: lwext4

Download patch

ref: 7d5dd82a059bcc2948f733750408168989dcd820
parent: 03375d29a9383d054febf5bca6ed6f50827de35f
author: ngkaho1234 <[email protected]>
date: Tue Dec 1 11:31:24 EST 2015

ext4_journal: do simple verification on jbd superblock.

--- a/lwext4/ext4_journal.c
+++ b/lwext4/ext4_journal.c
@@ -150,6 +150,12 @@
 	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;