Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libsa When searching for the superblock, check that ...



details:   https://anonhg.NetBSD.org/src/rev/e45e12182585
branches:  trunk
changeset: 559570:e45e12182585
user:      dsl <dsl%NetBSD.org@localhost>
date:      Sat Mar 20 14:24:59 2004 +0000

description:
When searching for the superblock, check that the fs_sblockloc field
matches the location we read it from to ensure we don't have one of the
alternate superblocks.
Fixes part of PR kern/24809

diffstat:

 sys/lib/libsa/ufs.c |  5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diffs (19 lines):

diff -r 1e9a0f3199eb -r e45e12182585 sys/lib/libsa/ufs.c
--- a/sys/lib/libsa/ufs.c       Sat Mar 20 14:09:44 2004 +0000
+++ b/sys/lib/libsa/ufs.c       Sat Mar 20 14:24:59 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs.c,v 1.42 2003/08/31 22:40:49 fvdl Exp $    */
+/*     $NetBSD: ufs.c,v 1.43 2004/03/20 14:24:59 dsl Exp $     */
 
 /*-
  * Copyright (c) 1993
@@ -496,6 +496,9 @@
                    sblock_try[i] / DEV_BSIZE, SBLOCKSIZE, fs, &buf_size);
                if (rc != 0 || buf_size != SBLOCKSIZE)
                        return rc;
+               if (fs->fs_sblockloc != sblock_try[i])
+                       /* an alternate superblock - try again */
+                       continue;
                if (fs->fs_magic == FS_UFS2_MAGIC) {
                        return 0;
                }



Home | Main Index | Thread Index | Old Index