CVE-2024-36934: bna: ensure the copied buf is NUL terminated
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
bna: ensure the copied buf is NUL terminated
Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from userspace to that buffer. Later, we use sscanf on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using sscanf. Fix this issue by using memdup_user_nul instead of memdup_user.
The Linux kernel CVE team has assigned CVE-2024-36934 to this issue.
Affected and fixed versions
===========================
Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 4.19.314 with commit bd502ba81cd1 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 5.4.276 with commit 80578ec10335 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 5.10.217 with commit 6f0f19b79c08 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 5.15.159 with commit 0f560240b4cc Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 6.1.91 with commit 06cb37e2ba64 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 6.6.31 with commit e19478763154 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 6.8.10 with commit 1518b2b498a0 Issue introduced in 3.3 with commit 7afc5dbde091 and fixed in 6.9 with commit 8c34096c7fdf
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-2024-36934
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/net/ethernet/brocade/bna/bnad_debugfs.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/bd502ba81cd1d515deddad7dbc6b812b14b97147 https://git.kernel.org/stable/c/80578ec10335bc15ac35fd1703c22aab34e39fdd https://git.kernel.org/stable/c/6f0f19b79c085cc891c418b768f26f7004bd51a4 https://git.kernel.org/stable/c/0f560240b4cc25d3de527deb257cdf072c0102a9 https://git.kernel.org/stable/c/06cb37e2ba6441888f24566a997481d4197b4e32 https://git.kernel.org/stable/c/e19478763154674c084defc62ae0d64d79657f91 https://git.kernel.org/stable/c/1518b2b498a0109eb6b15755169d3b6607356b35 https://git.kernel.org/stable/c/8c34096c7fdf272fd4c0c37fe411cd2e3ed0ee9f