check ip before dereferencing (can only happen when called to mount root)
[unix-history] / usr / src / sys / ufs / lfs / lfs_vfsops.c
index bbdd699..7111b02 100644 (file)
@@ -3,7 +3,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)lfs_vfsops.c        7.3 (Berkeley) %G%
+ *     @(#)lfs_vfsops.c        7.4 (Berkeley) %G%
  */
 
 #include "param.h"
  */
 
 #include "param.h"
@@ -222,7 +222,7 @@ found:
 out:
        if (error == 0)
                error = EIO;
 out:
        if (error == 0)
                error = EIO;
-       if (needclose)
+       if (needclose && ip)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)
                (void) closei((dev_t)ip->i_rdev, IFBLK,
                    ronly? FREAD : FREAD|FWRITE);
        if (needclose)