From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05314C3DA40 for ; Tue, 25 Jul 2023 11:25:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234599AbjGYLZl (ORCPT ); Tue, 25 Jul 2023 07:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234598AbjGYLZk (ORCPT ); Tue, 25 Jul 2023 07:25:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E7BBA6; Tue, 25 Jul 2023 04:25:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 027EA6169A; Tue, 25 Jul 2023 11:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FFD4C433C8; Tue, 25 Jul 2023 11:25:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690284338; bh=tjE4hoqhfs6txx2BOGwxkS30ruHkyBkNGksVh6hjYIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAZWMwh7MovN54uWCWKAGiGps5XEmuMxsGNkrkBjSQTiasdmGDUMg1kwf1gBZytJt 2wG9a70WtPW51+l5RMnyPD2Ikkz7gQa+XChDzFtOtCwpl0m2OBePAA0/IUfj76nXGh dTDjawuHcbGVUiuWTbXv6w91yTzA3eT0MyYHIipY= From: Greg Kroah-Hartman To: stable@vger.kernel.org, netfilter-devel@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso Subject: [PATCH 5.10 321/509] netfilter: nf_tables: unbind non-anonymous set if rule construction fails Date: Tue, 25 Jul 2023 12:44:20 +0200 Message-ID: <20230725104608.389194770@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230725104553.588743331@linuxfoundation.org> References: <20230725104553.588743331@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netfilter-devel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit 3e70489721b6c870252c9082c496703677240f53 ] Otherwise a dangling reference to a rule object that is gone remains in the set binding list. Fixes: 26b5a5712eb8 ("netfilter: nf_tables: add NFT_TRANS_PREPARE_ERROR to deal with bound set/chain") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -4689,6 +4689,8 @@ void nf_tables_deactivate_set(const stru nft_set_trans_unbind(ctx, set); if (nft_set_is_anonymous(set)) nft_deactivate_next(ctx->net, set); + else + list_del_rcu(&binding->list); set->use--; break;