[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2024052435-CVE-2021-47527-e6f5@gregkh>
Date: Fri, 24 May 2024 17:09:47 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-cve-announce@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: CVE-2021-47527: serial: core: fix transmit-buffer reset and memleak
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")).
The Linux kernel CVE team has assigned CVE-2021-47527 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 4.9.292 with commit 011f6c92b5bf
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 4.14.257 with commit e74d9663fd57
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 4.19.220 with commit 1179b168fa3f
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 5.4.164 with commit c5da8aa44105
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 5.10.84 with commit e1722acf4f0d
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 5.15.7 with commit 64e491c1634b
Issue introduced in 4.9 with commit 761ed4a94582 and fixed in 5.16 with commit 00de977f9e0a
Please see https://www.kernel.org for a full list of currently supported
kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to
older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2021-47527
will be updated if fixes are backported, please check that for the most
up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/tty/serial/serial_core.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest
stable kernel version for this, and many other bugfixes. Individual
changes are never tested alone, but rather are part of a larger kernel
release. Cherry-picking individual commits is not recommended or
supported by the Linux kernel community at all. If however, updating to
the latest release is impossible, the individual changes to resolve this
issue can be found at these commits:
https://git.kernel.org/stable/c/011f6c92b5bf6e1fbfdedc8b5232f64c1c493206
https://git.kernel.org/stable/c/e74d9663fd57640fc3394abb5c76fa95b9cc2f2e
https://git.kernel.org/stable/c/1179b168fa3f3a6aae3bd140000455a0e58457db
https://git.kernel.org/stable/c/c5da8aa441053958594f94254592bb41264bdfbf
https://git.kernel.org/stable/c/e1722acf4f0d4d67b60f57e08ce16f8b66cd4b8f
https://git.kernel.org/stable/c/64e491c1634b73d3bddc081d08620bdc92ab2c12
https://git.kernel.org/stable/c/00de977f9e0aa9760d9a79d1e41ff780f74e3424
Powered by blists - more mailing lists