diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-08-02 11:32:43 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-08-02 14:56:06 -0700 |
commit | 446266b0c742a2c9ee8f0dce759a0117bce58a86 (patch) | |
tree | 2ee287031900394357be6297c0729fcd49c196ee /net/ipv4/devinet.c | |
parent | 9bb8eeb554795e6fac7cacf7af44bf413e75c9b9 (diff) | |
download | op-kernel-dev-446266b0c742a2c9ee8f0dce759a0117bce58a86.zip op-kernel-dev-446266b0c742a2c9ee8f0dce759a0117bce58a86.tar.gz |
net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
Commit 5c766d642 ("ipv4: introduce address lifetime") leaves the ifa
resource that was allocated via inet_alloc_ifa() unfreed when returning
the function with -EINVAL. Thus, free it first via inet_free_ifa().
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 8d48c39..34ca6d5 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -772,7 +772,7 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, ci = nla_data(tb[IFA_CACHEINFO]); if (!ci->ifa_valid || ci->ifa_prefered > ci->ifa_valid) { err = -EINVAL; - goto errout; + goto errout_free; } *pvalid_lft = ci->ifa_valid; *pprefered_lft = ci->ifa_prefered; @@ -780,6 +780,8 @@ static struct in_ifaddr *rtm_to_ifaddr(struct net *net, struct nlmsghdr *nlh, return ifa; +errout_free: + inet_free_ifa(ifa); errout: return ERR_PTR(err); } |