NetBSD Problem Report #649

From gnats  Sun Dec 18 12:08:53 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA15401 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 18 Dec 1994 12:08:51 -0800
Message-Id: <199412181911.OAA04082@shandakor.tharsis.com>
Date: Sun, 18 Dec 1994 14:11:15 -0500
From: George Robbins <grr@shandakor.tharsis.com>
Reply-To: grr@tharsis.com
To: gnats-bugs@NetBSD.ORG
Subject: kernel panic/trap when referencing floppy of "unknown density"
X-Send-Pr-Version: 3.2

>Number:         649
>Category:       kern
>Synopsis:       kernel panic/trap when referencing floppy of "unknown density"
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Dec 18 12:20:05 +0000 1994
>Closed-Date:    Fri Jan 20 18:11:44 +0000 1995
>Last-Modified:  
>Originator:     George Robbins
>Release:        1.0
>Organization:
none
>Environment:
	System: NetBSD shandakor.tharsis.com 1.0 NetBSD 1.0 (SHANDAKOR) #0: Sat Dec 17 02:11:22 EST 1994 root@shandakor.tharsis.com:/usr/src/sys/arch/i386/compile/SHANDAKOR i386
>Description:
	When referencing a floppy drive that the configuration/attach code
	reported as being of "unknown density" via the default density /dev
	entry (i.e. /dev/fd0a), a kernel panic results due to dereferencing
	a null "type" pointer in fdstrategy().  This can happen when the
	the CMOS says the drive is "not installed" but the kernel likes it
	anyway, or presumably on 3rd/4th drives not described in the CMOS.

	One case where this can be puzzling is if you try to boot fd(0,a)
	from one of the install floppies with drive A: "not installed" -
	the boot proceeds fine as long as the BIOS(?) is doing the I/O,
	but the kernel panics once the regular driver tries to reference
	the passed boot device.  Since there's no (4)i386/fd manpage, the
	notion that /dev/fd?x refers to a density override rather than
	a partion isn't exposed, nor is this usage mentioned on the reboot
	manpage...
>How-To-Repeat:
	set your floppy drive A: to "not installed"
	boot
	diddle with /dev/fd0a
	panic
>Fix:
	work-around: take intense care to always use /dev/fd?[b-h], or
	link /dev/fd?a to /dev/fd?x as appropriate.

	fix: see attached diff - this seems to be a simple way to deal with
	the problem (thou shalt not panic) with no major downside, another
	would be to error-out the open if default density is requested and
	the type was posted as "unknown density".


*** src/sys/arch/i386/isa/fd.c	Sun Dec 18 13:03:43 1994
--- src/sys/arch/i386/isa/fd.c.dist	Sun Dec 18 12:52:38 1994
***************
*** 403,418 ****

  	/* XXXX should allow `flags' to override device type */

! 	if (!type) {
! 		printf(": density unknown, defaulting to");
! #if defined(FDDDENSITY)
! 		type = &fd_types[(FDDDENSITY)-1];	/* yeech */
! #else
! 		type = &fd_types[0];
! #endif
! 	}
! 	printf(": %s %d cyl, %d head, %d sec\n", type->name,
! 	    type->tracks, type->heads, type->sectrac);
  	fd->sc_track = -1;
  	fd->sc_drive = drive;
  	fd->sc_deftype = type;
--- 403,413 ----

  	/* XXXX should allow `flags' to override device type */

! 	if (type)
! 		printf(": %s %d cyl, %d head, %d sec\n", type->name,
! 		    type->tracks, type->heads, type->sectrac);
! 	else
! 		printf(": density unknown\n");
  	fd->sc_track = -1;
  	fd->sc_drive = drive;
  	fd->sc_deftype = type;
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Fri Jan 20 10:11:44 PST 1995 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.