diff options
author | bde <bde@FreeBSD.org> | 1998-10-26 07:05:34 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-10-26 07:05:34 +0000 |
commit | 84009a09057c3d4f9473fd1c8082318a8f0b1a3f (patch) | |
tree | 09c15efc7e617bdd5ad8be844edc5a653a182720 /sys | |
parent | 1fcef92d07b5703db37d85bbbd57154b05ece69f (diff) | |
download | FreeBSD-src-84009a09057c3d4f9473fd1c8082318a8f0b1a3f.zip FreeBSD-src-84009a09057c3d4f9473fd1c8082318a8f0b1a3f.tar.gz |
Check the major number of the boot device more carefully. There was only
a problem if the boot blocks passed bad data.
Check the major number of the dump device consistently.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/autoconf.c | 8 | ||||
-rw-r--r-- | sys/i386/i386/autoconf.c | 8 |
2 files changed, 6 insertions, 10 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c index dd97021..58a5e01 100644 --- a/sys/amd64/amd64/autoconf.c +++ b/sys/amd64/amd64/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.108 1998/10/05 21:09:21 obrien Exp $ + * $Id: autoconf.c,v 1.109 1998/10/10 08:12:22 jkh Exp $ */ /* @@ -407,9 +407,7 @@ setdumpdev(dev) return (0); } maj = major(dev); - if (maj >= nblkdev) - return (ENXIO); - if (bdevsw[maj] == NULL) + if (maj >= nblkdev || bdevsw[maj] == NULL) return (ENXIO); /* XXX is this right? */ if (bdevsw[maj]->d_psize == NULL) return (ENXIO); /* XXX should be ENODEV ? */ @@ -452,7 +450,7 @@ setroot() if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != B_DEVMAGIC) return; majdev = B_TYPE(bootdev); - if (bdevsw[majdev] == NULL) + if (majdev >= nblkdev || bdevsw[majdev] == NULL) return; unit = B_UNIT(bootdev); slice = B_SLICE(bootdev); diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c index dd97021..58a5e01 100644 --- a/sys/i386/i386/autoconf.c +++ b/sys/i386/i386/autoconf.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91 - * $Id: autoconf.c,v 1.108 1998/10/05 21:09:21 obrien Exp $ + * $Id: autoconf.c,v 1.109 1998/10/10 08:12:22 jkh Exp $ */ /* @@ -407,9 +407,7 @@ setdumpdev(dev) return (0); } maj = major(dev); - if (maj >= nblkdev) - return (ENXIO); - if (bdevsw[maj] == NULL) + if (maj >= nblkdev || bdevsw[maj] == NULL) return (ENXIO); /* XXX is this right? */ if (bdevsw[maj]->d_psize == NULL) return (ENXIO); /* XXX should be ENODEV ? */ @@ -452,7 +450,7 @@ setroot() if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != B_DEVMAGIC) return; majdev = B_TYPE(bootdev); - if (bdevsw[majdev] == NULL) + if (majdev >= nblkdev || bdevsw[majdev] == NULL) return; unit = B_UNIT(bootdev); slice = B_SLICE(bootdev); |