summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorjoerg <joerg@NetBSD.org>2007-04-25 21:12:48 +0000
committerjoerg <joerg@NetBSD.org>2007-04-25 21:12:48 +0000
commit18436a60ed2d0784aada662aea254df3e7672fe0 (patch)
tree14033f7648ae653dcc430175bfa822d06dac1639 /sys/dev
parent9403f9f12f11cfc87a257225e4ade4d7d4d7dd85 (diff)
Fix a NULL reference on failing mbuf allocation.
In bge_start return if IFF_OACTIVE is set in combination with IFF_RUNNING, drop obscure check for length of interface queue. Remove message about failing bge_encap, it can happen just too easily because of full descriptor rings.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/pci/if_bge.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c
index 64d092e9d47..cd5f86239f5 100644
--- a/sys/dev/pci/if_bge.c
+++ b/sys/dev/pci/if_bge.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bge.c,v 1.128 2007/04/16 10:08:33 tron Exp $ */
+/* $NetBSD: if_bge.c,v 1.129 2007/04/25 21:12:48 joerg Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.128 2007/04/16 10:08:33 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.129 2007/04/25 21:12:48 joerg Exp $");
#include "bpfilter.h"
#include "vlan.h"
@@ -3345,6 +3345,8 @@ bge_cksum_pad(struct mbuf *pkt)
/* Allocate new empty mbuf, pad it. Compact later. */
struct mbuf *n;
MGET(n, M_DONTWAIT, MT_DATA);
+ if (n == NULL)
+ return ENOBUFS;
n->m_len = 0;
last->m_next = n;
last = n;
@@ -3781,7 +3783,7 @@ bge_start(struct ifnet *ifp)
sc = ifp->if_softc;
- if (!sc->bge_link && ifp->if_snd.ifq_len < 10)
+ if ((ifp->if_flags & (IFF_RUNNING|IFF_OACTIVE)) != IFF_RUNNING || sc->bge_link == 0)
return;
prodidx = sc->bge_tx_prodidx;
@@ -3816,7 +3818,6 @@ bge_start(struct ifnet *ifp)
* for the NIC to drain the ring.
*/
if (bge_encap(sc, m_head, &prodidx)) {
- printf("bge: failed on len %d?\n", m_head->m_pkthdr.len);
ifp->if_flags |= IFF_OACTIVE;
break;
}