diff options
Diffstat (limited to '')
| -rw-r--r-- | include/net/netfilter/nf_tables.h | 2 | ||||
| -rw-r--r-- | net/netfilter/nf_tables_api.c | 24 | 
2 files changed, 8 insertions, 18 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index 845c596bf594..3ae969e3acf0 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h @@ -396,14 +396,12 @@ struct nft_rule {  /**   *	struct nft_trans - nf_tables object update in transaction   * - *	@rcu_head: rcu head to defer release of transaction data   *	@list: used internally   *	@msg_type: message type   *	@ctx: transaction context   *	@data: internal information related to the transaction   */  struct nft_trans { -	struct rcu_head			rcu_head;  	struct list_head		list;  	int				msg_type;  	struct nft_ctx			ctx; diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 11ab4b078f3b..66e8425dbfe7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3484,13 +3484,8 @@ static void nft_chain_commit_update(struct nft_trans *trans)  	}  } -/* Schedule objects for release via rcu to make sure no packets are accesing - * removed rules. - */ -static void nf_tables_commit_release_rcu(struct rcu_head *rt) +static void nf_tables_commit_release(struct nft_trans *trans)  { -	struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); -  	switch (trans->msg_type) {  	case NFT_MSG_DELTABLE:  		nf_tables_table_destroy(&trans->ctx); @@ -3612,10 +3607,11 @@ static int nf_tables_commit(struct sk_buff *skb)  		}  	} +	synchronize_rcu(); +  	list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) {  		list_del(&trans->list); -		trans->ctx.nla = NULL; -		call_rcu(&trans->rcu_head, nf_tables_commit_release_rcu); +		nf_tables_commit_release(trans);  	}  	nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN); @@ -3623,13 +3619,8 @@ static int nf_tables_commit(struct sk_buff *skb)  	return 0;  } -/* Schedule objects for release via rcu to make sure no packets are accesing - * aborted rules. - */ -static void nf_tables_abort_release_rcu(struct rcu_head *rt) +static void nf_tables_abort_release(struct nft_trans *trans)  { -	struct nft_trans *trans = container_of(rt, struct nft_trans, rcu_head); -  	switch (trans->msg_type) {  	case NFT_MSG_NEWTABLE:  		nf_tables_table_destroy(&trans->ctx); @@ -3725,11 +3716,12 @@ static int nf_tables_abort(struct sk_buff *skb)  		}  	} +	synchronize_rcu(); +  	list_for_each_entry_safe_reverse(trans, next,  					 &net->nft.commit_list, list) {  		list_del(&trans->list); -		trans->ctx.nla = NULL; -		call_rcu(&trans->rcu_head, nf_tables_abort_release_rcu); +		nf_tables_abort_release(trans);  	}  	return 0;  | 
