* [PATCH net] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
@ 2013-08-02 9:32 Daniel Borkmann
2013-08-02 10:22 ` Jiri Pirko
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2013-08-02 9:32 UTC (permalink / raw)
To: davem; +Cc: netdev, jiri
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>
---
net/ipv4/devinet.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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);
}
--
1.7.11.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
2013-08-02 9:32 [PATCH net] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails Daniel Borkmann
@ 2013-08-02 10:22 ` Jiri Pirko
2013-08-02 21:56 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Pirko @ 2013-08-02 10:22 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: davem, netdev
Fri, Aug 02, 2013 at 11:32:43AM CEST, dborkman@redhat.com wrote:
>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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails
2013-08-02 10:22 ` Jiri Pirko
@ 2013-08-02 21:56 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2013-08-02 21:56 UTC (permalink / raw)
To: jiri; +Cc: dborkman, netdev
From: Jiri Pirko <jiri@resnulli.us>
Date: Fri, 2 Aug 2013 12:22:29 +0200
> Fri, Aug 02, 2013 at 11:32:43AM CEST, dborkman@redhat.com wrote:
>>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>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-02 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02 9:32 [PATCH net] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails Daniel Borkmann
2013-08-02 10:22 ` Jiri Pirko
2013-08-02 21:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).