diff options
author | Eric Sandeen <sandeen@redhat.com> | 2014-02-19 04:39:16 (GMT) |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-02-19 04:39:16 (GMT) |
commit | daba5427dad6b260256053f914de2c0b79f7a79f (patch) | |
tree | 65f5c19a6ba3c2d65ff69099cd48f14cb41342fe /fs/9p/vfs_super.c | |
parent | 82daa86a77e592b38b7fa3f533173d1a3c1299a1 (diff) | |
download | linux-daba5427dad6b260256053f914de2c0b79f7a79f.tar.xz |
xfs: skip verification on initial "guess" superblock read
When xfs_readsb() does the very first read of the superblock,
it makes a guess at the length of the buffer, based on the
sector size of the underlying storage. This may or may
not match the filesystem sector size in sb_sectsize, so
we can't i.e. do a CRC check on it; it might be too short.
In fact, mounting a filesystem with sb_sectsize larger
than the device sector size will cause a mount failure
if CRCs are enabled, because we are checksumming a length
which exceeds the buffer passed to it.
So always read twice; the first time we read with NULL
buffer ops to skip verification; then set the proper
read length, hook up the proper verifier, and give it
another go.
Once we are sure that we've got the right buffer length,
we can also use bp->b_length in the xfs_sb_read_verify,
rather than the less-trusted on-disk sectorsize for
secondary superblocks. Before this we ran the risk of
passing junk to the crc32c routines, which didn't always
handle extreme values.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/9p/vfs_super.c')
0 files changed, 0 insertions, 0 deletions