]> Pileus Git - ~andy/linux/blobdiff - net/ipv6/addrconf.c
net: fix NULL dereferences in check_peer_redir()
[~andy/linux] / net / ipv6 / addrconf.c
index a06c53c14d841e07083ca9dbab9423bf607d914d..f012ebd87b4338181f76d3154165eb1f41cd0ba4 100644 (file)
@@ -656,7 +656,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
         * layer address of our nexhop router
         */
 
-       if (dst_get_neighbour(&rt->dst) == NULL)
+       if (dst_get_neighbour_raw(&rt->dst) == NULL)
                ifa->flags &= ~IFA_F_OPTIMISTIC;
 
        ifa->idev = idev;
@@ -1481,6 +1481,8 @@ static void addrconf_join_anycast(struct inet6_ifaddr *ifp)
 static void addrconf_leave_anycast(struct inet6_ifaddr *ifp)
 {
        struct in6_addr addr;
+       if (ifp->prefix_len == 127) /* RFC 6164 */
+               return;
        ipv6_addr_prefix(&addr, &ifp->addr, ifp->prefix_len);
        if (ipv6_addr_any(&addr))
                return;