: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths
Subsystems (2)
PATCH 1/1 : Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths
The recent changes to ip6_route_add added multiple leaks in error paths. This patch should fix them.
Regards
Patrick
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/19 23:46:56+02:00 [email protected]
# [IPV6]: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths
#
# Signed-off-by: Patrick McHardy <[email protected]>
#
# net/ipv6/route.c # 2004/10/19 23:46:17+02:00 [email protected] +8 -3 # [IPV6]: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths # # Signed-off-by: Patrick McHardy <[email protected]> # diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c --- a/net/ipv6/route.c 2004-10-19 23:52:23 +02:00 +++ b/net/ipv6/route.c 2004-10-19 23:52:23 +02:00 @@ -798,8 +798,10 @@
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);
@@ -962,7 +964,10 @@
out:
if (dev)
dev_put(dev);
- dst_free((struct dst_entry *) rt);
+ if (idev)
+ in6_dev_put(idev);
+ if (rt)
+ dst_free((struct dst_entry *) rt);
return err;
}
In article <[email protected]> (at Wed, 20 Oct 2004 00:13:54 +0200), Patrick McHardy <[email protected]> says:
Quoted 2 lines
The recent changes to
ip6_route_addadded multiple leaks in error paths. This patch should fix them.
Agreed. David, please apply.
--yoshfuji
The recent changes to ip6_route_add added multiple leaks in error paths. This patch should fix them.
Regards
Patrick
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/19 23:46:56+02:00 [email protected]
# [IPV6]: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths
#
# Signed-off-by: Patrick McHardy <[email protected]>
#
# net/ipv6/route.c # 2004/10/19 23:46:17+02:00 [email protected] +8 -3 # [IPV6]: Fix netdevice/inet6_dev reference leaks in ip6_route_add error paths # # Signed-off-by: Patrick McHardy <[email protected]> # diff -Nru a/net/ipv6/route.c b/net/ipv6/route.c --- a/net/ipv6/route.c 2004-10-19 23:52:23 +02:00 +++ b/net/ipv6/route.c 2004-10-19 23:52:23 +02:00 @@ -798,8 +798,10 @@
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);
@@ -962,7 +964,10 @@
out:
if (dev)
dev_put(dev);
- dst_free((struct dst_entry *) rt);
+ if (idev)
+ in6_dev_put(idev);
+ if (rt)
+ dst_free((struct dst_entry *) rt);
return err;
}
Quoted 8 lines · On Wed, 20 Oct 2004 15:35:25 +0900 (JST) YOSHIFUJI Hideaki / $B5HF#1QL@(B…
In article <[email protected]> (at Wed, 20 Oct 2004 00:13:54 +0200), Patrick McHardy <[email protected]> says:
Quoted 2 lines
The recent changes to
ip6_route_addadded multiple leaks in error paths. This patch should fix them.Agreed. David, please apply.
Signed-off-by Hideaki YOSHIFUJI <[email protected]>
Applied, thanks everyone.
David S. Miller
maintainerQuoted 2 lines · On Wed, 20 Oct 2004 00:13:54 +0200 Patrick McHardy <[email protected]> wrote:
The recent changes to
ip6_route_addadded multiple leaks in error paths. This patch should fix them.
Applied already, as mentioned in my response to Yoshifuji-san's ACK of this patch.