From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382479; b=zqkVuYapFwMTYh9QeBF7RpQkLjy41hGEr9OJuoLdw17lWe1JxSonV6xy2iLVTwKK03QD H04diHmDbtW98NK8/x/ZqCgwMEswTxnV+AP4zqDiWXaGUtIubBpxEhsd1LSNSshpk7xe7 3Rjxi+bUTXPHywAua6ySit7bRQ1wIWDV8DW4ATzHuqsU8lSH6PO3KtP6EPMou5m+KnThd IP5b0YP5yTEH4cEZ5eViDoCs8C4eUWQyvcjobouVAZd7lTlT8UfK+NznbESRTBxCxBvDn +LdsDh8ZVjJOnJ0iBCPJsHlb/UUEjg7GRErw8rRFTyqjXBLs61lGaKUfROlTX1z/22Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382479; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=yTKkSvaWSclavTNgasHPtpu/Bfl6oSf36S9xwr5EqJw=; b=uremkvNze/XO7JaKOWMpBNdm16PI9w5xBHRCyBT/IvvNVidOKlTnDVhfjIv9DDOZAxdY Mot21HLuDHXTqzr+bwtMopkpND6RHuJLc/E263Xy2pxBxxhjs6a0QcVZkpmmZLAuYtsXa eiSz4LvYOQvwRXtYvcjHins/yHEhMvVSx3jTYpTHxfkeaKdTEDjb6c0qcwYNEWcoGDA5k hdWxTtYV48ot3SxGhHfWsYjSHuY8GnF6rfjh6R5pZNV2rZ4MGPcmMJ9wkp/0zYtqbvzUR UEvtXR0rEGxebE2/w7NFIhFEf2QR9qSxqki2/NHMetIgVbMS6aqXq+qZRgSb/fDS+tA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mYvn8ECS; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 71935606A322; Fri, 4 Dec 2026 11:07:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=mYvn8ECS Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDF431F000C2; Fri, 4 Dec 2026 11:07:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382479; bh=yTKkSvaWSclavTNgasHPtpu/Bfl6oSf36S9xwr5EqJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=mYvn8ECSq/Bv76IowA3q7GwIYsuIJWbz3L/aIrMGX+ZERLxfaS9tjqW0X6x7tmlry qhB3YP8fmhWsqax0ncN8Y2zb/eH+xdT1Og+YQrOSYzAIOn9ntbRWOwCa8vT3QFU/x8 u9gk5Fw3XeLMfSz4mWMWLuN8R1O8xOXq/GVZZ4js= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Theodor Arsenij Larionov Trichkine , Julian Anastasov , Pablo Neira Ayuso Subject: [PATCH 6.18 472/703] ipvs: ftp: skip conntrack templates in ip_vs_ftp_out Date: Fri, 4 Dec 2026 19:06:11 +0900 Message-ID: <20261204100640.348375706@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodor Arsenij Larionov Trichkine commit 4656934d460da68382cf91766a1ff2d0610554ae upstream. A CT target hooked after conntrack attaches its template to a packet that conntrack left without an entry. On an IPVS FTP PASV/EPSV reply, ip_vs_ftp_out() then mangles with the template and creates an expectation with the template as master. Deleting the CT rule frees the template and leaves the expectation, so a later expectation flush reads freed memory: BUG: KASAN: slab-use-after-free in nf_ct_unlink_expect_report Reachable with CAP_NET_ADMIN in a user namespace. Skip templates, as nft_ct and nfnetlink_queue do. Fixes: f4bc17cdd205 ("ipvs: netfilter connection tracking changes") Cc: stable@vger.kernel.org Signed-off-by: Theodor Arsenij Larionov Trichkine Acked-by: Julian Anastasov Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/ipvs/ip_vs_ftp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/ipvs/ip_vs_ftp.c +++ b/net/netfilter/ipvs/ip_vs_ftp.c @@ -369,7 +369,7 @@ static int ip_vs_ftp_out(struct ip_vs_ap buf_len = strlen(buf); ct = nf_ct_get(skb, &ctinfo); - if (ct) { + if (ct && !nf_ct_is_template(ct)) { bool mangled; /* If mangling fails this function will return 0