]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
repair: ensure that unused superblock fields are zeroed
authorDave Chinner <dchinner@redhat.com>
Tue, 8 Apr 2014 08:47:35 +0000 (18:47 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 8 Apr 2014 08:47:35 +0000 (18:47 +1000)
When we grab a superblock off disk via get_sb(), we don't know what
the in-memory superblock we are filling out contained. We need to
ensure that the entire structure is returned in an initialised
state regardless of which fields libxfs_sb_from_disk() populates
from disk. In this case, it doesn't populate the sb_crc field,
and so uninitialised values can escape through to disk on v4
filesystems because of this. This causes xfs/031 to fail on v4
filesystems.

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/sb.c

index b111acad30d275eb831141b5dd31c737e5dec2b6..d928dc0685c4755522bd7c080c8dce6ec68678fa 100644 (file)
@@ -518,6 +518,7 @@ get_sb(xfs_sb_t *sbp, xfs_off_t off, int size, xfs_agnumber_t agno)
                exit(1);
        }
        memset(buf, 0, size);
+       memset(sbp, 0, sizeof(*sbp));
 
        /* try and read it first */