From 110a7775bd4d28dd8ed28c2067e270b9c636b4db Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Mon, 4 May 1987 01:07:25 -0800 Subject: [PATCH] check ip before dereferencing (can only happen when called to mount root) SCCS-vsn: sys/ufs/ffs/ffs_vfsops.c 7.4 SCCS-vsn: sys/ufs/ffs/ufs_vfsops.c 7.4 SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 7.4 SCCS-vsn: sys/ufs/ufs/ufs_vfsops.c 7.4 --- usr/src/sys/ufs/ffs/ffs_vfsops.c | 4 ++-- usr/src/sys/ufs/ffs/ufs_vfsops.c | 4 ++-- usr/src/sys/ufs/lfs/lfs_vfsops.c | 4 ++-- usr/src/sys/ufs/ufs/ufs_vfsops.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/usr/src/sys/ufs/ffs/ffs_vfsops.c b/usr/src/sys/ufs/ffs/ffs_vfsops.c index e6f3cdfbfd..c6e043b4df 100644 --- a/usr/src/sys/ufs/ffs/ffs_vfsops.c +++ b/usr/src/sys/ufs/ffs/ffs_vfsops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ffs_vfsops.c 7.3 (Berkeley) %G% + * @(#)ffs_vfsops.c 7.4 (Berkeley) %G% */ #include "param.h" @@ -222,7 +222,7 @@ found: 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) diff --git a/usr/src/sys/ufs/ffs/ufs_vfsops.c b/usr/src/sys/ufs/ffs/ufs_vfsops.c index 745f9b9ae5..c9b4003b0b 100644 --- a/usr/src/sys/ufs/ffs/ufs_vfsops.c +++ b/usr/src/sys/ufs/ffs/ufs_vfsops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_vfsops.c 7.3 (Berkeley) %G% + * @(#)ufs_vfsops.c 7.4 (Berkeley) %G% */ #include "param.h" @@ -222,7 +222,7 @@ found: 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) diff --git a/usr/src/sys/ufs/lfs/lfs_vfsops.c b/usr/src/sys/ufs/lfs/lfs_vfsops.c index bbdd699339..7111b0210e 100644 --- a/usr/src/sys/ufs/lfs/lfs_vfsops.c +++ b/usr/src/sys/ufs/lfs/lfs_vfsops.c @@ -3,7 +3,7 @@ * 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" @@ -222,7 +222,7 @@ found: 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) diff --git a/usr/src/sys/ufs/ufs/ufs_vfsops.c b/usr/src/sys/ufs/ufs/ufs_vfsops.c index 745f9b9ae5..c9b4003b0b 100644 --- a/usr/src/sys/ufs/ufs/ufs_vfsops.c +++ b/usr/src/sys/ufs/ufs/ufs_vfsops.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)ufs_vfsops.c 7.3 (Berkeley) %G% + * @(#)ufs_vfsops.c 7.4 (Berkeley) %G% */ #include "param.h" @@ -222,7 +222,7 @@ found: 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) -- 2.20.1