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 B85D73B1EFC; Tue, 21 Jul 2026 20:32:27 +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=1784665948; cv=none; b=EIIBPE9KgbEI5O2dlUNIUERg+zpuzxIyP7Mxf5LDx1iG5YH1xAnLsnqnME7MbrCuji9GBuXKTk6OQkY1YOSJBsLlC69tW1yAdA27rJfe+qh6GZ1+ONZa/oG98coP3jCb+jn1VvBA/OcGIGr11PNL9DPm+EhOWljYk9zSm9Xy/UI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784665948; c=relaxed/simple; bh=dFrsFFuPxoXfz1HV8AbbrIUYYXhBlgSwSICNXuCPN1M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MPrIuDBxBzl/5Tl+WeZT9baQfO4DTg90BT2l9Ia7Ss5Te3xhuNTw2gjD9qQlrV4EomY6g2vCVo0KOE0r/kKePKsxivRhUEb54NAVkvhVrKxb+d1hie+OIj2T+oxfCNsAjFayr8yU3kHRjsG8vz5+i2jmmIwOstdL0Uil2X3NFHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=quQAMVFe; 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="quQAMVFe" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20C3D1F000E9; Tue, 21 Jul 2026 20:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784665947; bh=7mnJt0nLd24FDtMJmGiiUEAYnJDtMVekV3p0xeAnUaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=quQAMVFeL7HtsJz/EztUQQwoyS8XgaIqkX1YjXueRY1nVxjAhWpYgv3BQveK2W2OW NLGizO5pCTYEfQ7AR+yC3NLPCXmmmam00WThJRWHUlFnOcSbjSQPD/FQKne5UR76l5 RyDW+ObliDv7mxg2oauOlQF02vj5vF1lpAzJ6FyE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 6.6 0496/1266] netfilter: conntrack: call nf_ct_gre_keymap_destroy() if master helper is pptp Date: Tue, 21 Jul 2026 17:15:33 +0200 Message-ID: <20260721152452.942528432@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152441.786066624@linuxfoundation.org> References: <20260721152441.786066624@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: Pablo Neira Ayuso [ Upstream commit b0f02608fbcd607b5131cceb91fc0a035264e61c ] For GRE flows, validate that the ct master helper (if any) is pptp before calling nf_ct_gre_keymap_destroy(), so the helper data area can be accessed safely. Note that only the pptp helper provides a .destroy callback. Fixes: e56894356f60 ("netfilter: conntrack: remove l4proto destroy hook") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_conntrack_core.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 06995cdb36bef9..b086670ec90dd3 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -565,9 +565,23 @@ static void destroy_gre_conntrack(struct nf_conn *ct) { #ifdef CONFIG_NF_CT_PROTO_GRE struct nf_conn *master = ct->master; + struct nf_conn_help *help; + + if (!master) + return; + + help = nfct_help(master); + if (help) { + struct nf_conntrack_helper *helper; - if (master) - nf_ct_gre_keymap_destroy(master); + rcu_read_lock(); + helper = rcu_dereference(help->helper); + /* Only pptp helper has a destroy callback. */ + if (helper && helper->destroy) + nf_ct_gre_keymap_destroy(master); + + rcu_read_unlock(); + } #endif } -- 2.53.0