NetBSD Problem Report #166

From gnats  Sun Mar 13 10:18:39 1994
Received: from bloom-beacon.mit.edu (BLOOM-BEACON.MIT.EDU [18.70.0.232]) by sun-lamp.cs.berkeley.edu (8.6.5/8.6.5) with SMTP id KAA18457 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sun, 13 Mar 1994 10:18:39 -0800
Message-Id: <199403131805.NAA01015@orchard.medford.ma.us>
Date: Sun, 13 Mar 1994 13:05:20 -0500
From: sommerfeld@orchard.medford.ma.us
Reply-To: sommerfeld@orchard.medford.ma.us
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: if_ep may drop packets due to cut&paste bug.
X-Send-Pr-Version: 3.01.6

>Number:         166
>Category:       port-i386
>Synopsis:       if_ep may drop packets due to cut&paste bug.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    gnats-admin (GNATS administrator)
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 13 10:20:02 +0000 1994
>Closed-Date:    Fri Mar 18 06:07:40 +0000 1994
>Last-Modified:  
>Originator:     Bill Sommerfeld
>Release:        
>Organization:
	none
>Environment:

System: NetBSD orchard.medford.ma.us 0.9a ORCHARD#3 i386


>Description:

I discovered the following subtle bug while cribbing code out of if_ep
for if_lt.  Its unlikely to be noticed since nobody uses trailers..

The following code sequence occurs in epread() where it puts the
"real" header back on a packet if trailers were use.

		top = sc->mb[sc->next_mb];
		sc->mb[sc->next_mb] = 0;
		if (top == 0) {
>How-To-Repeat:
>Fix:

I think the 
			MGETHDR(m, M_DONTWAIT, MT_DATA);
should be
			MGETHDR(top, M_DONTWAIT, MT_DATA);

[also change the insw() to reflect 'top' instead of 'm']

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: hpeyerl 
State-Changed-When: Thu Mar 17 22:07:40 PST 1994 
State-Changed-Why:  
Fixed by author as per Bill Sommerfield. 
>Unformatted:
 >>>			MGETHDR(m, M_DONTWAIT, MT_DATA);
 			if (top == 0)
 				goto out;
 		} else {	/* Convert one of our saved mbuf's */
 			sc->next_mb = (sc->next_mb + 1) % MAX_MBS;
 			top->m_data = top->m_pktdat;
 			top->m_flags = M_PKTHDR;
 		}

 	If you take the top==0 case, you allocate an mbuf into "m",
 	and then drop the packet..

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.