From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 11E4F3ACEF7; Sat, 12 Sep 2026 20:04:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789243506; cv=none; b=FQtFVMysVBvwQaqNqFbnPwUlJOz6EeZck05ZQT4EJZ65yzOFEw3m4FziduoOO7KF1Prk2hKrW2AoKttPxehBbQpS1D7UVyqu8AudDfLr6zmSggnzWvL1xH+uCr/asgrWaPOqCC4ShT+lFOHbq0k/M586GmvzfUksSolsW+vgQA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789243506; c=relaxed/simple; bh=T1ZOx7D2fM9uXyTC5Yuqa7QkBJd606wlK1QlrUYbuFg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q6N40/KhdTbgTDeZcVyKT+9BESttNolP9UoTeImSRbdJiAjG5P+tb5iBWRmd7CyogLzbuCMyWH5LYT21Uno0k/z4yEV5rnjFrgLHrHjmS88kUVzyC/l9SZynhp/fBsrpZ7Qo5QVJiohTpUAlrAU2gx9b42LvdD4vqNgWpjaOZSc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WiWMX1PW; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="WiWMX1PW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F3641F000FF; Sat, 12 Sep 2026 20:04:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789243493; bh=oqi2BrElfVqtoSyD/Z3BupxYDrl5Gq0CXUTYkZGZm/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WiWMX1PWFa36tne30sGOjdhc5AxwMET+Ue/EvUYQSt9AP+vNz6ElK1DlGOpwQlAUC LXXLST63gK2Hfq73xniYB8KtGmrdagAcyehg7zvocHRjuk3dgVQvFspF/wt3diE4tC WrBzM4m8wTY0Znp6QLP7Ls3+SMVnBMsf1HHYcG9Q= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.10 773/798] netfilter: nf_tables: move hardware offload step after building the chain blob Date: Sat, 12 Sep 2026 09:06:41 +0200 Message-ID: <20260912065534.785829952@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pablo Neira Ayuso [ Upstream commit b1881d362e1924b66f6016c3efd28807032b41bf ] Allocate the chain blob before the ruleset offload to reduce chances of entering an inconsistent state where the offloaded ruleset in the nic and the software ruleset differ. Fixes: c9626a2cbdb2 ("netfilter: nf_tables: add hardware offload support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 5b909b5902393..5e3f863c487f6 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -8606,10 +8606,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) if (nf_tables_validate(net) < 0) return -EAGAIN; - err = nft_flow_rule_offload_commit(net); - if (err < 0) - return err; - /* 1. Allocate space for next generation rules_gen_X[] */ list_for_each_entry_safe(trans, next, &nft_net->commit_list, list) { int ret; @@ -8633,6 +8629,16 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) } } + /* must be last, so audit and chain blob set up does not leave hardware + * in consistent state. + */ + err = nft_flow_rule_offload_commit(net); + if (err < 0) { + nf_tables_commit_chain_prepare_cancel(net); + nf_tables_commit_audit_free(&adl); + return err; + } + /* step 2. Make rules_gen_X visible to packet path */ list_for_each_entry(table, &nft_net->tables, list) { list_for_each_entry(chain, &table->chains, list) -- 2.53.0