Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dac7d0f2 authored by David Ahern's avatar David Ahern Committed by David S. Miller
Browse files

ipv6: Create cleanup helper for fib6_nh



Move the fib6_nh cleanup code to a new helper, fib6_nh_release.

Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 83c44251
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -447,6 +447,7 @@ static inline struct net_device *fib6_info_nh_dev(const struct fib6_info *f6i)
int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
		 struct fib6_config *cfg, gfp_t gfp_flags,
		 struct netlink_ext_ack *extack);
void fib6_nh_release(struct fib6_nh *fib6_nh);

static inline
struct lwtunnel_state *fib6_info_nh_lwt(const struct fib6_info *f6i)
+1 −4
Original line number Diff line number Diff line
@@ -199,10 +199,7 @@ void fib6_info_destroy_rcu(struct rcu_head *head)
		free_percpu(f6i->rt6i_pcpu);
	}

	lwtstate_put(f6i->fib6_nh.nh_lwtstate);

	if (f6i->fib6_nh.nh_dev)
		dev_put(f6i->fib6_nh.nh_dev);
	fib6_nh_release(&f6i->fib6_nh);

	ip_fib_metrics_put(f6i->fib6_metrics);

+8 −0
Original line number Diff line number Diff line
@@ -3025,6 +3025,14 @@ int fib6_nh_init(struct net *net, struct fib6_nh *fib6_nh,
	return err;
}

void fib6_nh_release(struct fib6_nh *fib6_nh)
{
	lwtstate_put(fib6_nh->nh_lwtstate);

	if (fib6_nh->nh_dev)
		dev_put(fib6_nh->nh_dev);
}

static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg,
					      gfp_t gfp_flags,
					      struct netlink_ext_ack *extack)