summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-03-31 20:37:44 +0000
committermav <mav@FreeBSD.org>2010-03-31 20:37:44 +0000
commit8ca00430023cd846ec4b67d76214dd42b8362d8e (patch)
treeaa066062e6f32671bf17cf4d1beeaeee492b49c0
parent7bf8aacf7a4993b43b1af869e4f196b6dc75d783 (diff)
downloadFreeBSD-src-8ca00430023cd846ec4b67d76214dd42b8362d8e.zip
FreeBSD-src-8ca00430023cd846ec4b67d76214dd42b8362d8e.tar.gz
Make ng_ppp fulfill upper protocol stack layers alignment requirements
on platforms with strict alignment constraints. This fixes kernel panics on arm and probably other architectures. PR: sparc64/80410
-rw-r--r--sys/netgraph/ng_ppp.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/netgraph/ng_ppp.c b/sys/netgraph/ng_ppp.c
index b2b0cb0..ec3ed82 100644
--- a/sys/netgraph/ng_ppp.c
+++ b/sys/netgraph/ng_ppp.c
@@ -907,7 +907,21 @@ ng_ppp_proto_recv(node_p node, item_p item, uint16_t proto, uint16_t linkNum)
const priv_p priv = NG_NODE_PRIVATE(node);
hook_p outHook = NULL;
int error;
+#ifdef ALIGNED_POINTER
+ struct mbuf *m, *n;
+ NGI_GET_M(item, m);
+ if (!ALIGNED_POINTER(mtod(m, caddr_t), uint32_t)) {
+ n = m_defrag(m, M_NOWAIT);
+ if (n == NULL) {
+ m_freem(m);
+ NG_FREE_ITEM(item);
+ return (ENOBUFS);
+ }
+ m = n;
+ }
+ NGI_M(item) = m;
+#endif /* ALIGNED_POINTER */
switch (proto) {
case PROT_IP:
if (priv->conf.enableIP)
OpenPOWER on IntegriCloud