Author: mav
Date: Wed Mar 31 20:37:44 2010
New Revision: 206000
URL: http://svn.freebsd.org/changeset/base/206000

Log:
  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

Modified:
  head/sys/netgraph/ng_ppp.c

Modified: head/sys/netgraph/ng_ppp.c
==============================================================================
--- head/sys/netgraph/ng_ppp.c  Wed Mar 31 20:15:20 2010        (r205999)
+++ head/sys/netgraph/ng_ppp.c  Wed Mar 31 20:37:44 2010        (r206000)
@@ -907,7 +907,21 @@ ng_ppp_proto_recv(node_p node, item_p it
        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)
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to