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)
rt = ip6_dst_alloc();
if (rt == NULL)
return -ENOMEM;
if (rt == NULL) {
err = -ENOMEM;
goto out;
}
rt->u.dst.obsolete = -1;
rt->rt6i_expires = clock_t_to_jiffies(rtmsg->rtmsg_info);
......@@ -960,6 +962,9 @@ int ip6_route_add(struct in6_rtmsg *rtmsg, struct nlmsghdr *nlh, void *_rtattr)
out:
if (dev)
dev_put(dev);
if (idev)
in6_dev_put(idev);
if (rt)
dst_free((struct dst_entry *) rt);
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