From owner-freebsd-bugs@FreeBSD.ORG Thu May 20 12:40:18 2004 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 75DBE16A4CF for ; Thu, 20 May 2004 12:40:18 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5992143D5A for ; Thu, 20 May 2004 12:40:18 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) i4KJeIlD038742 for ; Thu, 20 May 2004 12:40:18 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id i4KJeIK0038741; Thu, 20 May 2004 12:40:18 -0700 (PDT) (envelope-from gnats) Resent-Date: Thu, 20 May 2004 12:40:18 -0700 (PDT) Resent-Message-Id: <200405201940.i4KJeIK0038741@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, hampi@rootshell.be Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6E33316A4D0 for ; Thu, 20 May 2004 12:33:47 -0700 (PDT) Received: from smtp.hispeed.ch (mxout.hispeed.ch [62.2.95.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id 82A7343D31 for ; Thu, 20 May 2004 12:33:46 -0700 (PDT) (envelope-from hampi@rootshell.be) Received: from gicco.homeip.net (80-218-73-163.dclient.hispeed.ch [80.218.73.163])i4KJXSWZ002038 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 20 May 2004 21:33:28 +0200 Received: from localhost.here (idefix@gicco.homeip.net [127.0.0.1]) by gicco.homeip.net (8.12.8p2/8.12.8) with ESMTP id i4KJXRYA000227; Thu, 20 May 2004 21:33:27 +0200 (CEST) (envelope-from idefix@gicco.homeip.net) Received: (from idefix@localhost) by localhost.here (8.12.8p2/8.12.8/Submit) id i4KJXQYF000226; Thu, 20 May 2004 21:33:26 +0200 (CEST) Message-Id: <200405201933.i4KJXQYF000226@localhost.here> Date: Thu, 20 May 2004 21:33:26 +0200 (CEST) From: Hanspeter Roth To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: hampi@rootshell.be Subject: kern/66960: filesystems not unmounted during reboot due to floppy X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: hampi@rootshell.be List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 May 2004 19:40:18 -0000 >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@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: