Commit bd68177
ipv6: Fix nexthop refcnt leak when creating ipv6 route info
[ Upstream commit 706ec91 ]
ip6_route_info_create() invokes nexthop_get(), which increases the
refcount of the "nh".
When ip6_route_info_create() returns, local variable "nh" becomes
invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of
ip6_route_info_create(). When nexthops can not be used with source
routing, the function forgets to decrease the refcnt increased by
nexthop_get(), causing a refcnt leak.
Fix this issue by pulling up the error source routing handling when
nexthops can not be used with source routing.
Fixes: f88d8ea ("ipv6: Plumb support for nexthop object in a fib6_info")
Signed-off-by: Xiyu Yang <xiyuyang19@fudan.edu.cn>
Signed-off-by: Xin Tan <tanxin.ctf@gmail.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent 89c12bc commit bd68177
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3686 | 3686 | | |
3687 | 3687 | | |
3688 | 3688 | | |
3689 | | - | |
3690 | | - | |
3691 | | - | |
3692 | | - | |
3693 | 3689 | | |
3694 | 3690 | | |
3695 | 3691 | | |
3696 | 3692 | | |
| 3693 | + | |
| 3694 | + | |
| 3695 | + | |
| 3696 | + | |
3697 | 3697 | | |
3698 | 3698 | | |
3699 | 3699 | | |
| |||
0 commit comments