{"id":"CVE-2026-139642","state":"PUBLISHED","title":"swim: Fix buffer overflow","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nswim: Fix buffer overflow\n\nThe effect of this bug can be observed as swim_read_sector_data()\ninexplicably returning -5, or an error flag indicating that a mark byte\nwas read from the data register, or other odd behviour.\n\nWhen copying bytes from the chip FIFO to the read buffer, the driver\nkeeps count of the remaining buffer space using register %d4. A counter\nin register %d2 serves as a timeout. The driver polls (%a2), the handshake\nregister, until flags indicate that byte(s) have arrived in the FIFO.\n\n        movel   #sector_size-1, %d4\nread_new_data:\n        movew   #max_retry, %d2\nread_data_loop:\n        moveb   %a2@, %d5\n        andb    #0xc0, %d5\n        dbne    %d2, read_data_loop\n        beq     data_exit\n        moveb   %a5@, %a4@+\n        andb    #0x40, %d5\n        dbne    %d4, read_new_data\n        beq     exit_loop\n\nNote that the exit_loop branch depends upon a flag in the handshake\nregister and not on the remaining buffer space. Hence there may be no\nbranch to exit_loop after %d4 is decremented to -1 (i.e. full buffer).\n\n        moveb   %a5@, %a4@+\n        dbra    %d4, read_new_data\nexit_loop:\n\nHere is a second decrement of %d4 which can now reach -2. But the buffer\nbounds check is a comparison with -1, which is now ineffective. Hence the\nloop will continue copying until %d2 eventually reaches -1.\n\nFix this bug by terminating the loop as soon as %d4 or %d2 reach -1.\nReset the timeout whenever a byte is copied.","publishedAt":"2026-11-30T13:36:38.542Z","updatedAt":"2026-11-30T13:36:38.542Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"f7c4e7e402fc2b4b74679119a8ad42ea28b3cdff","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"ec567485ac9f46d2cfaa0c444a3ddd03be8836e5","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"382147d4bf4fc371ae1c9beb892dfd6aacabc6b4","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"504285224519be0f39e01da9fbabfc8d69b60871","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"29381bf1af7faf118cbb90b2a00e7fef7992417d","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"b2f91fb5087c49828ea61da2f95263a1ff14872c","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"759e236477c30e75653dc050f18ab3d1c5127c9c","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"a54870a4ae4962acf341eb6ca010cae02af1a6ea","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/block/swim_asm.S"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.30","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.30","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/block/swim_asm.S"]}],"references":["https://git.kernel.org/stable/c/f7c4e7e402fc2b4b74679119a8ad42ea28b3cdff","https://git.kernel.org/stable/c/ec567485ac9f46d2cfaa0c444a3ddd03be8836e5","https://git.kernel.org/stable/c/382147d4bf4fc371ae1c9beb892dfd6aacabc6b4","https://git.kernel.org/stable/c/504285224519be0f39e01da9fbabfc8d69b60871","https://git.kernel.org/stable/c/29381bf1af7faf118cbb90b2a00e7fef7992417d","https://git.kernel.org/stable/c/b2f91fb5087c49828ea61da2f95263a1ff14872c","https://git.kernel.org/stable/c/759e236477c30e75653dc050f18ab3d1c5127c9c","https://git.kernel.org/stable/c/a54870a4ae4962acf341eb6ca010cae02af1a6ea"],"weaknesses":[],"ingestedAt":"2026-11-30T13:54:04.526Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139642.json","commit":"8c2c22940a0de21d18737df980299c0488d5dc73","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139642","state":"PUBLISHED","datePublished":"2026-11-30T13:36:38.542Z","dateUpdated":"2026-11-30T13:36:38.542Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.945Z"},"containers":{"cna":{"title":"swim: Fix buffer overflow","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nswim: Fix buffer overflow\n\nThe effect of this bug can be observed as swim_read_sector_data()\ninexplicably returning -5, or an error flag indicating that a mark byte\nwas read from the data register, or other odd behviour.\n\nWhen copying bytes from the chip FIFO to the read buffer, the driver\nkeeps count of the remaining buffer space using register %d4. A counter\nin register %d2 serves as a timeout. The driver polls (%a2), the handshake\nregister, until flags indicate that byte(s) have arrived in the FIFO.\n\n        movel   #sector_size-1, %d4\nread_new_data:\n        movew   #max_retry, %d2\nread_data_loop:\n        moveb   %a2@, %d5\n        andb    #0xc0, %d5\n        dbne    %d2, read_data_loop\n        beq     data_exit\n        moveb   %a5@, %a4@+\n        andb    #0x40, %d5\n        dbne    %d4, read_new_data\n        beq     exit_loop\n\nNote that the exit_loop branch depends upon a flag in the handshake\nregister and not on the remaining buffer space. Hence there may be no\nbranch to exit_loop after %d4 is decremented to -1 (i.e. full buffer).\n\n        moveb   %a5@, %a4@+\n        dbra    %d4, read_new_data\nexit_loop:\n\nHere is a second decrement of %d4 which can now reach -2. But the buffer\nbounds check is a comparison with -1, which is now ineffective. Hence the\nloop will continue copying until %d2 eventually reaches -1.\n\nFix this bug by terminating the loop as soon as %d4 or %d2 reach -1.\nReset the timeout whenever a byte is copied."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"f7c4e7e402fc2b4b74679119a8ad42ea28b3cdff","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"ec567485ac9f46d2cfaa0c444a3ddd03be8836e5","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"382147d4bf4fc371ae1c9beb892dfd6aacabc6b4","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"504285224519be0f39e01da9fbabfc8d69b60871","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"29381bf1af7faf118cbb90b2a00e7fef7992417d","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"b2f91fb5087c49828ea61da2f95263a1ff14872c","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"759e236477c30e75653dc050f18ab3d1c5127c9c","versionType":"git"},{"version":"8852ecd97488249ca7fe2c0d3eb44cae95886881","status":"affected","lessThan":"a54870a4ae4962acf341eb6ca010cae02af1a6ea","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/block/swim_asm.S"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"2.6.30","status":"affected"},{"version":"0","status":"unaffected","lessThan":"2.6.30","versionType":"semver"},{"version":"5.10.275","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.226","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.193","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.163","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.12.119","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.65","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.6","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc1","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/block/swim_asm.S"]}],"references":[{"url":"https://git.kernel.org/stable/c/f7c4e7e402fc2b4b74679119a8ad42ea28b3cdff"},{"url":"https://git.kernel.org/stable/c/ec567485ac9f46d2cfaa0c444a3ddd03be8836e5"},{"url":"https://git.kernel.org/stable/c/382147d4bf4fc371ae1c9beb892dfd6aacabc6b4"},{"url":"https://git.kernel.org/stable/c/504285224519be0f39e01da9fbabfc8d69b60871"},{"url":"https://git.kernel.org/stable/c/29381bf1af7faf118cbb90b2a00e7fef7992417d"},{"url":"https://git.kernel.org/stable/c/b2f91fb5087c49828ea61da2f95263a1ff14872c"},{"url":"https://git.kernel.org/stable/c/759e236477c30e75653dc050f18ab3d1c5127c9c"},{"url":"https://git.kernel.org/stable/c/a54870a4ae4962acf341eb6ca010cae02af1a6ea"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:36:38.542Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.12.119"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"6.18.65"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"7.3.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"2.6.30","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}