Check if the type of device node isn't VBAD before touching v_specinfo. If

the device vnode is revoked, the field is NULL and touching it causes null
pointer derefercence.
This commit is contained in:
enami 1999-10-20 14:32:09 +00:00
parent 07ba439fc9
commit fee96e1746
8 changed files with 24 additions and 16 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: advfsops.c,v 1.38 1999/10/18 19:52:24 wrstuden Exp $ */
/* $NetBSD: advfsops.c,v 1.39 1999/10/20 14:32:09 enami Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@ -300,7 +300,8 @@ adosfs_unmount(mp, mntflags, p)
if ((error = vflush(mp, NULLVP, flags)) != 0)
return (error);
amp = VFSTOADOSFS(mp);
amp->devvp->v_specflags &= ~SI_MOUNTEDON;
if (amp->devvp->v_type != VBAD)
amp->devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(amp->devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(amp->devvp, FREAD, NOCRED, p);
vput(amp->devvp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: filecore_vfsops.c,v 1.8 1999/10/16 23:53:27 wrstuden Exp $ */
/* $NetBSD: filecore_vfsops.c,v 1.9 1999/10/20 14:32:10 enami Exp $ */
/*-
* Copyright (c) 1998 Andrew McMurry
@ -393,7 +393,8 @@ filecore_unmount(mp, mntflags, p)
fcmp = VFSTOFILECORE(mp);
fcmp->fc_devvp->v_specflags &= ~SI_MOUNTEDON;
if (fcmp->fc_devvp->v_type != VBAD)
fcmp->fc_devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(fcmp->fc_devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(fcmp->fc_devvp, FREAD, NOCRED, p);
vput(fcmp->fc_devvp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cd9660_vfsops.c,v 1.40 1999/10/16 23:53:27 wrstuden Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.41 1999/10/20 14:32:10 enami Exp $ */
/*-
* Copyright (c) 1994
@ -510,7 +510,8 @@ cd9660_unmount(mp, mntflags, p)
iso_dunmap(isomp->im_dev);
#endif
isomp->im_devvp->v_specflags &= ~SI_MOUNTEDON;
if (isomp->im_devvp->v_type != VBAD)
isomp->im_devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(isomp->im_devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, p);
vput(isomp->im_devvp);

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_vfsops.c,v 1.63 1999/10/16 23:53:28 wrstuden Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.64 1999/10/20 14:32:10 enami Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@ -756,7 +756,8 @@ msdosfs_unmount(mp, mntflags, p)
if ((error = vflush(mp, NULLVP, flags)) != 0)
return (error);
pmp = VFSTOMSDOSFS(mp);
pmp->pm_devvp->v_specflags &= ~SI_MOUNTEDON;
if (pmp->pm_devvp->v_type != VBAD)
pmp->pm_devvp->v_specflags &= ~SI_MOUNTEDON;
#ifdef MSDOSFS_DEBUG
{
struct vnode *vp = pmp->pm_devvp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: ntfs_vfsops.c,v 1.19 1999/10/20 14:25:42 enami Exp $ */
/* $NetBSD: ntfs_vfsops.c,v 1.20 1999/10/20 14:32:10 enami Exp $ */
/*-
* Copyright (c) 1998, 1999 Semen Ustimenko
@ -670,7 +670,8 @@ ntfs_unmount(
vnode_pager_uncache(ntmp->ntm_devvp);
VOP_UNLOCK(ntmp->ntm_devvp);
#else
ntmp->ntm_devvp->v_specflags &= ~SI_MOUNTEDON;
if (ntmp->ntm_devvp->v_type != VBAD)
ntmp->ntm_devvp->v_specflags &= ~SI_MOUNTEDON;
#endif
vinvalbuf(ntmp->ntm_devvp, V_SAVE, NOCRED, p, 0, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.28 1999/10/16 23:53:28 wrstuden Exp $ */
/* $NetBSD: ext2fs_vfsops.c,v 1.29 1999/10/20 14:32:11 enami Exp $ */
/*
* Copyright (c) 1997 Manuel Bouyer.
@ -649,7 +649,8 @@ ext2fs_unmount(mp, mntflags, p)
fs->e2fs.e2fs_state = E2FS_ISCLEAN;
(void) ext2fs_sbupdate(ump, MNT_WAIT);
}
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
if (ump->um_devvp->v_type != VBAD)
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(ump->um_devvp, fs->e2fs_ronly ? FREAD : FREAD|FWRITE,
NOCRED, p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs_vfsops.c,v 1.53 1999/10/16 23:53:29 wrstuden Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.54 1999/10/20 14:32:11 enami Exp $ */
/*
* Copyright (c) 1989, 1991, 1993, 1994
@ -692,7 +692,8 @@ ffs_unmount(mp, mntflags, p)
fs->fs_clean = FS_ISCLEAN;
(void) ffs_sbupdate(ump, MNT_WAIT);
}
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
if (ump->um_devvp->v_type != VBAD)
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(ump->um_devvp, fs->fs_ronly ? FREAD : FREAD|FWRITE,
NOCRED, p);

View File

@ -1,4 +1,4 @@
/* $NetBSD: lfs_vfsops.c,v 1.39 1999/10/18 19:52:25 wrstuden Exp $ */
/* $NetBSD: lfs_vfsops.c,v 1.40 1999/10/20 14:32:11 enami Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -527,7 +527,8 @@ lfs_unmount(mp, mntflags, p)
vgone(fs->lfs_ivnode);
ronly = !fs->lfs_ronly;
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
if (ump->um_devvp->v_type != VBAD)
ump->um_devvp->v_specflags &= ~SI_MOUNTEDON;
vn_lock(ump->um_devvp, LK_EXCLUSIVE | LK_RETRY);
error = VOP_CLOSE(ump->um_devvp,
ronly ? FREAD : FREAD|FWRITE, NOCRED, p);