summaryrefslogtreecommitdiff
path: root/sys/net/if_sl.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2011-01-06 11:52:42 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2011-01-06 11:52:42 +0000
commit0ff3a349bb43d499900b014f3afa080904cacbca (patch)
tree2d7d846cf78472077c6c2df89191aa86a3780740 /sys/net/if_sl.c
parent14f7869a11ddd326980fed66f68d8bdf9be627e0 (diff)
Do not assign m->m_pkthdr.rdomain before m was allocated.
Fix for rev 1.37 commit which would crash when slip(4) is used. Problem found the hard way by Henri Kemppainen.
Diffstat (limited to 'sys/net/if_sl.c')
-rw-r--r--sys/net/if_sl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 96013ab0151..1b6a63899e8 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sl.c,v 1.42 2010/05/02 22:34:31 stsp Exp $ */
+/* $OpenBSD: if_sl.c,v 1.43 2011/01/06 11:52:41 claudio Exp $ */
/* $NetBSD: if_sl.c,v 1.39.4.1 1996/06/02 16:26:31 thorpej Exp $ */
/*
@@ -752,9 +752,6 @@ slinput(c, tp)
}
c &= TTY_CHARMASK;
- /* mark incoming routing domain */
- m->m_pkthdr.rdomain = sc->sc_if.if_rdomain;
-
++sc->sc_if.if_ibytes;
if (sc->sc_if.if_flags & IFF_DEBUG) {
@@ -855,6 +852,9 @@ slinput(c, tp)
if (m == NULL)
goto error;
+ /* mark incoming routing domain */
+ m->m_pkthdr.rdomain = sc->sc_if.if_rdomain;
+
#if NBPFILTER > 0
if (sc->sc_bpf) {
/*