diff options
author | Per Fogelstrom <pefo@cvs.openbsd.org> | 2005-02-22 08:09:24 +0000 |
---|---|---|
committer | Per Fogelstrom <pefo@cvs.openbsd.org> | 2005-02-22 08:09:24 +0000 |
commit | 55236c9a81b1d4b37c5f32be79edb5547e03a7d9 (patch) | |
tree | 2190bfcb7cf1461f6551f60d96e8ec7b49773ec0 /sys/dev/ic | |
parent | d9dfff6b88dcf8c79fa92af6361c213bd4ec31d0 (diff) |
Fix a bug causing arches not able to load unaligned to crash in ip input.
m_pullup must be done with a size >= ip header and m_adj must be called
after the pullup so pullup does not kill the header alignment.
Makes mips64, alpha, sparc64 and possibly others happy.
ok from martin, brad and a bunch of others who tested.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/rtl81x9.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/ic/rtl81x9.c b/sys/dev/ic/rtl81x9.c index 9848001f404..7156ef0004c 100644 --- a/sys/dev/ic/rtl81x9.c +++ b/sys/dev/ic/rtl81x9.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9.c,v 1.37 2005/02/20 00:41:36 brad Exp $ */ +/* $OpenBSD: rtl81x9.c,v 1.38 2005/02/22 08:09:23 pefo Exp $ */ /* * Copyright (c) 1997, 1998 @@ -680,12 +680,13 @@ rl_rxeof(sc) if (m == NULL) ifp->if_ierrors++; else { - m_adj(m, ETHER_ALIGN); - m_copyback(m, wrap, total_len - wrap, - sc->rl_cdata.rl_rx_buf); - m = m_pullup(m, sizeof(struct ether_header)); + m_copyback(m, wrap + ETHER_ALIGN, + total_len - wrap, sc->rl_cdata.rl_rx_buf); + m = m_pullup(m, sizeof(struct ip) +ETHER_ALIGN); if (m == NULL) ifp->if_ierrors++; + else + m_adj(m, ETHER_ALIGN); } cur_rx = (total_len - wrap + ETHER_CRC_LEN); } else { |