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 E7C3875809 for ; Mon, 15 Sep 2025 14:46:47 +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=1757947609; cv=none; b=ekw5hwE1h13sWE1QZtGI9VUwpIx8Ic73qtVX7CkXdFZV2pxRL4JHM2kQoMJsTIxVc3tVRJ3ZsukCf5raVceRXlpTHve0i+ZX8MV4a99J5qgBU0D3gkTQCKs9/ma18VVOAiE6XtApO9nGf2Pjtn4O0jzdfQ2adAI6kSojNMj/MzU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757947609; c=relaxed/simple; bh=UXxVfxYAa2h6WRqlQTB/6mXU6BsnNtgxL96YGidv630=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=mY0GDNno8jH81hnmpMFQrGUfNVU3wbEAl4zw+kFCALx+yBViT7KnBD9Q6Fnt/KDErnxgPHBt+pgy/i8wFTQ4qCZuIkV8UlXaZq3leZk3XiPTm+YhwCxNc7N+yqlAUxhDuuMBOLJvwW/OWt+hYEL30mR/f0dsspbiwLw72iWJ1K0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=BUjr89gE; 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="BUjr89gE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F114CC4CEF1; Mon, 15 Sep 2025 14:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1757947607; bh=UXxVfxYAa2h6WRqlQTB/6mXU6BsnNtgxL96YGidv630=; h=From:To:Cc:Subject:Date:Reply-to:From; b=BUjr89gE85D2qWcwIlmVZOVqKgnfQB7LXngvJMMDXdJYYFobnAro62SUHNKWkXae5 ym/u/5J4pcH6m5XheEBwZ/Xe6kRYC3UvHrF/ghY0a7Uxafhr00EFEYTRsd8yvrUF2D anXzQUDW6x2mNULuXtnNhQnXX/U7zQrWdH6g4Gwo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-50303: drm/amdkfd: Fix double release compute pasid Date: Mon, 15 Sep 2025 16:46:05 +0200 Message-ID: <2025091558-CVE-2022-50303-7759@gregkh> X-Mailer: git-send-email 2.51.0 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=3461; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=UtLU1E2porY0ZgDZHMLYXIHvtHnQv+Z9SQkFavewMLI=; b=owGbwMvMwCRo6H6F97bub03G02pJDBkn1JZdsTflECz57rNrc9KW8+yX67ZrnJd5G2A4bYtss ZHt9WTTjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZhIgD7DXHm7Iwy/zTxjqtUM 1Dwj2OfkiLwSZ5hnVlZsFSAn5RfptJ+9Y83K8ouqBzUB 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: drm/amdkfd: Fix double release compute pasid If kfd_process_device_init_vm returns failure after vm is converted to compute vm and vm->pasid set to compute pasid, KFD will not take pdd->drm_file reference. As a result, drm close file handler maybe called to release the compute pasid before KFD process destroy worker to release the same pasid and set vm->pasid to zero, this generates below WARNING backtrace and NULL pointer access. Add helper amdgpu_amdkfd_gpuvm_set_vm_pasid and call it at the last step of kfd_process_device_init_vm, to ensure vm pasid is the original pasid if acquiring vm failed or is the compute pasid with pdd->drm_file reference taken to avoid double release same pasid. amdgpu: Failed to create process VM object ida_free called for id=32770 which is not allocated. WARNING: CPU: 57 PID: 72542 at ../lib/idr.c:522 ida_free+0x96/0x140 RIP: 0010:ida_free+0x96/0x140 Call Trace: amdgpu_pasid_free_delayed+0xe1/0x2a0 [amdgpu] amdgpu_driver_postclose_kms+0x2d8/0x340 [amdgpu] drm_file_free.part.13+0x216/0x270 [drm] drm_close_helper.isra.14+0x60/0x70 [drm] drm_release+0x6e/0xf0 [drm] __fput+0xcc/0x280 ____fput+0xe/0x20 task_work_run+0x96/0xc0 do_exit+0x3d0/0xc10 BUG: kernel NULL pointer dereference, address: 0000000000000000 RIP: 0010:ida_free+0x76/0x140 Call Trace: amdgpu_pasid_free_delayed+0xe1/0x2a0 [amdgpu] amdgpu_driver_postclose_kms+0x2d8/0x340 [amdgpu] drm_file_free.part.13+0x216/0x270 [drm] drm_close_helper.isra.14+0x60/0x70 [drm] drm_release+0x6e/0xf0 [drm] __fput+0xcc/0x280 ____fput+0xe/0x20 task_work_run+0x96/0xc0 do_exit+0x3d0/0xc10 The Linux kernel CVE team has assigned CVE-2022-50303 to this issue. Affected and fixed versions =========================== Fixed in 6.0.19 with commit 89f0d766c9e3fdeafbed6f855d433c2768cde862 Fixed in 6.1.5 with commit a02c07b619899179384fde06f951530438a3512d Fixed in 6.2 with commit 1a799c4c190ea9f0e81028e3eb3037ed0ab17ff5 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-2022-50303 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/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c drivers/gpu/drm/amd/amdkfd/kfd_process.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/89f0d766c9e3fdeafbed6f855d433c2768cde862 https://git.kernel.org/stable/c/a02c07b619899179384fde06f951530438a3512d https://git.kernel.org/stable/c/1a799c4c190ea9f0e81028e3eb3037ed0ab17ff5