diff options
author | Daniel Borkmann <dborkman@redhat.com> | 2013-08-02 11:32:43 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-14 06:54:54 -0700 |
commit | b4f55925ace5646d72df5af6fdab74fdbb288229 (patch) | |
tree | 4f30c77985968a48970267d419f4829014a45863 /net | |
parent | f4cc06ac2d9fc7a483eb778abec66f60487687f4 (diff) | |
download | kernel-common-b4f55925ace5646d72df5af6fdab74fdbb288229.tar.gz kernel-common-b4f55925ace5646d72df5af6fdab74fdbb288229.tar.bz2 kernel-common-b4f55925ace5646d72df5af6fdab74fdbb288229.zip |
net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
[ Upstream commit 446266b0c742a2c9ee8f0dce759a0117bce58a86 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-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 dfc39d4d48b7..9e38217c3931 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c @@ -771,7 +771,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; @@ -779,6 +779,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); } |