From: Dave Chinner Date: Tue, 8 Apr 2014 08:47:35 +0000 (+1000) Subject: repair: ensure that unused superblock fields are zeroed X-Git-Tag: v3.2.0-rc1~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=419d647de6e1722f14fda1d4981ebaa9a3dd243c;p=thirdparty%2Fxfsprogs-dev.git repair: ensure that unused superblock fields are zeroed 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 Signed-off-by: Dave Chinner Reviewed-by: Eric Sandeen Signed-off-by: Dave Chinner --- diff --git a/repair/sb.c b/repair/sb.c index b111acad3..d928dc068 100644 --- a/repair/sb.c +++ b/repair/sb.c @@ -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 */