Module Name:    src
Committed By:   kefren
Date:           Fri May 15 18:03:45 UTC 2015

Modified Files:
        src/sys/netinet: tcp_input.c

Log Message:
Don't try to do PCB lookup for bad checksummed segments
Fixes PR/43510 and PR/48452


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 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.339 src/sys/netinet/tcp_input.c:1.340
--- src/sys/netinet/tcp_input.c:1.339	Sat May  2 17:18:03 2015
+++ src/sys/netinet/tcp_input.c	Fri May 15 18:03:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: tcp_input.c,v 1.339 2015/05/02 17:18:03 rtr Exp $	*/
+/*	$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren 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.339 2015/05/02 17:18:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.340 2015/05/15 18:03:45 kefren Exp $");
 
 #include "opt_inet.h"
 #include "opt_ipsec.h"
@@ -1394,6 +1394,12 @@ tcp_input(struct mbuf *m, ...)
 	tiflags = th->th_flags;
 
 	/*
+	 * Checksum extended TCP header and data
+	 */
+	if (tcp_input_checksum(af, m, th, toff, off, tlen))
+		goto badcsum;
+
+	/*
 	 * Locate pcb for segment.
 	 */
 findpcb:
@@ -1564,12 +1570,6 @@ findpcb:
 	KASSERT(so->so_lock == softnet_lock);
 	KASSERT(solocked(so));
 
-	/*
-	 * Checksum extended TCP header and data.
-	 */
-	if (tcp_input_checksum(af, m, th, toff, off, tlen))
-		goto badcsum;
-
 	tcp_fields_to_host(th);
 
 	/* Unscale the window into a 32-bit value. */

Reply via email to