vc_screen: fix null-ptr-deref in vcs_notifier() during concurrent vcs_write
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 8fb9ea65c9d1338b0d2bb0a9122dc942cdd32357 · < 7cc3dd79777f6ae4625ec37e84dd18a26dc88bde| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
vc_screen: fix null-ptr-deref in vcs_notifier() during concurrent vcs_write
A KASAN null-ptr-deref was observed in vcs_notifier():
BUG: KASAN: null-ptr-deref in vcs_notifier+0x98/0x130 Read of size 2 at addr qmp_cmd_name: qmp_capabilities, arguments: {}
The issue is a race condition in vcs_write(). When the console_lock is temporarily dropped (to copy data from userspace), the vc_data pointer obtained from vcs_vc() may become stale. After re-acquiring the lock, vcs_vc() is called again to re-validate the pointer. If the vc has been deallocated in the meantime, vcs_vc() returns NULL, and the while loop breaks (with written > 0). However, after the loop, vcs_scr_updated(vc) is still called with the now-NULL vc pointer, leading to a null pointer dereference in the notifier chain (vcs_notifier dereferences param->vc).
Fix this by adding a NULL check for vc before calling vcs_scr_updated().
From the CVE record · Linux
A race in the Linux kernel's vcs_write() can leave a console pointer NULL after it is re-validated. A local writer can trigger a null pointer dereference if the console is deallocated during the write; the input does not specify authentication requirements.
Teams running the Linux kernel should check their deployments; affected versions are not specified.