summaryrefslogtreecommitdiffstats
path: root/sys/net/if_ethersubr.c
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2003-04-23 18:35:40 +0000
committerarchie <archie@FreeBSD.org>2003-04-23 18:35:40 +0000
commit84db389df40a359de80dfdd74c35a81241433aea (patch)
tree1aadef638e961d7a0d94967f0be79c16e72d8aa5 /sys/net/if_ethersubr.c
parent485007051ab7027550f5cf7b6684707536004dcc (diff)
downloadFreeBSD-src-84db389df40a359de80dfdd74c35a81241433aea.zip
FreeBSD-src-84db389df40a359de80dfdd74c35a81241433aea.tar.gz
Fix a case where the return value from m_copy() was not being checked
for NULL before proceeding, causing a crash if mbufs were exhausted. MFC after: 3 days Reported by: Mark Gooderum <mark@verniernetworks.com>
Diffstat (limited to 'sys/net/if_ethersubr.c')
-rw-r--r--sys/net/if_ethersubr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 8dfb5fb..bb2bbd6 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -281,13 +281,13 @@ ether_output(ifp, m, dst, rt0)
if ((m->m_flags & M_BCAST) || (loop_copy > 0)) {
struct mbuf *n;
- n = m_copy(m, 0, (int)M_COPYALL);
- n->m_pkthdr.csum_flags |= csum_flags;
- if (csum_flags & CSUM_DATA_VALID)
- n->m_pkthdr.csum_data = 0xffff;
-
- (void) if_simloop(ifp, n, dst->sa_family, hlen);
+ if ((n = m_copy(m, 0, (int)M_COPYALL)) != NULL) {
+ n->m_pkthdr.csum_flags |= csum_flags;
+ if (csum_flags & CSUM_DATA_VALID)
+ n->m_pkthdr.csum_data = 0xffff;
+ (void)if_simloop(ifp, n, dst->sa_family, hlen);
+ }
} else if (bcmp(eh->ether_dhost, eh->ether_shost,
ETHER_ADDR_LEN) == 0) {
m->m_pkthdr.csum_flags |= csum_flags;
OpenPOWER on IntegriCloud