Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Apr 2002 23:13:20 +0200 (MET DST)
From:      j@uriah.heep.sax.de (Joerg Wunsch)
To:        freebsd-current@freebsd.org
Cc:        "Crist J. Clark" <crist.clark@attbi.com>, bde@freebsd.org
Subject:   Re: disklabel(8) floppy panic
Message-ID:  <200204012113.g31LDKt02333@uriah.heep.sax.de>
In-Reply-To: <20020319025136.O60554@blossom.cjclark.org>
References:  <20020319025136.O60554@blossom.cjclark.org>

next in thread | previous in thread | raw e-mail | index | archive | help
"Crist J. Clark" <crist.clark@attbi.com> wrote:

> Have a crash box handy?
> 
>   $ disklabel fd0.1440

The patch below should fix that, thanks for the bug report.

fdioctl() historically attempted to determine the "raw" partition
(`c') of the device in order to read the label.  However, the floppy
driver never really supported UFS-style partitions anyway.  This ended
up in selecting the wrong device for reading the label, which was a
not-so-fatal error before the last floppy driver rewrite (it actually
selected the fdX.1480 device then, which was obviously benign for 3.5"
drives).  However, now it hits an unitialized device which becomes
fatal in readdisklabel() by attempting an indirect call to the
strategy routine that hasn't been entered in the struct dev passed
down.

The call to dkmodpart() entered in rev. 1.64 of fd.c, so i'm Cc'ing
Bruce for a comment whether the fix below is indeed TRT.

Index: sys/isa/fd.c
===================================================================
RCS file: /home/ncvs/src/sys/isa/fd.c,v
retrieving revision 1.224
diff -u -r1.224 fd.c
--- isa/fd.c	18 Dec 2001 22:16:33 -0000	1.224
+++ isa/fd.c	1 Apr 2002 20:56:22 -0000
@@ -2704,7 +2704,7 @@
 		fdt = fd->ft;
 		lp->d_secpercyl = fdt->size / fdt->tracks;
 		lp->d_type = DTYPE_FLOPPY;
-		if (readdisklabel(dkmodpart(dev, RAW_PART), lp) != NULL)
+		if (readdisklabel(dev, lp) != NULL)
 			error = EINVAL;
 		else
 			*(struct disklabel *)addr = *lp;

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204012113.g31LDKt02333>