{"id":"CVE-2026-139027","state":"PUBLISHED","title":"media: vivid: round the height down to the vertical subsampling factor","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: vivid: round the height down to the vertical subsampling factor\n\nsyzbot reports a vmalloc out-of-bounds write in the test pattern\ngenerator:\n\nBUG: KASAN: vmalloc-out-of-bounds in tpg_fill_plane_pattern drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2617 [inline]\nBUG: KASAN: vmalloc-out-of-bounds in tpg_fill_plane_buffer+0x2063/0x4160 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2705\nWrite of size 720 at addr ffffc900038f9d50 by task vivid-000-vid-c/6017\n\nThe reproducer requests a 720x49 NV12 capture format, i.e. an odd\nheight for a format whose chroma plane is vertically subsampled.\n\nThe buffer size is derived from the height by a truncating division:\n\n\tsizes[p] = (tpg_g_line_width(&dev->tpg, p) * h) /\n\t\t   dev->fmt_cap->vdownsampling[p] +\n\t\t   dev->fmt_cap->data_offset[p];\n\nFor a single buffer holding both planes tpg_g_line_width() returns\n720 + 720 / 2 = 1080, so 1080 * 49 = 52920 bytes get allocated.\n\ntpg_fill_plane_buffer() however emits one chroma line for every two\nluma lines, i.e. DIV_ROUND_UP(49, 2) = 25 lines, and thus needs\n49 * 720 + 25 * 720 = 53280 bytes. The memcpy() of the last chroma\nline runs 360 bytes past the end of the buffer.\n\nAn odd height is not meaningful for a 4:2:0 format in the first place,\nsince the chroma plane would have to hold half a line. Rather than\nfixing up each of the ~10 sites that divide the height by\nvdownsampling[], round the height down to a multiple of the vertical\nsubsampling factor where it enters the driver. Adjusting the format is\nwhat TRY_FMT/S_FMT are for, and it keeps every later division exact.\n\nFormats without vertical subsampling are unaffected and keep accepting\nodd heights.\n\nTested with the syzbot reproducer, which no longer triggers the splat,\nand by streaming NV12, NV21, YUV420, YVU420 and YUYV at heights 47,\n48, 49, 51, 480, 481 and 1081. v4l2-compliance gives identical results\nbefore and after (48 of 50 succeeded on the vivid device in both\ncases; the two failures are pre-existing and unrelated).","publishedAt":"2026-11-30T13:27:11.602Z","updatedAt":"2026-11-30T13:27:11.602Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"f8614b4e7dd89b69b63405e47aa84aeae5a656b4","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"f3b8f2f68afb6b16ce254266b246bbb8a1aaf1f8","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"6c55e02d9b3f4bdcd4e951c8d7cf3ae8131e3e43","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"66ad567e88397a04429d8f768f49cb8e52fd1dd0","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"883ba9671d826fe7e6a5d2cd6789eb42f46f9ec5","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"00dd4a5c2b8c7391367c047ad79158043116723c","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"e9115c139cad53919457a179d81964430dfdae32","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"a2ec28dd2a88d0721fc4a30242861e2be01d4023","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/test-drivers/vivid/vivid-vid-cap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.1","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.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.4","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/media/test-drivers/vivid/vivid-vid-cap.c"]}],"references":["https://git.kernel.org/stable/c/f8614b4e7dd89b69b63405e47aa84aeae5a656b4","https://git.kernel.org/stable/c/f3b8f2f68afb6b16ce254266b246bbb8a1aaf1f8","https://git.kernel.org/stable/c/6c55e02d9b3f4bdcd4e951c8d7cf3ae8131e3e43","https://git.kernel.org/stable/c/66ad567e88397a04429d8f768f49cb8e52fd1dd0","https://git.kernel.org/stable/c/883ba9671d826fe7e6a5d2cd6789eb42f46f9ec5","https://git.kernel.org/stable/c/00dd4a5c2b8c7391367c047ad79158043116723c","https://git.kernel.org/stable/c/e9115c139cad53919457a179d81964430dfdae32","https://git.kernel.org/stable/c/a2ec28dd2a88d0721fc4a30242861e2be01d4023"],"weaknesses":[],"ingestedAt":"2026-11-30T13:40:04.421Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/139xxx/CVE-2026-139027.json","commit":"5317bbbde1916a58cb1fadabb726eb126daf44c1","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-139027","state":"PUBLISHED","datePublished":"2026-11-30T13:27:11.602Z","dateUpdated":"2026-11-30T13:27:11.602Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-11-30T13:22:15.909Z"},"containers":{"cna":{"title":"media: vivid: round the height down to the vertical subsampling factor","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: vivid: round the height down to the vertical subsampling factor\n\nsyzbot reports a vmalloc out-of-bounds write in the test pattern\ngenerator:\n\nBUG: KASAN: vmalloc-out-of-bounds in tpg_fill_plane_pattern drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2617 [inline]\nBUG: KASAN: vmalloc-out-of-bounds in tpg_fill_plane_buffer+0x2063/0x4160 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2705\nWrite of size 720 at addr ffffc900038f9d50 by task vivid-000-vid-c/6017\n\nThe reproducer requests a 720x49 NV12 capture format, i.e. an odd\nheight for a format whose chroma plane is vertically subsampled.\n\nThe buffer size is derived from the height by a truncating division:\n\n\tsizes[p] = (tpg_g_line_width(&dev->tpg, p) * h) /\n\t\t   dev->fmt_cap->vdownsampling[p] +\n\t\t   dev->fmt_cap->data_offset[p];\n\nFor a single buffer holding both planes tpg_g_line_width() returns\n720 + 720 / 2 = 1080, so 1080 * 49 = 52920 bytes get allocated.\n\ntpg_fill_plane_buffer() however emits one chroma line for every two\nluma lines, i.e. DIV_ROUND_UP(49, 2) = 25 lines, and thus needs\n49 * 720 + 25 * 720 = 53280 bytes. The memcpy() of the last chroma\nline runs 360 bytes past the end of the buffer.\n\nAn odd height is not meaningful for a 4:2:0 format in the first place,\nsince the chroma plane would have to hold half a line. Rather than\nfixing up each of the ~10 sites that divide the height by\nvdownsampling[], round the height down to a multiple of the vertical\nsubsampling factor where it enters the driver. Adjusting the format is\nwhat TRY_FMT/S_FMT are for, and it keeps every later division exact.\n\nFormats without vertical subsampling are unaffected and keep accepting\nodd heights.\n\nTested with the syzbot reproducer, which no longer triggers the splat,\nand by streaming NV12, NV21, YUV420, YVU420 and YUYV at heights 47,\n48, 49, 51, 480, 481 and 1081. v4l2-compliance gives identical results\nbefore and after (48 of 50 succeeded on the vivid device in both\ncases; the two failures are pre-existing and unrelated)."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"f8614b4e7dd89b69b63405e47aa84aeae5a656b4","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"f3b8f2f68afb6b16ce254266b246bbb8a1aaf1f8","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"6c55e02d9b3f4bdcd4e951c8d7cf3ae8131e3e43","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"66ad567e88397a04429d8f768f49cb8e52fd1dd0","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"883ba9671d826fe7e6a5d2cd6789eb42f46f9ec5","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"00dd4a5c2b8c7391367c047ad79158043116723c","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"e9115c139cad53919457a179d81964430dfdae32","versionType":"git"},{"version":"ddcaee9dd4c00174db8ddf913c87ddf3773c446e","status":"affected","lessThan":"a2ec28dd2a88d0721fc4a30242861e2be01d4023","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/media/test-drivers/vivid/vivid-vid-cap.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.1","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.1","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.117","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.18.63","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.4","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/media/test-drivers/vivid/vivid-vid-cap.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/f8614b4e7dd89b69b63405e47aa84aeae5a656b4"},{"url":"https://git.kernel.org/stable/c/f3b8f2f68afb6b16ce254266b246bbb8a1aaf1f8"},{"url":"https://git.kernel.org/stable/c/6c55e02d9b3f4bdcd4e951c8d7cf3ae8131e3e43"},{"url":"https://git.kernel.org/stable/c/66ad567e88397a04429d8f768f49cb8e52fd1dd0"},{"url":"https://git.kernel.org/stable/c/883ba9671d826fe7e6a5d2cd6789eb42f46f9ec5"},{"url":"https://git.kernel.org/stable/c/00dd4a5c2b8c7391367c047ad79158043116723c"},{"url":"https://git.kernel.org/stable/c/e9115c139cad53919457a179d81964430dfdae32"},{"url":"https://git.kernel.org/stable/c/a2ec28dd2a88d0721fc4a30242861e2be01d4023"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-11-30T13:27:11.602Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"5.10.275"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"5.15.226"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.1.193"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.6.163"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.12.117"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"6.18.63"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"7.3.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.1","versionEndExcluding":"7.4-rc1"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}