From vak@crox.net.kiae.su  Wed Mar  6 05:10:51 1996
Received: from crox.net.kiae.su (crox.net.kiae.su [144.206.130.72])
          by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id FAA19208
          for <FreeBSD-gnats-submit@freebsd.org>; Wed, 6 Mar 1996 05:10:40 -0800 (PST)
Received: by crox.net.kiae.su id QAA00489;
  (8.6.12/vak/1.8a) Wed, 6 Mar 1996 16:10:56 +0300
Message-Id: <199603061310.QAA00489@crox.net.kiae.su>
Date: Wed, 6 Mar 1996 16:10:56 +0300
From: vak@crox.net.kiae.su (Serge V.Vakulenko)
Reply-To: vak@crox.net.kiae.su
To: FreeBSD-gnats-submit@freebsd.org
Subject: patch for wt driver
X-Send-Pr-Version: 3.2

>Number:         1065
>Category:       kern
>Synopsis:       wt could crash reading short blocks
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar  6 05:20:01 PST 1996
>Closed-Date:    Mon Dec 23 02:53:22 MET 1996
>Last-Modified:  Mon Dec 23 02:54:15 MET 1996
>Originator:     Serge V.Vakulenko
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
Cronyx Ltd., Moscow
>Environment:

	FreeBSD 2.1 and Archive tape streamer

>Description:

	The system crashes when trying to read the tape
	using small block size (less than 2048 bytes).

>How-To-Repeat:

	dd bs=1 < /dev/rwt0 > /dev/null

>Fix:
	
--- wt21.c	Thu Sep 14 11:09:39 1995
+++ wt.c	Wed Mar  6 15:41:49 1996
@@ -634,8 +634,6 @@
 		DEBUG (("unexpected interrupt\n"));
 		return;
 	}
-	t->flags &= ~TPACTIVE;
-	t->dmacount += t->bsize;                /* increment counter */
 
 	/*
 	 * Clean up dma.
@@ -648,6 +646,10 @@
 	} else
 		isa_dmadone (t->dmaflags, t->dmavaddr, t->bsize, t->chan);
 
+	t->flags &= ~TPACTIVE;
+	t->dmacount += t->bsize;
+	t->dmavaddr += t->bsize;
+
 	/*
 	 * On exception, check for end of file and end of volume.
 	 */
@@ -663,7 +665,6 @@
 	}
 
 	if (t->dmacount < t->dmatotal) {        /* continue i/o */
-		t->dmavaddr += t->bsize;
 		wtdma (t);
 		DEBUG (("continue i/o, %d\n", t->dmacount));
 		return;

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: scrappy 
State-Changed-When: Mon Oct 21 23:21:35 PDT 1996 
State-Changed-Why:  

Dust off the cobwebs - Confirm Status 
State-Changed-From-To: feedback->closed 
State-Changed-By: joerg 
State-Changed-When: Mon Dec 23 02:53:22 MET 1996 
State-Changed-Why:  
Suggested fix applied in rev 1.36 of wt.c. 

>Unformatted:
