Not scored
netpoll: Fix deadlock in memory allocation under spinlock
- Severity
- Not scored
- Exploit likelihood
- 0.20% (higher than 10% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Linux
Description
In the Linux kernel, the following vulnerability has been resolved: netpoll: Fix deadlock in memory allocation under spinlock Fix a AA deadlock in refill_skbs() where memory allocation while holding skb_pool->lock can trigger a recursive lock acquisition attempt. The deadlock scenario occurs when the system is under severe memory pressure: 1. refill_skbs() acquires skb_pool->lock (spinlock) 2. alloc_skb() is called while holding the lock 3. Memory allocator fails and calls slab_out_of_memory() 4. This triggers printk() for the OOM warning 5. The console output path calls netpoll_send_udp() 6. netpoll_send_udp() attempts to acquire the same skb_pool->lock 7. Deadlock: the lock is already held by the same CPU Call stack: refill_skbs() spin_lock_irqsave(&skb_pool->lock) <- lock acquired __alloc_skb() kmem_cache_alloc_node_noprof() slab_out_of_memory() printk() console_flush_all() netpoll_send_udp() skb_dequeue() spin_lock_irqsave(&skb_pool->lock) <- deadlock attempt This bug was exposed by commit 248f6571fd4c51 ("netpoll: Optimize skb refilling on critical path") which removed refill_skbs() from the critical path (where nested printk was being deferred), letting nested printk being called from inside refill_skbs() Refactor refill_skbs() to never allocate memory while holding the spinlock. Another possible solution to fix this problem is protecting the refill_skbs() from nested printks, basically calling printk_deferred_{enter,exit}() in refill_skbs(), then, any nested pr_warn() would be deferred. I prefer this approach, given I _think_ it might be a good idea to move the alloc_skb() from GFP_ATOMIC to GFP_KERNEL in the future, so, having the alloc_skb() outside of the lock will be necessary step. There is a possible TOCTOU issue when checking for the pool length, and queueing the new allocated skb, but, this is not an issue, given that an extra SKB in the pool is harmless and it will be eventually used.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Linux Linux | from 248f6571fd4c51531f7f8f07f186f7ae98a50afc before 06742a3ab884d7428c9050b205ffcf6a8a548397, from 248f6571fd4c51531f7f8f07f186f7ae98a50afc before 327c20c21d80e0d87834b392d83ae73c955ad8ff, 6.15 Not affected: before 6.15, from 6.17.8 up to 6.17.*, from 6.18 up to * | CVE List |
What each source says
CVE List
In the Linux kernel, the following vulnerability has been resolved: netpoll: Fix deadlock in memory allocation under spinlock Fix a AA deadlock in refill_skbs() where memory allocation while holding skb_pool->lock can trigger a recursive lock acquisition attempt. The deadlock scenario occurs when the system is under severe memory pressure: 1. refill_skbs() acquires skb_pool->lock (spinlock) 2. alloc_skb() is called while holding the lock 3. Memory allocator fails and calls slab_out_of_memory() 4. This triggers printk() for the OOM warning 5. The console output path calls netpoll_send_udp() 6. netpoll_send_udp() attempts to acquire the same skb_pool->lock 7. Deadlock: the lock is already held by the same CPU Call stack: refill_skbs() spin_lock_irqsave(&skb_pool->lock) <- lock acquired __alloc_skb() kmem_cache_alloc_node_noprof() slab_out_of_memory() printk() console_flush_all() netpoll_send_udp() skb_dequeue() spin_lock_irqsave(&skb_pool->lock) <- deadlock attempt This bug was exposed by commit 248f6571fd4c51 ("netpoll: Optimize skb refilling on critical path") which removed refill_skbs() from the critical path (where nested printk was being deferred), letting nested printk being called from inside refill_skbs() Refactor refill_skbs() to never allocate memory while holding the spinlock. Another possible solution to fix this problem is protecting the refill_skbs() from nested printks, basically calling printk_deferred_{enter,exit}() in refill_skbs(), then, any nested pr_warn() would be deferred. I prefer this approach, given I _think_ it might be a good idea to move the alloc_skb() from GFP_ATOMIC to GFP_KERNEL in the future, so, having the alloc_skb() outside of the lock will be necessary step. There is a possible TOCTOU issue when checking for the pool length, and queueing the new allocated skb, but, this is not an issue, given that an extra SKB in the pool is harmless and it will be eventually used.
NVD (es)
En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta: netpoll: Corrección de interbloqueo en la asignación de memoria bajo spinlock Corrige un interbloqueo AA en refill_skbs() donde la asignación de memoria mientras se mantiene skb_pool -> lock puede desencadenar un intento de adquisición recursiva del bloqueo. El escenario de interbloqueo ocurre cuando el sistema está bajo una presión de memoria severa: 1. refill_skbs() adquiere skb_pool -> lock (spinlock) 2. alloc_skb() es llamado mientras se mantiene el bloqueo 3. El asignador de memoria falla y llama a slab_out_of_memory() 4. Esto desencadena printk() para la advertencia de OOM 5. La ruta de salida de la consola llama a netpoll_send_udp() 6. netpoll_send_udp() intenta adquirir el mismo skb_pool -> lock 7. Interbloqueo: el bloqueo ya está en posesión de la misma CPU Pila de llamadas: refill_skbs() spin_lock_irqsave(&skb_pool -> lock) <- bloqueo adquirido __alloc_skb() kmem_cache_alloc_node_noprof() slab_out_of_memory() printk() console_flush_all() netpoll_send_udp() skb_dequeue() spin_lock_irqsave(&skb_pool -> lock) <- intento de interbloqueo Este error fue expuesto por el commit 248f6571fd4c51 ('netpoll: Optimize skb refilling on critical path') que eliminó refill_skbs() de la ruta crítica (donde el printk anidado estaba siendo diferido), permitiendo que el printk anidado fuera llamado desde dentro de refill_skbs() Refactorizar refill_skbs() para nunca asignar memoria mientras se mantiene el spinlock. Otra posible solución para corregir este problema es proteger refill_skbs() de printks anidados, básicamente llamando a printk_deferred_{enter,exit}() en refill_skbs(), entonces, cualquier pr_warn() anidado sería diferido. Prefiero este enfoque, dado que _creo_ que podría ser una buena idea mover alloc_skb() de GFP_ATOMIC a GFP_KERNEL en el futuro, por lo tanto, tener alloc_skb() fuera del bloqueo será un paso necesario. Existe un posible problema TOCTOU al verificar la longitud del pool y encolar el nuevo skb asignado, pero esto no es un problema, dado que un SKB extra en el pool es inofensivo y eventualmente será utilizado.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2025-68169 changed 2026-05-11 | CVE Terms of Use |
| NVD | CVE-2025-68169 changed 2026-10-14 | Public domain |