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 04F953CC303; Tue, 16 Jun 2026 18:55:19 +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=1781636120; cv=none; b=C1uV0oSV1js+hzqDzYpJCQcD52Zo3tmBJstoRKMWux7OR3aIQmHD89nCzVSUQFybEVeXlJIfMEor43hEFWCnOZEgTCDJ06mf9Y1T2rEkAMNkvnZdbsoJaRss76rK2ylLQiRLndkHgZvtPNAYNPJvmZpctOSSWVlNsaZy8ZnwLPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636120; c=relaxed/simple; bh=28mZAeEIFoNc824oACxXY8cFyO9AaMoNzmkyqoOoXT8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aGqBuXdB9h/wSsAmmWCMKNyfxUdtoiibyaNrKDVkFoCGCcJKj7uTuAyb2PHY0mYnZEkKvZtpyKQ6ibZfkJeP4W0rLDH2sXM5/QSmJT9210g4WKh+kVKpxFpf+tCzPb5SSzA8jNxQLLcyk1h88LErgi7wMt/C5tyx9I8ix0KY+7I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=FN81bMpF; 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="FN81bMpF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06D8A1F000E9; Tue, 16 Jun 2026 18:55:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781636118; bh=6r9xeRf1jCaeVRGC6xvYYUbEfmI75Eby893ijSfHvKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FN81bMpFaMER5mXBeJa4Y07L1Yiw+krC6KwgHJtWZOP0GWQXzpeg8UZOTXMvvP2vv LeKLaCjQf/Y72bv+Ym/9Xu9zWpjjU3w2pflpFxxhxSI5bcaCmauYWi2HnNLdDWmDTB T1ukf1i34qcNyYxPf8/CYRBVXBKTYbXQycBQF6Lw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tristan Madani , Fernando Fernandez Mancera , Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.10 178/342] netfilter: nft_tunnel: fix use-after-free on object destroy Date: Tue, 16 Jun 2026 20:27:54 +0530 Message-ID: <20260616145056.496154108@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tristan Madani commit c32b26aaa2f9216520a38b3f4bfeec846eb3eb8a upstream. nft_tunnel_obj_destroy() calls metadata_dst_free() which directly kfree()s the metadata_dst, ignoring the dst_entry refcount. Packets that took a reference via dst_hold() in nft_tunnel_obj_eval() and are still queued (e.g. in a netem qdisc) are left with a dangling pointer. When these packets are eventually dequeued, dst_release() operates on freed memory. Replace metadata_dst_free() with dst_release() so the metadata_dst is freed only after all references are dropped. The dst subsystem already handles metadata_dst cleanup in dst_destroy() when DST_METADATA is set. Fixes: af308b94a2a4 ("netfilter: nf_tables: add tunnel support") Cc: stable@vger.kernel.org Signed-off-by: Tristan Madani Reviewed-by: Fernando Fernandez Mancera Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nft_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/nft_tunnel.c +++ b/net/netfilter/nft_tunnel.c @@ -669,7 +669,7 @@ static void nft_tunnel_obj_destroy(const { struct nft_tunnel_obj *priv = nft_obj_data(obj); - metadata_dst_free(priv->md); + dst_release(&priv->md->dst); } static struct nft_object_type nft_tunnel_obj_type;