Skip to content

Commit 2ff55e9

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus: Squashfs: Fix sanity check patches on big-endian systems
2 parents daa9422 + d5b72ce commit 2ff55e9

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎fs/squashfs/export.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ __le64 *squashfs_read_inode_lookup_table(struct super_block *sb,
147147
* table[0] points to the first inode lookup table metadata block,
148148
* this should be less than lookup_table_start
149149
*/
150-
if (!IS_ERR(table) && table[0] >= lookup_table_start) {
150+
if (!IS_ERR(table) && le64_to_cpu(table[0]) >= lookup_table_start) {
151151
kfree(table);
152152
return ERR_PTR(-EINVAL);
153153
}

‎fs/squashfs/fragment.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ __le64 *squashfs_read_fragment_index_table(struct super_block *sb,
9090
* table[0] points to the first fragment table metadata block, this
9191
* should be less than fragment_table_start
9292
*/
93-
if (!IS_ERR(table) && table[0] >= fragment_table_start) {
93+
if (!IS_ERR(table) && le64_to_cpu(table[0]) >= fragment_table_start) {
9494
kfree(table);
9595
return ERR_PTR(-EINVAL);
9696
}

‎fs/squashfs/id.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ __le64 *squashfs_read_id_index_table(struct super_block *sb,
9393
* table[0] points to the first id lookup table metadata block, this
9494
* should be less than id_table_start
9595
*/
96-
if (!IS_ERR(table) && table[0] >= id_table_start) {
96+
if (!IS_ERR(table) && le64_to_cpu(table[0]) >= id_table_start) {
9797
kfree(table);
9898
return ERR_PTR(-EINVAL);
9999
}

‎fs/squashfs/super.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
245245
msblk->id_table = NULL;
246246
goto failed_mount;
247247
}
248-
next_table = msblk->id_table[0];
248+
next_table = le64_to_cpu(msblk->id_table[0]);
249249

250250
/* Handle inode lookup table */
251251
lookup_table_start = le64_to_cpu(sblk->lookup_table_start);
@@ -261,7 +261,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
261261
msblk->inode_lookup_table = NULL;
262262
goto failed_mount;
263263
}
264-
next_table = msblk->inode_lookup_table[0];
264+
next_table = le64_to_cpu(msblk->inode_lookup_table[0]);
265265

266266
sb->s_export_op = &squashfs_export_ops;
267267

@@ -286,7 +286,7 @@ static int squashfs_fill_super(struct super_block *sb, void *data, int silent)
286286
msblk->fragment_index = NULL;
287287
goto failed_mount;
288288
}
289-
next_table = msblk->fragment_index[0];
289+
next_table = le64_to_cpu(msblk->fragment_index[0]);
290290

291291
check_directory_table:
292292
/* Sanity check directory_table */

0 commit comments

Comments
 (0)