Commit db5e93fe authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

[IPV6]: Fix dst leak in ipv6_add_addr

Found another error-path dst leak.  If the idev->dead check is
triggered in ipv6_add_addr the rt entry will leak.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> 
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f338bad8
......@@ -484,7 +484,7 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
int scope, unsigned flags)
{
struct inet6_ifaddr *ifa = NULL;
struct rt6_info *rt;
struct rt6_info *rt = NULL;
int hash;
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
int err = 0;
......@@ -572,6 +572,10 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
if (unlikely(err == 0))
notifier_call_chain(&inet6addr_chain, NETDEV_UP, ifa);
else {
if (rt) {
dst_release(&rt->u.dst);
dst_free(&rt->u.dst);
}
kfree(ifa);
ifa = ERR_PTR(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