Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BEB14165EFC for ; Thu, 27 Feb 2025 02:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622147; cv=none; b=c/ycKtZDRLuoVWgs0dn5fgSN22SFwZcFe9oqVg874JeLps3y4ewcG1l92I/VNwVKew7lXYdF2elPV0ulwCGvPOLffDBNZiMmr0Z6dyG2u3XzOkC9La1N8JSZaA9YRYu1g9xCnkhgRMIdZiLDgISB6AqJP2uNBoA6Yo7nHpUdcPY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740622147; c=relaxed/simple; bh=4/f08JsuC9q9ZQkL/HgSxryjISWWhbKp19wZ5739fAA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SmLetyNCTYyjZpnWv5NmAi4vzwV0HWlEm3yxiIk3HRu+yn0ktu34tQ2aZGvXXM/pUp3JdM50EGfaoDcPQb7q4QPcbrgO1rS70cRzKebg6gg7qVNkmEfC+0PQD7Qb1w4PpQ8rF5ygGEcTHyuQYJ4pj4EADHeemo/HdQ/anUl613I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=glhdCbav; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="glhdCbav" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DFEAC4CED6; Thu, 27 Feb 2025 02:09:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740622147; bh=4/f08JsuC9q9ZQkL/HgSxryjISWWhbKp19wZ5739fAA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=glhdCbavT2rI+Cl3wBLuuV6bT8hz8OccCosGI1HFzkmeQWq4It1BjaB1nL4iqNThH N0y0naN6dqJjjJc6dexOb/YmNmoHN7qR4a+SrjqIzsd2vYtP/qBinWnLFTv09WvzRb LYk5R/HXNkmloYsBPGrEQOH9mZ27hISqjEE/wS+c= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-21714: RDMA/mlx5: Fix implicit ODP use after free Date: Wed, 26 Feb 2025 18:06:09 -0800 Message-ID: <2025022645-CVE-2025-21714-8169@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4574; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=4/f08JsuC9q9ZQkL/HgSxryjISWWhbKp19wZ5739fAA=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7T1TeXuy3Q1FWIYg376Wl5zm3SzIGNfNCi4vZTd+nJ mssPlDTEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABMR38qwoL2Ihdshbc/6BOVV RTYPBMoaO7/eZ1jQsKps7ZTuGzH5CnsEJxdJHemxifkGAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: RDMA/mlx5: Fix implicit ODP use after free Prevent double queueing of implicit ODP mr destroy work by using __xa_cmpxchg() to make sure this is the only time we are destroying this specific mr. Without this change, we could try to invalidate this mr twice, which in turn could result in queuing a MR work destroy twice, and eventually the second work could execute after the MR was freed due to the first work, causing a user after free and trace below. refcount_t: underflow; use-after-free. WARNING: CPU: 2 PID: 12178 at lib/refcount.c:28 refcount_warn_saturate+0x12b/0x130 Modules linked in: bonding ib_ipoib vfio_pci ip_gre geneve nf_tables ip6_gre gre ip6_tunnel tunnel6 ipip tunnel4 ib_umad rdma_ucm mlx5_vfio_pci vfio_pci_core vfio_iommu_type1 mlx5_ib vfio ib_uverbs mlx5_core iptable_raw openvswitch nsh rpcrdma ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm ib_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay zram zsmalloc fuse [last unloaded: ib_uverbs] CPU: 2 PID: 12178 Comm: kworker/u20:5 Not tainted 6.5.0-rc1_net_next_mlx5_58c644e #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: events_unbound free_implicit_child_mr_work [mlx5_ib] RIP: 0010:refcount_warn_saturate+0x12b/0x130 Code: 48 c7 c7 38 95 2a 82 c6 05 bc c6 fe 00 01 e8 0c 66 aa ff 0f 0b 5b c3 48 c7 c7 e0 94 2a 82 c6 05 a7 c6 fe 00 01 e8 f5 65 aa ff <0f> 0b 5b c3 90 8b 07 3d 00 00 00 c0 74 12 83 f8 01 74 13 8d 50 ff RSP: 0018:ffff8881008e3e40 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000027 RDX: ffff88852c91b5c8 RSI: 0000000000000001 RDI: ffff88852c91b5c0 RBP: ffff8881dacd4e00 R08: 00000000ffffffff R09: 0000000000000019 R10: 000000000000072e R11: 0000000063666572 R12: ffff88812bfd9e00 R13: ffff8881c792d200 R14: ffff88810011c005 R15: ffff8881002099c0 FS: 0000000000000000(0000) GS:ffff88852c900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5694b5e000 CR3: 00000001153f6003 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: ? refcount_warn_saturate+0x12b/0x130 free_implicit_child_mr_work+0x180/0x1b0 [mlx5_ib] process_one_work+0x1cc/0x3c0 worker_thread+0x218/0x3c0 kthread+0xc6/0xf0 ret_from_fork+0x1f/0x30 The Linux kernel CVE team has assigned CVE-2025-21714 to this issue. Affected and fixed versions =========================== Issue introduced in 5.5 with commit 5256edcb98a14b11409a2d323f56a70a8b366363 and fixed in 6.12.13 with commit 7cc8f681f6d4ae4478ae0f60485fc768f2b450da Issue introduced in 5.5 with commit 5256edcb98a14b11409a2d323f56a70a8b366363 and fixed in 6.13.2 with commit edfb65dbb9ffd3102f3ff4dd21316158e56f1976 Issue introduced in 5.5 with commit 5256edcb98a14b11409a2d323f56a70a8b366363 and fixed in 6.14-rc1 with commit d3d930411ce390e532470194296658a960887773 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2025-21714 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/infiniband/hw/mlx5/odp.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/7cc8f681f6d4ae4478ae0f60485fc768f2b450da https://git.kernel.org/stable/c/edfb65dbb9ffd3102f3ff4dd21316158e56f1976 https://git.kernel.org/stable/c/d3d930411ce390e532470194296658a960887773