Commit 08fd206f authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[IPV6]: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 91384774
...@@ -796,8 +796,10 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) ...@@ -796,8 +796,10 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
rt = ip6_dst_alloc(); rt = ip6_dst_alloc();
if (rt == NULL) if (rt == NULL) {
return -ENOMEM; err = -ENOMEM;
goto out;
}
rt->u.dst.obsolete = -1; rt->u.dst.obsolete = -1;
rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info); rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info);
...@@ -960,7 +962,10 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr) ...@@ -960,7 +962,10 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
out: out:
if (dev) if (dev)
dev_put(dev); dev_put(dev);
dst_free((struct dst_entry *) rt); if (idev)
in6_dev_put(idev);
if (rt)
dst_free((struct dst_entry *) rt);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment