CVE-2021-47527
serial: core: fix transmit-buffer reset and memleak
Check your servers for CVE-2021-47527
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2021-47527 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
serial: core: fix transmit-buffer reset and memleak
Commit 761ed4a94582 ("tty: serial_core: convert uart_close to use tty_port_close") converted serial core to use tty_port_close() but failed to notice that the transmit buffer still needs to be freed on final close.
Not freeing the transmit buffer means that the buffer is no longer cleared on next open so that any ioctl() waiting for the buffer to drain might wait indefinitely (e.g. on termios changes) or that stale data can end up being transmitted in case tx is restarted.
Furthermore, the buffer of any port that has been opened would leak on driver unbind.
Note that the port lock is held when clearing the buffer pointer due to the ldisc race worked around by commit a5ba1d95e46e ("uart: fix race between uart_put_char() and uart_shutdown()").
Also note that the tty-port shutdown() callback is not called for console ports so it is not strictly necessary to free the buffer page after releasing the lock (cf. d72402145ace ("tty/serial: do not free trasnmit buffer page under port lock")).
Exploitation
EPSS 0.25%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 17.9% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 10 Jun 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before 011f6c92b5bf6e1fbfdedc8b5232f64c1c493206 affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before e74d9663fd57640fc3394abb5c76fa95b9cc2f2e affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before 1179b168fa3f3a6aae3bd140000455a0e58457db affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before c5da8aa441053958594f94254592bb41264bdfbf affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before e1722acf4f0d4d67b60f57e08ce16f8b66cd4b8f affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before 64e491c1634b73d3bddc081d08620bdc92ab2c12 affected from 761ed4a94582ab291aa24dcbea4e01e8936488c8, before 00de977f9e0aa9760d9a79d1e41ff780f74e3424
Other versions: unaffected
|
| Linux |
affected 4.9 unaffected before 4.9 unaffected from 4.9.292 up to and including 4.9.* unaffected from 4.14.257 up to and including 4.14.* unaffected from 4.19.220 up to and including 4.19.* unaffected from 5.4.164 up to and including 5.4.* unaffected from 5.10.84 up to and including 5.10.* unaffected from 5.15.7 up to and including 5.15.* unaffected 5.16 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2021-47527 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2021-47527
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2021-47527
trivy image --scanners vuln IMAGE | grep CVE-2021-47527
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/011f6c92b5bf6e1fbfdedc8b5232f64c1c493206 git.kernel.org
- https://git.kernel.org/stable/c/e74d9663fd57640fc3394abb5c76fa95b9cc2f2e git.kernel.org
- https://git.kernel.org/stable/c/1179b168fa3f3a6aae3bd140000455a0e58457db git.kernel.org
- https://git.kernel.org/stable/c/c5da8aa441053958594f94254592bb41264bdfbf git.kernel.org
- https://git.kernel.org/stable/c/e1722acf4f0d4d67b60f57e08ce16f8b66cd4b8f git.kernel.org
- https://git.kernel.org/stable/c/64e491c1634b73d3bddc081d08620bdc92ab2c12 git.kernel.org
- https://git.kernel.org/stable/c/00de977f9e0aa9760d9a79d1e41ff780f74e3424 git.kernel.org
Source: the record CVE-2021-47527 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse