Linux kernel use-after-free in VC4 V3D teardown
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ d5b1a78a772f1e31a94f8babfa964152ec5e9aa5 · < ade226dfd28cf2fd1dce143c556d1ee77d953696| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
drm/vc4: drain the hangcheck timer and works on V3D unbind
Nothing stops the hangcheck timer that submitted jobs arm, or the job_done_work that the render-done interrupt queues, at teardown: vc4_irq_disable() cancels only overflow_mem_work, and vc4_gem_destroy() runs from the drm-managed release, after vc4_v3d_unbind() has already uninstalled the V3D interrupt and cleared vc4->v3d. A timer still armed by then reads V3D registers through the NULL vc4->v3d pointer, and the late callbacks run on the vc4_dev embedding them after it has been freed.
Drain them in vc4_v3d_unbind(): shut the timer down and cancel reset_work before the interrupt is taken down, because its vc4_irq_reset() re-enables it, then flush job_done_work so that completions queued at teardown still release their jobs.
This issue was found by an in-house static analysis tool.
From the CVE record · Linux
During V3D teardown, an armed hangcheck timer can access a cleared V3D pointer, and late work callbacks can access a freed device object. This can cause a crash when teardown occurs with pending timer or work callbacks; the input does not establish an attacker-controlled path or specify authentication or user-interaction requirements.
Engineers running Linux kernels with the drm/vc4 V3D driver should check their kernel versions; affected versions are not specified.