{"id":"CVE-2025-40288","aliases":["CVE-2025-40288"],"related":[],"kind":"vulnerability","state":"published","title":"drm/amdgpu: Fix NULL pointer dereference in VRAM logic for APU devices","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/amdgpu: Fix NULL pointer dereference in VRAM logic for APU devices\n\nPreviously, APU platforms (and other scenarios with uninitialized VRAM managers)\ntriggered a NULL pointer dereference in `ttm_resource_manager_usage()`. The root\ncause is not that the `struct ttm_resource_manager *man` pointer itself is NULL,\nbut that `man->bdev` (the backing device pointer within the manager) remains\nuninitialized (NULL) on APUs—since APUs lack dedicated VRAM and do not fully\nset up VRAM manager structures. When `ttm_resource_manager_usage()` attempts to\nacquire `man->bdev->lru_lock`, it dereferences the NULL `man->bdev`, leading to\na kernel OOPS.\n\n1. **amdgpu_cs.c**: Extend the existing bandwidth control check in\n   `amdgpu_cs_get_threshold_for_moves()` to include a check for\n   `ttm_resource_manager_used()`. If the manager is not used (uninitialized\n   `bdev`), return 0 for migration thresholds immediately—skipping VRAM-specific\n   logic that would trigger the NULL dereference.\n\n2. **amdgpu_kms.c**: Update the `AMDGPU_INFO_VRAM_USAGE` ioctl and memory info\n   reporting to use a conditional: if the manager is used, return the real VRAM\n   usage; otherwise, return 0. This avoids accessing `man->bdev` when it is\n   NULL.\n\n3. **amdgpu_virt.c**: Modify the vf2pf (virtual function to physical function)\n   data write path. Use `ttm_resource_manager_used()` to check validity: if the\n   manager is usable, calculate `fb_usage` from VRAM usage; otherwise, set\n   `fb_usage` to 0 (APUs have no discrete framebuffer to report).\n\nThis approach is more robust than APU-specific checks because it:\n- Works for all scenarios where the VRAM manager is uninitialized (not just APUs),\n- Aligns with TTM's design by using its native helper function,\n- Preserves correct behavior for discrete GPUs (which have fully initialized\n  `man->bdev` and pass the `ttm_resource_manager_used()` check).\n\nv4: use ttm_resource_manager_used(&adev->mman.vram_mgr.manager) instead of checking the adev->gmc.is_app_apu flag (Christian)","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ndrm/amdgpu: Fix NULL pointer dereference in VRAM logic for APU devices\n\nPreviously, APU platforms (and other scenarios with uninitialized VRAM managers)\ntriggered a NULL pointer dereference in `ttm_resource_manager_usage()`. The root\ncause is not that the `struct ttm_resource_manager *man` pointer itself is NULL,\nbut that `man->bdev` (the backing device pointer within the manager) remains\nuninitialized (NULL) on APUs—since APUs lack dedicated VRAM and do not fully\nset up VRAM manager structures. When `ttm_resource_manager_usage()` attempts to\nacquire `man->bdev->lru_lock`, it dereferences the NULL `man->bdev`, leading to\na kernel OOPS.\n\n1. **amdgpu_cs.c**: Extend the existing bandwidth control check in\n   `amdgpu_cs_get_threshold_for_moves()` to include a check for\n   `ttm_resource_manager_used()`. If the manager is not used (uninitialized\n   `bdev`), return 0 for migration thresholds immediately—skipping VRAM-specific\n   logic that would trigger the NULL dereference.\n\n2. **amdgpu_kms.c**: Update the `AMDGPU_INFO_VRAM_USAGE` ioctl and memory info\n   reporting to use a conditional: if the manager is used, return the real VRAM\n   usage; otherwise, return 0. This avoids accessing `man->bdev` when it is\n   NULL.\n\n3. **amdgpu_virt.c**: Modify the vf2pf (virtual function to physical function)\n   data write path. Use `ttm_resource_manager_used()` to check validity: if the\n   manager is usable, calculate `fb_usage` from VRAM usage; otherwise, set\n   `fb_usage` to 0 (APUs have no discrete framebuffer to report).\n\nThis approach is more robust than APU-specific checks because it:\n- Works for all scenarios where the VRAM manager is uninitialized (not just APUs),\n- Aligns with TTM's design by using its native helper function,\n- Preserves correct behavior for discrete GPUs (which have fully initialized\n  `man->bdev` and pass the `ttm_resource_manager_used()` check).\n\nv4: use ttm_resource_manager_used(&adev->mman.vram_mgr.manager) instead of checking the adev->gmc.is_app_apu flag (Christian)","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ndrm/amdgpu: Corrección de desreferencia de puntero NULL en la lógica de VRAM para dispositivos APU\n\nAnteriormente, las plataformas APU (y otros escenarios con gestores de VRAM no inicializados) desencadenaban una desreferencia de puntero NULL en ttm_resource_manager_usage(). La causa raíz no es que el propio puntero struct ttm_resource_manager man sea NULL, sino que man -> bdev (el puntero al dispositivo de respaldo dentro del gestor) permanece sin inicializar (NULL) en las APU -ya que las APU carecen de VRAM dedicada y no configuran completamente las estructuras del gestor de VRAM. Cuando ttm_resource_manager_usage() intenta adquirir man -> bdev -> lru_lock, desreferencia el man -> bdev NULL, lo que lleva a un OOPS del kernel.\n\n1. amdgpu_cs.c: Extender la comprobación de control de ancho de banda existente en amdgpu_cs_get_threshold_for_moves() para incluir una comprobación de ttm_resource_manager_used(). Si el gestor no se utiliza (bdev no inicializado), devolver 0 para los umbrales de migración inmediatamente -saltándose la lógica específica de VRAM que desencadenaría la desreferencia NULL.\n\n2. amdgpu_kms.c: Actualizar el ioctl AMDGPU_INFO_VRAM_USAGE y la notificación de información de memoria para usar una condicional: si el gestor se utiliza, devolver el uso real de VRAM; de lo contrario, devolver 0. Esto evita acceder a man -> bdev cuando es NULL.\n\n3. amdgpu_virt.c: Modificar la ruta de escritura de datos vf2pf (función virtual a función física). Usar ttm_resource_manager_used() para comprobar la validez: si el gestor es utilizable, calcular fb_usage a partir del uso de VRAM; de lo contrario, establecer fb_usage en 0 (las APU no tienen un framebuffer discreto que reportar).\n\nEste enfoque es más robusto que las comprobaciones específicas de APU porque:\n- Funciona para todos los escenarios donde el gestor de VRAM no está inicializado (no solo para APU),\n- Se alinea con el diseño de TTM al usar su función auxiliar nativa,\n- Preserva el comportamiento correcto para GPU discretas (que tienen man -> bdev completamente inicializado y pasan la comprobación ttm_resource_manager_used()).\n\nv4: usar ttm_resource_manager_used(&adev -> mman.vram_mgr.manager) en lugar de comprobar el flag adev -> gmc.is_app_apu (Christian)","source":"nvd"}],"published":"2025-12-06T21:51:14.440Z","modified":"2026-10-14T22:10:00.210Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"d38ceaf99ed015f2a0b9af3499791bd3a3daae21","fixed":"e70113b741ba253886cd71dbadfe3ea444bb2f5c","status":"affected"},{"type":"git","introduced":"d38ceaf99ed015f2a0b9af3499791bd3a3daae21","fixed":"1243e396148a65bb6c42a2b70fe43e50c16c494f","status":"affected"},{"type":"git","introduced":"d38ceaf99ed015f2a0b9af3499791bd3a3daae21","fixed":"43aa61c18a3a45042b098b7a1186ffb29364002c","status":"affected"},{"type":"git","introduced":"d38ceaf99ed015f2a0b9af3499791bd3a3daae21","fixed":"070bdce18fb12a49eb9c421e57df17d2ad29bf5f","status":"affected"},{"type":"git","introduced":"d38ceaf99ed015f2a0b9af3499791bd3a3daae21","fixed":"883f309add55060233bf11c1ea6947140372920f","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"4.2","status":"affected"},{"type":"semver","introduced":"0","fixed":"4.2","status":"unaffected"},{"type":"semver","introduced":"6.1.159","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.117","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.59","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.17.9","lastAffected":"6.17.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.18","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/e70113b741ba253886cd71dbadfe3ea444bb2f5c","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1243e396148a65bb6c42a2b70fe43e50c16c494f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/43aa61c18a3a45042b098b7a1186ffb29364002c","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/070bdce18fb12a49eb9c421e57df17d2ad29bf5f","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/883f309add55060233bf11c1ea6947140372920f","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-40288","url":"https://www.cve.org/CVERecord?id=CVE-2025-40288","licence":"CVE Terms of Use","modified":"2026-05-11T21:46:27.181Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-40288","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-40288","licence":"Public domain","modified":"2026-10-14T22:10:00.210Z"}],"updatedAt":"2026-11-25T22:59:08.381Z","epss":{"score":0.00199,"percentile":0.10242,"date":"2026-12-01T12:00:22.000Z"}}