summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1998-10-25 19:26:18 +0000
committerbde <bde@FreeBSD.org>1998-10-25 19:26:18 +0000
commit558766fa9415f59d49437a086cc1260d95828a0b (patch)
tree05be5c55f69047b10ab0de43bf5c0ef6624703eb /sys
parent9fafc4765300a0de262e82faff274b179b1c3772 (diff)
downloadFreeBSD-src-558766fa9415f59d49437a086cc1260d95828a0b.zip
FreeBSD-src-558766fa9415f59d49437a086cc1260d95828a0b.tar.gz
Don't follow null bdevsw pointers. The `major(dev) < nblkdev' test rotted
when bdevsw[] became sparse. We still depend on magic to avoid having to check that (v_rdev) device numbers in vnodes are not NODEV.
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c5
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c6
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/i386/i386/swapgeneric.c5
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c5
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c6
7 files changed, 21 insertions, 12 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index fb877ca..69e3ebd 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.43 1998/09/07 13:17:00 bde Exp $
+ * $Id: cd9660_vfsops.c,v 1.44 1998/09/14 19:56:39 sos Exp $
*/
#include <sys/param.h>
@@ -229,7 +229,8 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return ENXIO;
}
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 42798d7..cf8f905 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.35 1998/05/06 05:29:38 msmith Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.36 1998/09/07 13:17:02 bde Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
/*-
@@ -50,6 +50,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/kernel.h>
@@ -297,7 +298,8 @@ msdosfs_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 1104534..ef80d74 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -276,7 +276,8 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 1104534..ef80d74 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -276,7 +276,8 @@ ext2_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/i386/i386/swapgeneric.c b/sys/i386/i386/swapgeneric.c
index 5575e62..7cc6e4b 100644
--- a/sys/i386/i386/swapgeneric.c
+++ b/sys/i386/i386/swapgeneric.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
- * $Id: swapgeneric.c,v 1.23 1998/02/20 13:37:37 bde Exp $
+ * $Id: swapgeneric.c,v 1.24 1998/09/15 10:03:43 gibbs Exp $
*/
#include <sys/param.h>
@@ -138,7 +138,8 @@ bad:
unit = 0;
for (gc = genericconf; gc->gc_name; gc++) {
for (bd = 0; bd < nblkdev; bd++) {
- if (!strcmp(bdevsw[bd]->d_name, gc->gc_name)) {
+ if (bdevsw[bd] != NULL &&
+ strcmp(bdevsw[bd]->d_name, gc->gc_name) == 0) {
printf("root on %s0\n", bdevsw[bd]->d_name);
goto found;
}
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index fb877ca..69e3ebd 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.43 1998/09/07 13:17:00 bde Exp $
+ * $Id: cd9660_vfsops.c,v 1.44 1998/09/14 19:56:39 sos Exp $
*/
#include <sys/param.h>
@@ -229,7 +229,8 @@ cd9660_mount(mp, path, data, ndp, p)
vrele(devvp);
return ENOTBLK;
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return ENXIO;
}
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 42798d7..cf8f905 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.35 1998/05/06 05:29:38 msmith Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.36 1998/09/07 13:17:02 bde Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
/*-
@@ -50,6 +50,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/kernel.h>
@@ -297,7 +298,8 @@ msdosfs_mount(mp, path, data, ndp, p)
vrele(devvp);
return (ENOTBLK);
}
- if (major(devvp->v_rdev) >= nblkdev) {
+ if (major(devvp->v_rdev) >= nblkdev ||
+ bdevsw[major(devvp->v_rdev)] == NULL) {
vrele(devvp);
return (ENXIO);
}
OpenPOWER on IntegriCloud