diff options
author | wes <wes@FreeBSD.org> | 2004-09-21 06:46:44 +0000 |
---|---|---|
committer | wes <wes@FreeBSD.org> | 2004-09-21 06:46:44 +0000 |
commit | e2d52801ffd5b529878e95affa0d3995d5dc395a (patch) | |
tree | 6b8cebd9f598fbd973ca798739fb16be172d322d /sys | |
parent | 362f547d94ad5ef11ad99b154efdd7f64695adbe (diff) | |
download | FreeBSD-src-e2d52801ffd5b529878e95affa0d3995d5dc395a.zip FreeBSD-src-e2d52801ffd5b529878e95affa0d3995d5dc395a.tar.gz |
Trap invalid sector size 0 in disk probe, refusing to add such a
device to the list. This prevents crashes on /0 errors in 'lsdev'
et al.
Reviewed-by: jhb@
MT5 after: RE approval
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/i386/libi386/biosdisk.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/boot/i386/libi386/biosdisk.c b/sys/boot/i386/libi386/biosdisk.c index aeac2e3..b97a268 100644 --- a/sys/boot/i386/libi386/biosdisk.c +++ b/sys/boot/i386/libi386/biosdisk.c @@ -209,6 +209,10 @@ bd_int13probe(struct bdinfo *bd) if (!(v86.efl & 0x1) && /* carry clear */ ((v86.edx & 0xff) > ((unsigned)bd->bd_unit & 0x7f))) { /* unit # OK */ + if ((v86.ecx & 0x3f) == 0) { /* absurd sector size */ + DEBUG("Invalid geometry for unit %d", bd->bd_unit); + return(0); /* skip device */ + } bd->bd_flags |= BD_MODEINT13; bd->bd_type = v86.ebx & 0xff; |