Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys/netinet Pull up following revision(s) (requested by c...



details:   https://anonhg.NetBSD.org/src/rev/d77ca5d64a30
branches:  netbsd-7
changeset: 798646:d77ca5d64a30
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Dec 01 13:08:14 2014 +0000

description:
Pull up following revision(s) (requested by christos in ticket #281):
        sys/netinet/in4_cksum.c: revision 1.20
Only check that the offset < sizeof(struct ip) if nxt != 0, i.e. in the
tcp and udp cases. From kre.

diffstat:

 sys/netinet/in4_cksum.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 8ae80bf63f75 -r d77ca5d64a30 sys/netinet/in4_cksum.c
--- a/sys/netinet/in4_cksum.c   Mon Dec 01 13:05:26 2014 +0000
+++ b/sys/netinet/in4_cksum.c   Mon Dec 01 13:08:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: in4_cksum.c,v 1.19 2013/03/12 21:54:36 christos Exp $  */
+/*     $NetBSD: in4_cksum.c,v 1.19.12.1 2014/12/01 13:08:14 martin Exp $       */
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.19 2013/03/12 21:54:36 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in4_cksum.c,v 1.19.12.1 2014/12/01 13:08:14 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/mbuf.h>
@@ -58,9 +58,6 @@
        uint32_t sum;
        uint16_t *w;
 
-       if (__predict_false(off < sizeof(struct ip)))
-               PANIC("%s: offset %d too short for IP header %zu", __func__,
-                   off, sizeof(struct ip));
        if (__predict_false(m->m_len < sizeof(struct ip)))
                PANIC("%s: mbuf %d too short for IP header %zu", __func__,
                    m->m_len, sizeof(struct ip));
@@ -68,6 +65,10 @@
        if (nxt == 0)
                return cpu_in_cksum(m, len, off, 0);
 
+       if (__predict_false(off < sizeof(struct ip)))
+               PANIC("%s: offset %d too short for IP header %zu", __func__,
+                   off, sizeof(struct ip));
+
        /*
         * Compute the equivalent of:
         * struct ipovly ip;



Home | Main Index | Thread Index | Old Index