CVE-2026-139642

swim: Fix buffer overflow

Published Nov 30, 2026 CVSS 3.1 · 5.5 Medium EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

swim: Fix buffer overflow

The effect of this bug can be observed as swim_read_sector_data()
inexplicably returning -5, or an error flag indicating that a mark byte
was read from the data register, or other odd behviour.

When copying bytes from the chip FIFO to the read buffer, the driver
keeps count of the remaining buffer space using register %d4. A counter
in register %d2 serves as a timeout. The driver polls (%a2), the handshake
register, until flags indicate that byte(s) have arrived in the FIFO.

movel #sector_size-1, %d4
read_new_data:
movew #max_retry, %d2
read_data_loop:
moveb %a2@, %d5
andb #0xc0, %d5
dbne %d2, read_data_loop
beq data_exit
moveb %a5@, %a4@+
andb #0x40, %d5
dbne %d4, read_new_data
beq exit_loop

Note that the exit_loop branch depends upon a flag in the handshake
register and not on the remaining buffer space. Hence there may be no
branch to exit_loop after %d4 is decremented to -1 (i.e. full buffer).

moveb %a5@, %a4@+
dbra %d4, read_new_data
exit_loop:

Here is a second decrement of %d4 which can now reach -2. But the buffer
bounds check is a comparison with -1, which is now ineffective. Hence the
loop will continue copying until %d2 eventually reaches -1.

Fix this bug by terminating the loop as soon as %d4 or %d2 reach -1.
Reset the timeout whenever a byte is copied.

Analysis

AI-generated

Technical impact

The Linux kernel’s swim driver contains a buffer overflow that allows the driver to copy data beyond its allocated buffer while reading from the chip FIFO. The bug arises from a double decrement of register %d4 that can underflow before the bounds check, enabling continuous copying until the timeout counter reaches its lower bound. As a result the overflow can corrupt kernel memory, potentially leading to privilege escalation or remote code execution if an attacker can influence the data transfer. The flaw appears as unexpected errors such as a return value of –5 or other anomalous behavior during read operations.

Affected Systems

All Linux kernels that include the unpatched swim driver are potentially affected. The advisory references multiple kernel commits, including 29381bf1, indicating that any distribution running a kernel version containing that code is exposed. No specific kernel release numbers are listed, so any kernel that has not incorporated the fix remains vulnerable.

Risk and Exploitability

The CVSS score of 5.5 classifies the vulnerability as moderate severity, and there is no EPSS data or KEV listing. The attack vector is not explicitly stated; the overflow occurs during a hardware read operation, implying that local or possibly remote exploitation may be possible depending on device exposure and configuration. While no public exploit has been linked, kernel buffer overflows typically carry high impact, warranting timely remediation.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update the kernel to a version that includes the swim driver buffer overflow fix (e.g., commit 29381bf1 or a later release).
  • If a kernel upgrade is not possible, disable or remove the hardware device that utilizes the swim driver until the patch is applied.
  • Reboot the system or reload the kernel module after applying the patch or disabling the device so that the updated driver is active.
  • Optionally, if your distribution has not yet released an updated kernel, apply the specific kernel commit manually and verify the fix.

Generated by OpenCVE AI on December 1, 2026 at 17:12 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-119
CWE-120
Type Values Removed Values Added
Weaknesses CWE-787
References
Metrics threat_severity

None

cvssV3_1

{'score': 5.5, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Moderate

Type Values Removed Values Added
Weaknesses CWE-119
CWE-120
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: swim: Fix buffer overflow The effect of this bug can be observed as swim_read_sector_data() inexplicably returning -5, or an error flag indicating that a mark byte was read from the data register, or other odd behviour. When copying bytes from the chip FIFO to the read buffer, the driver keeps count of the remaining buffer space using register %d4. A counter in register %d2 serves as a timeout. The driver polls (%a2), the handshake register, until flags indicate that byte(s) have arrived in the FIFO. movel #sector_size-1, %d4 read_new_data: movew #max_retry, %d2 read_data_loop: moveb %a2@, %d5 andb #0xc0, %d5 dbne %d2, read_data_loop beq data_exit moveb %a5@, %a4@+ andb #0x40, %d5 dbne %d4, read_new_data beq exit_loop Note that the exit_loop branch depends upon a flag in the handshake register and not on the remaining buffer space. Hence there may be no branch to exit_loop after %d4 is decremented to -1 (i.e. full buffer). moveb %a5@, %a4@+ dbra %d4, read_new_data exit_loop: Here is a second decrement of %d4 which can now reach -2. But the buffer bounds check is a comparison with -1, which is now ineffective. Hence the loop will continue copying until %d2 eventually reaches -1. Fix this bug by terminating the loop as soon as %d4 or %d2 reach -1. Reset the timeout whenever a byte is copied.
Title swim: Fix buffer overflow
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:36 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM
Severity
Moderate
Public date
Nov 30, 2026, 1:36 PM