Squashfs: fix mount time sanity check for corrupted superblock
authorPhillip Lougher <phillip@squashfs.org.uk>
Mon, 2 Jan 2012 17:47:14 +0000 (17:47 +0000)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 12 Sep 2012 02:37:36 +0000 (03:37 +0100)
commit cc37f75a9ffbbfcb1c3297534f293c8284e3c5a6 upstream.

A Squashfs filesystem containing nothing but an empty directory,
although unusual and ultimately pointless, is still valid.

The directory_table >= next_table sanity check rejects these
filesystems as invalid because the directory_table is empty and
equal to next_table.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/squashfs/super.c

index 2da1715..4619247 100644 (file)
@@ -290,7 +290,7 @@ handle_fragments:
 
 check_directory_table:
        /* Sanity check directory_table */
 
 check_directory_table:
        /* Sanity check directory_table */
-       if (msblk->directory_table >= next_table) {
+       if (msblk->directory_table > next_table) {
                err = -EINVAL;
                goto failed_mount;
        }
                err = -EINVAL;
                goto failed_mount;
        }