kern/66960: filesystems not unmounted during reboot due to floppy

Hanspeter Roth hampi at rootshell.be
Thu May 20 12:40:18 PDT 2004


>Number:         66960
>Category:       kern
>Synopsis:       filesystems not unmounted during reboot due to floppy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 20 12:40:17 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Idefix
>Release:        FreeBSD 4.10-RC3 i386
>Organization:
>Environment:
System: FreeBSD snoopy.here 4.10-RC3 FreeBSD 4.10-RC3 #1: Thu May 20 20:54:31 CEST 2004 idefix at snoopy.here:/usr/src/sys/compile/C3 i386


	
>Description:
	This has been discussed in October 2002.
	http://docs.freebsd.org/cgi/getmsg.cgi?fetch=350780+0+archive/2002/freebsd-hackers/20021103.freebsd-hackers
	If one forgets to mount a floppy readonly that is write-protected the 
	filesystems of the harddisk can't be unmounted and must be checked
	after reboot.
	The patch from Thomas Zenker prevents a write-protected floppy to
	be mounted writable. The floppy will be allowed to be mounted
	only readonly.
>How-To-Repeat:
	Set the floppy to write-protected and mount it writable and then reboot
	the system.
>Fix:

Index: sys/isa/fd.c
===================================================================
RCS file: /usr/cvs/FreeBSD/src/sys/isa/fd.c,v
retrieving revision 1.176.2.8
diff -u -r1.176.2.8 fd.c
--- sys/isa/fd.c	15 May 2002 21:56:14 -0000	1.176.2.8
+++ sys/isa/fd.c	31 Oct 2002 13:06:05 -0000
@@ -1448,6 +1448,21 @@
 		}
 	}
 	fd->ft = fd_types + type - 1;
+	if (flags & FWRITE) {	/* check for write protection */
+		int r, s, st3;
+	        s = splbio();
+		set_motor(fdc, fd->fdsu, TURNON); /* select drive */
+		r = fd_sense_drive_status(fdc, &st3);
+		set_motor(fdc, fd->fdsu, TURNOFF);
+		fdc->state = RESETCTLR;
+		splx(s);
+		if(r != 0)
+			return(ENXIO);
+		if (st3 & NE7_ST3_WP) {
+			device_printf(fd->dev, "write protected\n");
+			return(EPERM);
+		}
+	}
 	fd->flags |= FD_OPEN;
 	/*
 	 * Clearing the DMA overrun counter at open time is a bit messy.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list