dmaengine: Fix device kref underflow in dma_chan_put()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 8ad342a863590b24ce77681b7e081363fb3333f7 · < 1a0d9b406febf23054ad595fd47b29325e70fb2d| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
dmaengine: Fix device kref underflow in dma_chan_put()
dma_chan_get() takes chan->device->ref only on the slow path:
/* no kref on fast path */ if (chan->client_count) { __module_get(owner); chan->client_count++; return 0; } if (!try_module_get(owner)) return -ENODEV; if (!dma_device_get(chan->device)) { // calls kref_get_unless_zero()
dma_chan_put() drops the ref unconditionally, so every fast-path get/put pair drops one extra device reference.
The bug fires when two conditions hold together: a non-private provider has a persistent client holding chan->client_count > 0 and another client cycles dmaengine_get()/dmaengine_put(). When the kref hits zero, the subsequent dma_find_channel() returns NULL even though the provider module is still loaded.
Fix this by dropping device->ref only on the last put, matching the single slow-path get.
From the CVE record · Linux
The Linux kernel’s dmaengine code can underflow a device reference when dma_chan_put() releases a reference that a fast-path dma_chan_get() did not acquire. If a non-private provider has a persistent client and another client repeatedly calls dmaengine_get() and dmaengine_put(), subsequent dma_find_channel() calls can return NULL even while the provider module remains loaded. The input does not specify an attacker access path, authentication requirements, or user interaction.
Engineers running Linux kernels with dmaengine providers should check their kernel versions against the vendor advisory; affected versions are not specified.