7.8high
drm: Don't unref the same fb many times by mistake due to deadlock handling
- Severity
- 7.8high CVSS:3.1 by Linux
- Exploit likelihood
- 0.23% (higher than 14% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: drm: Don't unref the same fb many times by mistake due to deadlock handling If we get a deadlock after the fb lookup in drm_mode_page_flip_ioctl() we proceed to unref the fb and then retry the whole thing from the top. But we forget to reset the fb pointer back to NULL, and so if we then get another error during the retry, before the fb lookup, we proceed the unref the same fb again without having gotten another reference. The end result is that the fb will (eventually) end up being freed while it's still in use. Reset fb to NULL once we've unreffed it to avoid doing it again until we've done another fb lookup. This turned out to be pretty easy to hit on a DG2 when doing async flips (and CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y). The first symptom I saw that drm_closefb() simply got stuck in a busy loop while walking the framebuffer list. Fortunately I was able to convince it to oops instead, and from there it was easier to track down the culprit.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before 376e21a9e4c2c63ee5d8d3aa74be5082c3882229, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before 9dd334a8245011ace45e53298175c7b659edb3e7, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before f55261469be87c55df13db76dc945f6bcd825105, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before b4af63da9d94986c529d74499fdfe44289acd551, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before 62f2e79cf9f4f47cc9dea9cebdf58d9f7b5695e0, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before d7afdf360f4ac142832b098b4de974e867cc063c, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before bfd0feb1b109cb63b87fdcd00122603787c75a1a, from 29dc0d1de18239cf3ef8bab578b8321ed340d81c before cb4daf271302d71a6b9a7c01bd0b6d76febd8f0c and 1 more Not affected: before 4.12, from 4.19.307 up to 4.19.*, from 5.4.269 up to 5.4.*, from 5.10.210 up to 5.10.*, from 5.15.149 up to 5.15.*, from 6.1.76 up to 6.1.* | CVE List |
| linux linux_kernel | before 4.19.307, from 4.20 before 5.4.269, from 5.5 before 5.10.210, from 5.11 before 5.15.149, from 5.16 before 6.1.76, from 6.2 before 6.6.15, from 6.7 before 6.7.3 | NVD |
All scores
| Linux | 7.8high CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| NVD | 5.5medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: drm: Don't unref the same fb many times by mistake due to deadlock handling If we get a deadlock after the fb lookup in drm_mode_page_flip_ioctl() we proceed to unref the fb and then retry the whole thing from the top. But we forget to reset the fb pointer back to NULL, and so if we then get another error during the retry, before the fb lookup, we proceed the unref the same fb again without having gotten another reference. The end result is that the fb will (eventually) end up being freed while it's still in use. Reset fb to NULL once we've unreffed it to avoid doing it again until we've done another fb lookup. This turned out to be pretty easy to hit on a DG2 when doing async flips (and CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y). The first symptom I saw that drm_closefb() simply got stuck in a busy loop while walking the framebuffer list. Fortunately I was able to convince it to oops instead, and from there it was easier to track down the culprit.
NVD (es)
En el kernel de Linux se ha resuelto la siguiente vulnerabilidad: drm: No desreferenciar el mismo fb muchas veces por error debido al manejo de interbloqueos Si obtenemos un punto muerto después de la búsqueda de fb en drm_mode_page_flip_ioctl() procedemos a desreferenciar el fb y luego Vuelva a intentarlo todo desde arriba. Pero nos olvidamos de restablecer el puntero fb a NULL, por lo que si obtenemos otro error durante el reintento, antes de la búsqueda de fb, procedemos a desref el mismo fb nuevamente sin haber obtenido otra referencia. El resultado final es que el Facebook (eventualmente) terminará siendo liberado mientras todavía está en uso. Restablezca fb a NULL una vez que lo hayamos eliminado para evitar hacerlo nuevamente hasta que hayamos realizado otra búsqueda de fb. Esto resultó ser bastante fácil de lograr en un DG2 cuando se realizan volteos asíncronos (y CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y). El primer síntoma que vi fue que drm_closefb() simplemente se quedó atascado en un bucle ocupado mientras recorría la lista de framebuffer. Afortunadamente, pude convencerlo de que lo hiciera, y a partir de ahí fue más fácil localizar al culpable.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-52486 changed 2026-08-05 | CVE Terms of Use |
| NVD | CVE-2023-52486 changed 2026-08-04 | Public domain |