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 99C3D37F01B; Sat, 17 Oct 2026 17:42:22 +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=1792258943; cv=none; b=C4aMd65sTYtqRdCUkWQ9MiokoanUhYwMrHc5S3FzvMX4GaXCAYnf8tKD38Q+v0Y7i9dcvblMUymVC1g1sd4ss+Ipf21OGEMsLdK2wAFQo+izhraOhnC1JgdybSmhbYE4qrjq+aWtgqPPsa45XuthpTxU3fJozbfn+YOOtLG4nfk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792258943; c=relaxed/simple; bh=Y1YG6k9/Fxv5qkWtpVHCR+xCGJSsW+1mD84CuXw1524=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EoEwS9jX7ltXGDKE2qc+1LuUYn4BRoTRvTQlnU54wFAObXvlo3DJ/ZRUEyKLYL/26zGiiWXNHPXMiEIqtBS2cmPwT6ZCGNQAbTlMGPxsqzaMAZZncaXD7wfxCj8XsKQosPvMP1Tj+wQqeM+ZyNqae0TpxXUgotMqTzk8gUFVojs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=lfdJGojW; 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="lfdJGojW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1ECA1F000C5; Sat, 17 Oct 2026 17:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792258942; bh=yttep5ax/djhz3POX8Nb41W+Nv/LHGwhTOkltYumUbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=lfdJGojWACaQoiXtkYYAuIZszJxQRs+KOFSQWuXonvjmonvpCUpsIP7DPsmbFDmXz JnZbtvyOVfbX2QKlsj24lOyew9LYACZjkwJAaJKR2HYTpPWrPJoFmVtYZbmDbnl6pa FzOhsK/oRgR2fDTvByPrsM4y7gWtJUIhS/PvgjHc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.6 1049/1674] netfilter: x_tables: allow initial table replace without emitting audit log message Date: Sat, 17 Oct 2026 17:55:21 +0200 Message-ID: <20261017160458.057585628@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@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 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal [ Upstream commit 8e72510db9fa2d41f2b06d5c01fe9020e076fee4 ] At the moment we emit the audit log a bit too early, which makes it necessary to also emit an unregister log in case we have to unwind errors after possible hook register failure. Followup patch will be slightly simpler if we can delay the register message until after the hooks have been wired up. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Stable-dep-of: b62eb8dcf2c4 ("netfilter: x_tables: allocate hook ops while under mutex") Signed-off-by: Sasha Levin --- net/netfilter/x_tables.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index c1ab85fb8c46d..8374c514177cd 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -1403,11 +1403,9 @@ struct xt_counters *xt_counters_alloc(unsigned int counters) } EXPORT_SYMBOL(xt_counters_alloc); -struct xt_table_info * -xt_replace_table(struct xt_table *table, - unsigned int num_counters, - struct xt_table_info *newinfo, - int *error) +static struct xt_table_info * +do_replace_table(struct xt_table *table, unsigned int num_counters, + struct xt_table_info *newinfo, int *error) { struct xt_table_info *private; unsigned int cpu; @@ -1462,10 +1460,23 @@ xt_replace_table(struct xt_table *table, } } - audit_log_nfcfg(table->name, table->af, private->number, - !private->number ? AUDIT_XT_OP_REGISTER : - AUDIT_XT_OP_REPLACE, - GFP_KERNEL); + return private; +} + +struct xt_table_info * +xt_replace_table(struct xt_table *table, unsigned int num_counters, + struct xt_table_info *newinfo, + int *error) +{ + struct xt_table_info *private; + + private = do_replace_table(table, num_counters, newinfo, error); + if (private) + audit_log_nfcfg(table->name, table->af, private->number, + !private->number ? AUDIT_XT_OP_REGISTER : + AUDIT_XT_OP_REPLACE, + GFP_KERNEL); + return private; } EXPORT_SYMBOL_GPL(xt_replace_table); -- 2.53.0