On 04.10.2015 02:10, Julian Kornberger wrote:
> my machine (FreeBSD 10.2) crashes sometimes after I destroy or
> reconfigure a GRE interface. You find my crash dumps at:
> http://www.informatik.uni-bremen.de/~juliank/crash/
> 
> [...]
> #7  0xffffffff80d307f2 in calltrap ()
>     at /usr/src/sys/amd64/amd64/exception.S:236
> #8  0xffffffff81e125eb in in_gre_encapcheck (m=0xfffff8001ef81d00, off=20,
>     proto=47, arg=0xfffff800613f3000)
>     at /usr/src/sys/modules/if_gre/../../netinet/ip_gre.c:112
> #9  0xffffffff80a75142 in encap4_input (m=0xfffff8001ef81d00, off=20)
>     at /usr/src/sys/netinet/ip_encap.c:149
> #10 0xffffffff80a77f57 in ip_input (m=0xfffff8001ef81d00)
>     at /usr/src/sys/netinet/ip_input.c:734
> [...]
> 
> Any ideas?

Can you test this patch?

-- 
WBR, Andrey V. Elsukov
Index: sys/netinet/ip_encap.c
===================================================================
--- sys/netinet/ip_encap.c	(revision 287393)
+++ sys/netinet/ip_encap.c	(working copy)
@@ -181,7 +181,6 @@ encap4_input(struct mbuf *m, int off)
 			match = ep;
 		}
 	}
-	mtx_unlock(&encapmtx);
 
 	if (match) {
 		/* found a match, "match" has the best one */
@@ -191,8 +190,10 @@ encap4_input(struct mbuf *m, int off)
 			(*psw->pr_input)(m, off);
 		} else
 			m_freem(m);
+		mtx_unlock(&encapmtx);
 		return;
-	}
+	} else
+		mtx_unlock(&encapmtx);
 
 	/* last resort: inject to raw socket */
 	rip_input(m, off);
@@ -255,12 +256,15 @@ encap6_input(struct mbuf **mp, int *offp, int prot
 		psw = (const struct ip6protosw *)match->psw;
 		if (psw && psw->pr_input) {
 			encap_fillarg(m, match);
-			return (*psw->pr_input)(mp, offp, proto);
+			prio = (*psw->pr_input)(mp, offp, proto);
 		} else {
 			m_freem(m);
-			return IPPROTO_DONE;
+			prio = IPPROTO_DONE;
 		}
-	}
+		mtx_unlock(&encapmtx);
+		return (prio);
+	} else
+		mtx_unlock(&encapmtx);
 
 	/* last resort: inject to raw socket */
 	return rip6_input(mp, offp, proto);

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to