Module Name: src Committed By: ozaki-r Date: Mon Jun 19 10:04:23 UTC 2017
Modified Files: src/sys/netinet: tcp_input.c Log Message: Fix KASSERT in tcp_input inp can be NULL when receiving an IPv4 packet on an IPv4-mapped IPv6 address. In that case KASSERT(sotoinpcb(so) == inp) always fails. Should fix PR kern/52304 (at least it fixes the same panic as the report) To generate a diff of this commit: cvs rdiff -u -r1.357 -r1.358 src/sys/netinet/tcp_input.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.357 src/sys/netinet/tcp_input.c:1.358 --- src/sys/netinet/tcp_input.c:1.357 Thu Apr 20 08:46:07 2017 +++ src/sys/netinet/tcp_input.c Mon Jun 19 10:04:23 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.357 2017/04/20 08:46:07 ozaki-r Exp $ */ +/* $NetBSD: tcp_input.c,v 1.358 2017/06/19 10:04:23 ozaki-r Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.357 2017/04/20 08:46:07 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.358 2017/06/19 10:04:23 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1835,7 +1835,13 @@ findpcb: switch (af) { #ifdef INET case AF_INET: - KASSERT(sotoinpcb(so) == inp); + /* + * inp can be NULL when + * receiving an IPv4 packet on + * an IPv4-mapped IPv6 address. + */ + KASSERT(inp == NULL || + sotoinpcb(so) == inp); if (!ipsec4_in_reject(m, inp)) break; IPSEC_STATINC(