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 7CDAE256C71 for ; Fri, 22 Aug 2025 16:02:10 +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=1755878530; cv=none; b=mWEVTd6MDemslokNMSk4U+tR3VdAT0Uoudm2Wt0k2xnD3+cY8SEywyhD5Kc706C3c5IAmgjzT6phaxSTDtdTLD2q/74gUQknWIuWjk1r9Q97CxcN5nDbLX3Bb4Y+4AJo75EnGrtM0obha6/7RWzkOOu2KeHG/cydMVpQlAb/JPo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755878530; c=relaxed/simple; bh=iKVwb3/TcvfoGNr1YVeMDXaCG+ZW/6Xz+x9PwNZStSU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XqI4ATNFjsRvcwXQaQoRznqzhTlMBO5r+7q7AzKoni7FJVOolmLc7Si/e3rvGH9HFmv6tYaukwq8wBGjXcHv6CMsDHZFVAOXE2a2EMqtKLRFDGEbBGxAgkXNNmSHtlmnj186Xnqv6z6pTcR0nKyrLOCh9FjQMM3zmpiQKWm8FCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HeXvolKv; 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="HeXvolKv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F426C4CEED; Fri, 22 Aug 2025 16:02:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755878530; bh=iKVwb3/TcvfoGNr1YVeMDXaCG+ZW/6Xz+x9PwNZStSU=; h=From:To:Cc:Subject:Date:Reply-to:From; b=HeXvolKvh+skdQr5aexUIQc1Yl+gzi2W1bVw+W3VtbIqiu84tXD86E+XpiADN8Htv kt5/znL8H6u+h6O5eStI6OTPA0UPz1xP7qSXs8ox3SsuJjaDbEcAHXhfP89OgFyTp4 gR0bBxAKmGjEOHcy3NKOdcMGLHIzcd0Z3xbBl/g4= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38628: vdpa/mlx5: Fix release of uninitialized resources on error path Date: Fri, 22 Aug 2025 18:00:37 +0200 Message-ID: <2025082231-CVE-2025-38628-27f4@gregkh> X-Mailer: git-send-email 2.50.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=4855; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=PSwyISON1dqQiR4XKe9Dv+rouObX09tUstpO8+Dwhko=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkrpsj/yLrTWHpb33lxsaH+lT3uu0/PPbto57ElQbPiG sunMpSldsSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBEJGwYFmznnLjXlkvhLftS 9Vfm7gf+HoyJFGZYsG92wXKXzU1hwUe7q5e83zapyjTmIAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: vdpa/mlx5: Fix release of uninitialized resources on error path The commit in the fixes tag made sure that mlx5_vdpa_free() is the single entrypoint for removing the vdpa device resources added in mlx5_vdpa_dev_add(), even in the cleanup path of mlx5_vdpa_dev_add(). This means that all functions from mlx5_vdpa_free() should be able to handle uninitialized resources. This was not the case though: mlx5_vdpa_destroy_mr_resources() and mlx5_cmd_cleanup_async_ctx() were not able to do so. This caused the splat below when adding a vdpa device without a MAC address. This patch fixes these remaining issues: - Makes mlx5_vdpa_destroy_mr_resources() return early if called on uninitialized resources. - Moves mlx5_cmd_init_async_ctx() early on during device addition because it can't fail. This means that mlx5_cmd_cleanup_async_ctx() also can't fail. To mirror this, move the call site of mlx5_cmd_cleanup_async_ctx() in mlx5_vdpa_free(). An additional comment was added in mlx5_vdpa_free() to document the expectations of functions called from this context. Splat: mlx5_core 0000:b5:03.2: mlx5_vdpa_dev_add:3950:(pid 2306) warning: No mac address provisioned? ------------[ cut here ]------------ WARNING: CPU: 13 PID: 2306 at kernel/workqueue.c:4207 __flush_work+0x9a/0xb0 [...] Call Trace: ? __try_to_del_timer_sync+0x61/0x90 ? __timer_delete_sync+0x2b/0x40 mlx5_vdpa_destroy_mr_resources+0x1c/0x40 [mlx5_vdpa] mlx5_vdpa_free+0x45/0x160 [mlx5_vdpa] vdpa_release_dev+0x1e/0x50 [vdpa] device_release+0x31/0x90 kobject_cleanup+0x37/0x130 mlx5_vdpa_dev_add+0x327/0x890 [mlx5_vdpa] vdpa_nl_cmd_dev_add_set_doit+0x2c1/0x4d0 [vdpa] genl_family_rcv_msg_doit+0xd8/0x130 genl_family_rcv_msg+0x14b/0x220 ? __pfx_vdpa_nl_cmd_dev_add_set_doit+0x10/0x10 [vdpa] genl_rcv_msg+0x47/0xa0 ? __pfx_genl_rcv_msg+0x10/0x10 netlink_rcv_skb+0x53/0x100 genl_rcv+0x24/0x40 netlink_unicast+0x27b/0x3b0 netlink_sendmsg+0x1f7/0x430 __sys_sendto+0x1fa/0x210 ? ___pte_offset_map+0x17/0x160 ? next_uptodate_folio+0x85/0x2b0 ? percpu_counter_add_batch+0x51/0x90 ? filemap_map_pages+0x515/0x660 __x64_sys_sendto+0x20/0x30 do_syscall_64+0x7b/0x2c0 ? do_read_fault+0x108/0x220 ? do_pte_missing+0x14a/0x3e0 ? __handle_mm_fault+0x321/0x730 ? count_memcg_events+0x13f/0x180 ? handle_mm_fault+0x1fb/0x2d0 ? do_user_addr_fault+0x20c/0x700 ? syscall_exit_work+0x104/0x140 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7f0c25b0feca [...] ---[ end trace 0000000000000000 ]--- The Linux kernel CVE team has assigned CVE-2025-38628 to this issue. Affected and fixed versions =========================== Issue introduced in 6.12 with commit 83e445e64f48bdae3f25013e788fcf592f142576 and fixed in 6.12.42 with commit 37f26b9013b46457b0a96633fc3a7dc977d8beb1 Issue introduced in 6.12 with commit 83e445e64f48bdae3f25013e788fcf592f142576 and fixed in 6.15.10 with commit cf4fc23d0d3d5b89b36f0d79f2674510bb574d8e Issue introduced in 6.12 with commit 83e445e64f48bdae3f25013e788fcf592f142576 and fixed in 6.16.1 with commit 6de4ef950dd56a6a81daf92d8a1d864fc6a56971 Issue introduced in 6.12 with commit 83e445e64f48bdae3f25013e788fcf592f142576 and fixed in 6.17-rc1 with commit cc51a66815999afb7e9cd845968de4fdf07567b7 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-38628 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/vdpa/mlx5/core/mr.c drivers/vdpa/mlx5/net/mlx5_vnet.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/37f26b9013b46457b0a96633fc3a7dc977d8beb1 https://git.kernel.org/stable/c/cf4fc23d0d3d5b89b36f0d79f2674510bb574d8e https://git.kernel.org/stable/c/6de4ef950dd56a6a81daf92d8a1d864fc6a56971 https://git.kernel.org/stable/c/cc51a66815999afb7e9cd845968de4fdf07567b7