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 B07B846EC8D; Tue, 21 Jul 2026 17:52:16 +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=1784656337; cv=none; b=QWZQYn7doq2K/uujqGTM0kWvP5A0OY8rYVVrJGUlM+rC0lAq5oCIQmlpIVxIxPw14cdrYktBkzPeBd4QPJ/JEJDt213syC98XzBh6NZ4HbPRSwnBIZfD4C6naNRO/XhMyB/dVCSECfwVriSRxiUw8p6aTcwYd7XMQqeJIh7YKks= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784656337; c=relaxed/simple; bh=7a6KlhIBI3iLAwnisUtfblbENk4oYsjZ5AkIlHEJmLk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QTDqLZwP3YGGfUfPr+5vGeYghBflvbdA6NtWTV25WXF+lnh4NfHPsOUSaumOHCFnhCuL+uehQ+wklOCmusF24OSzsWP3EZmCEJ875b56iv8BXlQZwyOiyCdZL+Tw4cTbQ2U0qyXHV2Cufg7T0B8HofNvDImfDaJ0ay5epmbI/0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=TTGjaE1u; 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="TTGjaE1u" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E8471F000E9; Tue, 21 Jul 2026 17:52:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784656336; bh=WtK283nQv8uymq1BbA/7jeFk42BFVO+FLSSc/x2TLC4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TTGjaE1u1wyhsWUHEY3+pWqXzjPQMUe6hldBxlO9jJjs9hc+5McaaHTBEZxZ6AuTT ops1ZnVJb8izCUL1/Dks054SyMc42OGdeDID6tTqXAOio6A7PfhEwx4o96aZY8ThW9 i9q946+60Fr5UURyyJEF1RGVXpg0pbjrqMZqO6T8= 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.18 0349/1611] netfilter: conntrack: call nf_ct_gre_keymap_destroy() if master helper is pptp Date: Tue, 21 Jul 2026 17:07:45 +0200 Message-ID: <20260721152522.981589778@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152514.750365251@linuxfoundation.org> References: <20260721152514.750365251@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.18-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 3bb08880f3a4de..a877f9ad1cf2dd 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