inet: Return NULL from IN_LOOKUP_MULTI if ifnet is NULL
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 19 May 2014 11:45:31 +0000 (19:45 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Mon, 19 May 2014 11:45:31 +0000 (19:45 +0800)
This could happen for mbufs on ip_input path, whose rcvif could be NULL.

sys/netinet/in_var.h

index cb5d067..3d523a4 100644 (file)
@@ -203,6 +203,9 @@ IN_LOOKUP_MULTI(const struct in_addr *_addr, struct ifnet *_ifp)
        const struct ifmultiaddr *_ifma;
        struct in_multi *_inm = NULL;
 
+       if (_ifp == NULL)
+               return NULL;
+
        /* TODO: need ifnet_serialize_main */
        ifnet_serialize_all(_ifp);
        TAILQ_FOREACH(_ifma, &_ifp->if_multiaddrs, ifma_link) {