Source-Changes-HG archive

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

[src/trunk]: src/sys/ufs/ext2fs Check that we can handle the inode size befor...



details:   https://anonhg.NetBSD.org/src/rev/414c6f172356
branches:  trunk
changeset: 481434:414c6f172356
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Jan 31 11:34:55 2000 +0000

description:
Check that we can handle the inode size before mounting the fs, and correct
a return value.

diffstat:

 sys/ufs/ext2fs/ext2fs_vfsops.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r f1a076c485f4 -r 414c6f172356 sys/ufs/ext2fs/ext2fs_vfsops.c
--- a/sys/ufs/ext2fs/ext2fs_vfsops.c    Mon Jan 31 11:08:53 2000 +0000
+++ b/sys/ufs/ext2fs/ext2fs_vfsops.c    Mon Jan 31 11:34:55 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_vfsops.c,v 1.32 2000/01/28 16:00:23 bouyer Exp $        */
+/*     $NetBSD: ext2fs_vfsops.c,v 1.33 2000/01/31 11:34:55 bouyer Exp $        */
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -521,10 +521,6 @@
        if (error)
                goto out;
        fs = (struct ext2fs *)bp->b_data;
-       if (fs2h16(fs->e2fs_magic) != E2FS_MAGIC) {
-               error = EINVAL;         /* XXX needs translation */
-               goto out;
-       }
        error = ext2fs_checksb(fs, ronly);
        if (error)
                goto out;
@@ -1060,10 +1056,15 @@
                return (EIO);      /* XXX needs translation */
        }
        if (fs2h32(fs->e2fs_rev) > E2FS_REV0) {
+               if (fs2h32(fs->e2fs_first_ino) != EXT2_FIRSTINO ||
+                   fs2h16(fs->e2fs_inode_size) != EXT2_DINODE_SIZE) {
+                       printf("Ext2 fs: unsupported inode size\n");
+                       return (EINVAL);      /* XXX needs translation */
+               }
                if (fs2h32(fs->e2fs_features_incompat) &
                    ~EXT2F_INCOMPAT_SUPP) {
                        printf("Ext2 fs: unsupported optionnal feature\n");
-                       return (EIO);      /* XXX needs translation */
+                       return (EINVAL);      /* XXX needs translation */
                }
                if (!ronly && fs2h32(fs->e2fs_features_rocompat) &
                    ~EXT2F_ROCOMPAT_SUPP) {



Home | Main Index | Thread Index | Old Index