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 63F9F50B8B1; Wed, 30 Sep 2026 16:28:08 +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=1790785693; cv=none; b=c8HkPwfJxnGpJRLCpjxJ4YgDWaaAHAYsL7cvsuVRY3qhVtlO47CFDwPwx7wc2SKzj8ssBhkRLN9lYF2NywlXRdx2uKIY55XpAe7La4LL59uM2Sn5oGBGGls9VNyxPf4vOxlxmVMYw6OnsRtznpRkvYqSrKTjqrHs1ZTpmiq0eEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790785693; c=relaxed/simple; bh=2/SyEQzpaHYnrmuCpKUx4xf3Zgecq7wOAwGE7E/k+8s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TxwAN1k04liM4vjSOIm1k0BS0ydFtCvww4884pPpDXDaWvRQ0kSvlV0hyWHcKmQezJRgGFQFsXk5axvjyCWmk2zw6hChSORhT4czPfiXP1yeGHOHsAvfP2zV632/Di/MAnhxLm1HkPBHph3PHmA1liT9+6GLU4c7CyN7Eal2UwI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QYxF4Bdr; 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="QYxF4Bdr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 682601F000FF; Wed, 30 Sep 2026 16:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790785687; bh=5Kgkk+GX7klvuyNZS2g2FXE/EZcamNuYYoTnIonKf7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QYxF4Bdr2f1fNKSsEX1d8kcseJgqnK6QfEbO6a2ru2YWkjJ0fYFUa2GdiHKCcmy+K JmVuQSgRHrktG86OyKDorZ649sHKW2q4p5T31fQ2GJJRkpmWfAoFBOiWSX9dNduUuV na+jqjqAJOLt0U/6hDd7WARAiDM5J5ssreRLd0aU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kyle Zeng , David Lee , Steffen Klassert , Sasha Levin Subject: [PATCH 6.1 590/982] xfrm: fix compat ALLOCSPI request use-after-free Date: Wed, 30 Sep 2026 17:22:06 +0200 Message-ID: <20260930152429.458245522@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260930152416.775402466@linuxfoundation.org> References: <20260930152416.775402466@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kyle Zeng [ Upstream commit d1ebd9081879fd9ae9c8fb7e8928f19cc88ae320 ] xfrm_state_netlink() builds the ALLOCSPI response with dump_one_state(), which already calls alloc_compat() with the response skb and header. xfrm_alloc_userspi() then calls alloc_compat() again, but passes the original request skb and its header. For a compat request, the translator therefore interprets the 228-byte compat xfrm_userspi_info as the 232-byte native layout and reads four bytes past the declared payload. It also publishes the translated child through the request's frag_list. A multicast clone of the request shares skb_shared_info and can observe that child. xfrm_user_rcv_msg() frees it after the request handler returns, racing a compat receiver which may still be copying from it and resulting in a use-after-free. Remove the redundant conversion. The response keeps its correct compat translation from dump_one_state(), and no child is attached to the inbound request. Fixes: 5f3eea6b7e8f ("xfrm/compat: Attach xfrm dumps to 64=>32 bit translator") Assisted-by: Codex:gpt-5.6-sol Codex:gpt-5.5-cyber Signed-off-by: Kyle Zeng Co-developed-by: David Lee Signed-off-by: David Lee Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin --- net/xfrm/xfrm_user.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 66c73b71ad653..6fb79def144c8 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c @@ -1563,7 +1563,6 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, struct net *net = sock_net(skb->sk); struct xfrm_state *x; struct xfrm_userspi_info *p; - struct xfrm_translator *xtr; struct sk_buff *resp_skb; xfrm_address_t *daddr; int family; @@ -1614,17 +1613,6 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh, goto out; } - xtr = xfrm_get_translator(); - if (xtr) { - err = xtr->alloc_compat(skb, nlmsg_hdr(skb)); - - xfrm_put_translator(xtr); - if (err) { - kfree_skb(resp_skb); - goto out; - } - } - err = nlmsg_unicast(xfrm_net_nlsk(net, skb), resp_skb, NETLINK_CB(skb).portid); out: -- 2.53.0