Skip to content

Commit

Permalink
net: Specify the owning module for lwtunnel ops
Browse files Browse the repository at this point in the history
[ Upstream commit 88ff733 ]

Modules implementing lwtunnel ops should not be allowed to unload
while there is state alive using those ops, so specify the owning
module for all lwtunnel ops.

Signed-off-by: Robert Shearman <rshearma@brocade.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
rshearman authored and gregkh committed Feb 4, 2017
1 parent 087c2ec commit 89c2588
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/net/lwtunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ struct lwtunnel_encap_ops {
int (*get_encap_size)(struct lwtunnel_state *lwtstate);
int (*cmp_encap)(struct lwtunnel_state *a, struct lwtunnel_state *b);
int (*xmit)(struct sk_buff *skb);

struct module *owner;
};

#ifdef CONFIG_LWTUNNEL
Expand Down
2 changes: 2 additions & 0 deletions net/ipv4/ip_tunnel_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
.fill_encap = ip_tun_fill_encap_info,
.get_encap_size = ip_tun_encap_nlsize,
.cmp_encap = ip_tun_cmp_encap,
.owner = THIS_MODULE,
};

static const struct nla_policy ip6_tun_policy[LWTUNNEL_IP6_MAX + 1] = {
Expand Down Expand Up @@ -403,6 +404,7 @@ static const struct lwtunnel_encap_ops ip6_tun_lwt_ops = {
.fill_encap = ip6_tun_fill_encap_info,
.get_encap_size = ip6_tun_encap_nlsize,
.cmp_encap = ip_tun_cmp_encap,
.owner = THIS_MODULE,
};

void __init ip_tunnel_core_init(void)
Expand Down
1 change: 1 addition & 0 deletions net/ipv6/ila/ila_lwt.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ static const struct lwtunnel_encap_ops ila_encap_ops = {
.fill_encap = ila_fill_encap_info,
.get_encap_size = ila_encap_nlsize,
.cmp_encap = ila_encap_cmp,
.owner = THIS_MODULE,
};

int ila_lwt_init(void)
Expand Down
1 change: 1 addition & 0 deletions net/mpls/mpls_iptunnel.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ static const struct lwtunnel_encap_ops mpls_iptun_ops = {
.fill_encap = mpls_fill_encap_info,
.get_encap_size = mpls_encap_nlsize,
.cmp_encap = mpls_encap_cmp,
.owner = THIS_MODULE,
};

static int __init mpls_iptunnel_init(void)
Expand Down

0 comments on commit 89c2588

Please sign in to comment.