[IPV6] ADDRCONF: Fix possible inet6_ifaddr leakage with CONFIG_OPTIMISTIC_DAD.
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Wed, 28 Feb 2007 14:13:20 +0000 (23:13 +0900)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:23:44 +0000 (22:23 -0700)
The inet6_ifaddr for source address of RS is leaked if the address
is not an optimistic address.

Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ndisc.c

index b79b00042310a86038b969642b56902d2e1b542b..053147a0027e05fe91882499823c8ebee1c5d0c4 100644 (file)
@@ -627,7 +627,6 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
        struct sk_buff *skb;
        struct icmp6hdr *hdr;
        __u8 * opt;
-       struct inet6_ifaddr *ifp;
        int send_sllao = dev->addr_len;
        int len;
        int err;
@@ -643,12 +642,12 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
         * supress the inclusion of the sllao.
         */
        if (send_sllao) {
-               ifp = ipv6_get_ifaddr(saddr, dev, 1);
+               struct inet6_ifaddr *ifp = ipv6_get_ifaddr(saddr, dev, 1);
                if (ifp) {
                        if (ifp->flags & IFA_F_OPTIMISTIC)  {
-                               send_sllao=0;
-                               in6_ifa_put(ifp);
+                               send_sllao = 0;
                        }
+                       in6_ifa_put(ifp);
                } else {
                        send_sllao = 0;
                }