From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8A46620F88 for ; Fri, 21 Jul 2023 19:09:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FD1DC433C8; Fri, 21 Jul 2023 19:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689966587; bh=LwLt0cW9IMPlCSr1JiP0TmnLeoZiHGJG03HMIFHW2hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXWUFsiCuu6LMlKjrd7KSQz6Utwtp9FFzNJDiiyPnkmDfG628Bd2tXJ3mU8I3Vave lgjvzueYW/mO0rrMl7MwA4NwOFYY0qWTkedNbHUiuWOcQ1FLUbeErFWmw8wCzlnL9j AwKZ3lVx/Yqy9FItsWSmwX+G5nldY6WyiTZVW2mw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso Subject: [PATCH 5.15 379/532] netfilter: nf_tables: unbind non-anonymous set if rule construction fails Date: Fri, 21 Jul 2023 18:04:43 +0200 Message-ID: <20230721160635.047991436@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230721160614.695323302@linuxfoundation.org> References: <20230721160614.695323302@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Pablo Neira Ayuso commit 3e70489721b6c870252c9082c496703677240f53 upstream. 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 @@ -5042,6 +5042,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;