Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: nf_tables: Pass nf_hook_ops to nft_unregister_flowtable_hook()

The function accesses only the hook's ops field, pass it directly. This
prepares for nft_hooks holding a list of nf_hook_ops in future.

While at it, make use of the function in
__nft_unregister_flowtable_net_hooks() as well.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Phil Sutter and committed by
Pablo Neira Ayuso
91a089d0 21aa0a03

+9 -11
+9 -11
net/netfilter/nf_tables_api.c
··· 8895 8895 } 8896 8896 8897 8897 /* Only called from error and netdev event paths. */ 8898 - static void nft_unregister_flowtable_hook(struct net *net, 8899 - struct nft_flowtable *flowtable, 8900 - struct nft_hook *hook) 8898 + static void nft_unregister_flowtable_ops(struct net *net, 8899 + struct nft_flowtable *flowtable, 8900 + struct nf_hook_ops *ops) 8901 8901 { 8902 - nf_unregister_net_hook(net, &hook->ops); 8903 - flowtable->data.type->setup(&flowtable->data, hook->ops.dev, 8902 + nf_unregister_net_hook(net, ops); 8903 + flowtable->data.type->setup(&flowtable->data, ops->dev, 8904 8904 FLOW_BLOCK_UNBIND); 8905 8905 } 8906 8906 ··· 8912 8912 struct nft_hook *hook, *next; 8913 8913 8914 8914 list_for_each_entry_safe(hook, next, hook_list, list) { 8915 - nf_unregister_net_hook(net, &hook->ops); 8916 - flowtable->data.type->setup(&flowtable->data, hook->ops.dev, 8917 - FLOW_BLOCK_UNBIND); 8915 + nft_unregister_flowtable_ops(net, flowtable, &hook->ops); 8918 8916 if (release_netdev) { 8919 8917 list_del(&hook->list); 8920 8918 nft_netdev_hook_free_rcu(hook); ··· 8981 8983 if (i-- <= 0) 8982 8984 break; 8983 8985 8984 - nft_unregister_flowtable_hook(net, flowtable, hook); 8986 + nft_unregister_flowtable_ops(net, flowtable, &hook->ops); 8985 8987 list_del_rcu(&hook->list); 8986 8988 nft_netdev_hook_free_rcu(hook); 8987 8989 } ··· 9064 9066 err_flowtable_update_hook: 9065 9067 list_for_each_entry_safe(hook, next, &flowtable_hook.list, list) { 9066 9068 if (unregister) 9067 - nft_unregister_flowtable_hook(ctx->net, flowtable, hook); 9069 + nft_unregister_flowtable_ops(ctx->net, flowtable, &hook->ops); 9068 9070 list_del_rcu(&hook->list); 9069 9071 nft_netdev_hook_free_rcu(hook); 9070 9072 } ··· 9637 9639 continue; 9638 9640 9639 9641 /* flow_offload_netdev_event() cleans up entries for us. */ 9640 - nft_unregister_flowtable_hook(dev_net(dev), flowtable, hook); 9642 + nft_unregister_flowtable_ops(dev_net(dev), flowtable, ops); 9641 9643 list_del_rcu(&hook->list); 9642 9644 kfree_rcu(hook, rcu); 9643 9645 break;