mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR. Conflicts: net/ipv4/ip_gre.c17af420545("erspan: make sure erspan_base_hdr is present in skb->head")5832c4a77d("ip_tunnel: convert __be16 tunnel flags to bitmaps") https://lore.kernel.org/all/20240402103253.3b54a1cf@canb.auug.org.au/ Adjacent changes: net/ipv6/ip6_fib.cd21d40605b("ipv6: Fix infinite recursion in fib6_dump_done().")5fc68320c1("ipv6: remove RTNL protection from inet6_dump_fib()") Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
@@ -1209,10 +1209,11 @@ static bool nft_table_pending_update(const struct nft_ctx *ctx)
|
||||
return true;
|
||||
|
||||
list_for_each_entry(trans, &nft_net->commit_list, list) {
|
||||
if ((trans->msg_type == NFT_MSG_NEWCHAIN ||
|
||||
trans->msg_type == NFT_MSG_DELCHAIN) &&
|
||||
trans->ctx.table == ctx->table &&
|
||||
nft_trans_chain_update(trans))
|
||||
if (trans->ctx.table == ctx->table &&
|
||||
((trans->msg_type == NFT_MSG_NEWCHAIN &&
|
||||
nft_trans_chain_update(trans)) ||
|
||||
(trans->msg_type == NFT_MSG_DELCHAIN &&
|
||||
nft_is_base_chain(trans->ctx.chain))))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2449,6 +2450,9 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
|
||||
struct nft_stats __percpu *stats = NULL;
|
||||
struct nft_chain_hook hook = {};
|
||||
|
||||
if (table->flags & __NFT_TABLE_F_UPDATE)
|
||||
return -EINVAL;
|
||||
|
||||
if (flags & NFT_CHAIN_BINDING)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
@@ -8293,11 +8297,12 @@ static int nft_flowtable_parse_hook(const struct nft_ctx *ctx,
|
||||
return err;
|
||||
}
|
||||
|
||||
/* call under rcu_read_lock */
|
||||
static const struct nf_flowtable_type *__nft_flowtable_type_get(u8 family)
|
||||
{
|
||||
const struct nf_flowtable_type *type;
|
||||
|
||||
list_for_each_entry(type, &nf_tables_flowtables, list) {
|
||||
list_for_each_entry_rcu(type, &nf_tables_flowtables, list) {
|
||||
if (family == type->family)
|
||||
return type;
|
||||
}
|
||||
@@ -8309,9 +8314,13 @@ nft_flowtable_type_get(struct net *net, u8 family)
|
||||
{
|
||||
const struct nf_flowtable_type *type;
|
||||
|
||||
rcu_read_lock();
|
||||
type = __nft_flowtable_type_get(family);
|
||||
if (type != NULL && try_module_get(type->owner))
|
||||
if (type != NULL && try_module_get(type->owner)) {
|
||||
rcu_read_unlock();
|
||||
return type;
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
lockdep_nfnl_nft_mutex_not_held();
|
||||
#ifdef CONFIG_MODULES
|
||||
@@ -10455,10 +10464,11 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
|
||||
struct nft_trans *trans, *next;
|
||||
LIST_HEAD(set_update_list);
|
||||
struct nft_trans_elem *te;
|
||||
int err = 0;
|
||||
|
||||
if (action == NFNL_ABORT_VALIDATE &&
|
||||
nf_tables_validate(net) < 0)
|
||||
return -EAGAIN;
|
||||
err = -EAGAIN;
|
||||
|
||||
list_for_each_entry_safe_reverse(trans, next, &nft_net->commit_list,
|
||||
list) {
|
||||
@@ -10650,12 +10660,7 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
|
||||
nf_tables_abort_release(trans);
|
||||
}
|
||||
|
||||
if (action == NFNL_ABORT_AUTOLOAD)
|
||||
nf_tables_module_autoload(net);
|
||||
else
|
||||
nf_tables_module_autoload_cleanup(net);
|
||||
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int nf_tables_abort(struct net *net, struct sk_buff *skb,
|
||||
@@ -10668,6 +10673,17 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb,
|
||||
gc_seq = nft_gc_seq_begin(nft_net);
|
||||
ret = __nf_tables_abort(net, action);
|
||||
nft_gc_seq_end(nft_net, gc_seq);
|
||||
|
||||
WARN_ON_ONCE(!list_empty(&nft_net->commit_list));
|
||||
|
||||
/* module autoload needs to happen after GC sequence update because it
|
||||
* temporarily releases and grabs mutex again.
|
||||
*/
|
||||
if (action == NFNL_ABORT_AUTOLOAD)
|
||||
nf_tables_module_autoload(net);
|
||||
else
|
||||
nf_tables_module_autoload_cleanup(net);
|
||||
|
||||
mutex_unlock(&nft_net->commit_mutex);
|
||||
|
||||
return ret;
|
||||
@@ -11473,9 +11489,10 @@ static void __net_exit nf_tables_exit_net(struct net *net)
|
||||
|
||||
gc_seq = nft_gc_seq_begin(nft_net);
|
||||
|
||||
if (!list_empty(&nft_net->commit_list) ||
|
||||
!list_empty(&nft_net->module_list))
|
||||
__nf_tables_abort(net, NFNL_ABORT_NONE);
|
||||
WARN_ON_ONCE(!list_empty(&nft_net->commit_list));
|
||||
|
||||
if (!list_empty(&nft_net->module_list))
|
||||
nf_tables_module_autoload_cleanup(net);
|
||||
|
||||
__nft_release_tables(net);
|
||||
|
||||
@@ -11567,6 +11584,7 @@ static void __exit nf_tables_module_exit(void)
|
||||
unregister_netdevice_notifier(&nf_tables_flowtable_notifier);
|
||||
nft_chain_filter_fini();
|
||||
nft_chain_route_fini();
|
||||
nf_tables_trans_destroy_flush_work();
|
||||
unregister_pernet_subsys(&nf_tables_net_ops);
|
||||
cancel_work_sync(&trans_gc_work);
|
||||
cancel_work_sync(&trans_destroy_work);
|
||||
|
||||
Reference in New Issue
Block a user