Source-Changes-HG archive

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

[src/netbsd-6]: src/sys/net/npf Pull up following revision (requested by riz ...



details:   https://anonhg.NetBSD.org/src/rev/ab5c4231c00a
branches:  netbsd-6
changeset: 776436:ab5c4231c00a
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri Sep 13 04:12:54 2013 +0000

description:
Pull up following revision (requested by riz in ticket #942):
     /sys/net/npf/npf_inet.c            revision 1.23
Fix bugs to prevent panic:
- npf_cache_ip: re-fetch IPv6 header since nbufs might have been reallocated.
- npf_cache_all: clear NBUF_DATAREF_RESET since npf_cache_ip() handles it.

diffstat:

 sys/net/npf/npf_inet.c |  11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

diffs (40 lines):

diff -r 26bc0eebdc39 -r ab5c4231c00a sys/net/npf/npf_inet.c
--- a/sys/net/npf/npf_inet.c    Wed Sep 11 04:00:18 2013 +0000
+++ b/sys/net/npf/npf_inet.c    Fri Sep 13 04:12:54 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: npf_inet.c,v 1.10.4.9 2013/02/11 21:49:49 riz Exp $    */
+/*     $NetBSD: npf_inet.c,v 1.10.4.10 2013/09/13 04:12:54 msaitoh Exp $       */
 
 /*-
  * Copyright (c) 2009-2012 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.10.4.9 2013/02/11 21:49:49 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_inet.c,v 1.10.4.10 2013/09/13 04:12:54 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -391,8 +391,12 @@
                        npc->npc_hlen += hlen;
                }
 
-               /* Restore the offset. */
+               /*
+                * Re-fetch the header pointers (nbufs might have been
+                * reallocated).  Restore the original offset (if any).
+                */
                nbuf_reset(nbuf);
+               ip6 = nbuf_dataptr(nbuf);
                if (off) {
                        nbuf_advance(nbuf, off, 0);
                }
@@ -437,6 +441,7 @@
         */
        flags = npf_cache_ip(npc, nbuf);
        if ((flags & NPC_IP46) == 0 || (flags & NPC_IPFRAG) != 0) {
+               nbuf_unset_flag(nbuf, NBUF_DATAREF_RESET);
                npc->npc_info |= flags;
                return flags;
        }



Home | Main Index | Thread Index | Old Index