summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenjiro Cho <kjc@cvs.openbsd.org>2003-03-09 12:03:23 +0000
committerKenjiro Cho <kjc@cvs.openbsd.org>2003-03-09 12:03:23 +0000
commit1b23dab2a7287e0a5c424b02f78f2c1e9590e990 (patch)
tree9514b60801f4ac1fa2efc8801304cce4417da688 /sys
parent1070df4548da8fd04f6b540aea8e51fa2c8d231e (diff)
use MGETHDR instead of MGET for the first mbuf.
altq expects struct pkthdr in a mbuf chain. this fixes a panic caused by uninitialized m_pkthdr.tags when altq is enabled on ppp. also, initialize m_pkthdr.len and m_pkthdr.rcvif as a caller of MGETHDR is supposed to do. report and test by matthieu@ ok deraadt@, henning@, dhartmei@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/ppp_tty.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index 14c820497c8..12ada39de73 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ppp_tty.c,v 1.15 2002/07/01 19:31:35 deraadt Exp $ */
+/* $OpenBSD: ppp_tty.c,v 1.16 2003/03/09 12:03:22 kjc Exp $ */
/* $NetBSD: ppp_tty.c,v 1.12 1997/03/24 21:23:10 christos Exp $ */
/*
@@ -367,7 +367,12 @@ pppwrite(tp, uio, flag)
uio->uio_resid < PPP_HDRLEN)
return (EMSGSIZE);
for (mp = &m0; uio->uio_resid; mp = &m->m_next) {
- MGET(m, M_WAIT, MT_DATA);
+ if (mp == &m0) {
+ MGETHDR(m, M_WAIT, MT_DATA);
+ m->m_pkthdr.len = uio->uio_resid - PPP_HDRLEN;
+ m->m_pkthdr.rcvif = NULL;
+ } else
+ MGET(m, M_WAIT, MT_DATA);
*mp = m;
m->m_len = 0;
if (uio->uio_resid >= MCLBYTES / 2)