in6pcb: in6_pcblookup_local() must have been protected by port token
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 16 Mar 2014 07:31:50 +0000 (15:31 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Sun, 16 Mar 2014 11:21:15 +0000 (19:21 +0800)
sys/netinet6/in6_pcb.c

index a5921d8..0b73889 100644 (file)
@@ -1014,11 +1014,11 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr,
        struct inpcb *match = NULL;
 
        /*
-        * If the porthashbase is shared across several cpus we need
-        * to lock.
+        * If the porthashbase is shared across several cpus, it must
+        * have been locked.
         */
        if (pcbinfo->porttoken)
-               lwkt_gettoken(pcbinfo->porttoken);
+               ASSERT_LWKT_TOKEN_HELD(pcbinfo->porttoken);
 
        /*
         * Best fit PCB lookup.
@@ -1069,9 +1069,6 @@ in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr,
                        }
                }
        }
-       if (pcbinfo->porttoken)
-               lwkt_reltoken(pcbinfo->porttoken);
-
        return (match);
 }