linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] repair: ensure that unused superblock fields are zeroed
@ 2014-03-11  6:22 Dave Chinner
  2014-03-11 13:29 ` Eric Sandeen
  0 siblings, 1 reply; 2+ messages in thread
From: Dave Chinner @ 2014-03-11  6:22 UTC (permalink / raw)
  To: xfs

From: Dave Chinner <dchinner@redhat.com>

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 ned 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>
---
 repair/sb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/repair/sb.c b/repair/sb.c
index b111aca..d928dc0 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 */
 
-- 
1.9.0

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] repair: ensure that unused superblock fields are zeroed
  2014-03-11  6:22 [PATCH] repair: ensure that unused superblock fields are zeroed Dave Chinner
@ 2014-03-11 13:29 ` Eric Sandeen
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Sandeen @ 2014-03-11 13:29 UTC (permalink / raw)
  To: Dave Chinner, xfs

On 3/11/14, 1:22 AM, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
> 
> 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 ned 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>

cool, thanks for finding that "overnight."  :)

Reviewed-by: Eric Sandeen <sandeen@redhat.com>

> ---
>  repair/sb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/repair/sb.c b/repair/sb.c
> index b111aca..d928dc0 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 */
>  
> 

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-11 13:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-11  6:22 [PATCH] repair: ensure that unused superblock fields are zeroed Dave Chinner
2014-03-11 13:29 ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).