CVE-2026-139027: media: vivid: round the height down to the vertical subsampling factor

Published Nov 30, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

media: vivid: round the height down to the vertical subsampling factor

syzbot reports a vmalloc out-of-bounds write in the test pattern generator:

BUG: KASAN: vmalloc-out-of-bounds in tpgfillplanepattern drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2617 [inline] BUG: KASAN: vmalloc-out-of-bounds in tpgfillplanebuffer+0x2063/0x4160 drivers/media/common/v4l2-tpg/v4l2-tpg-core.c:2705 Write of size 720 at addr ffffc900038f9d50 by task vivid-000-vid-c/6017

The reproducer requests a 720x49 NV12 capture format, i.e. an odd height for a format whose chroma plane is vertically subsampled.

The buffer size is derived from the height by a truncating division:

sizes[p] = (tpgglinewidth(&dev->tpg, p) h) / dev->fmtcap->vdownsampling[p] + dev->fmtcap->dataoffset[p];

For a single buffer holding both planes tpgglinewidth() returns 720 + 720 / 2 = 1080, so 1080 49 = 52920 bytes get allocated.

tpgfillplanebuffer() however emits one chroma line for every two luma lines, i.e. DIVROUNDUP(49, 2) = 25 lines, and thus needs 49 720 + 25 720 = 53280 bytes. The memcpy() of the last chroma line runs 360 bytes past the end of the buffer.

An odd height is not meaningful for a 4:2:0 format in the first place, since the chroma plane would have to hold half a line. Rather than fixing up each of the ~10 sites that divide the height by vdownsampling[], round the height down to a multiple of the vertical subsampling factor where it enters the driver. Adjusting the format is what TRYFMT/SFMT are for, and it keeps every later division exact.

Formats without vertical subsampling are unaffected and keep accepting odd heights.

Tested with the syzbot reproducer, which no longer triggers the splat, and by streaming NV12, NV21, YUV420, YVU420 and YUYV at heights 47, 48, 49, 51, 480, 481 and 1081. v4l2-compliance gives identical results before and after (48 of 50 succeeded on the vivid device in both cases; the two failures are pre-existing and unrelated).

Affected Software

1 affected component
Linux Linux kernel

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Configuration

    Round the capture height down to a multiple of the format’s vertical subsampling factor; for 4:2:0 formats, use an even height.

    Linux kernel vivid V4L2 capture format height = a multiple of the vertical subsampling factor

Event History

Nov 30, 2026
CVE Published
via MITRE·01:27 PM
Data Sourced
via MITRE·01:27 PM
Description
Data Sourced
via NVD·02:18 PM
Description

Frequently Asked Questions

1

Which setups are exposed to the out-of-bounds write?

The issue is in the Vivid virtual media driver's test pattern generator when a capture format has vertically subsampled chroma and an odd requested height. The reported reproducer uses a 720x49 NV12 capture format.

2

What is required to trigger the bug?

A requester must select an odd capture height for a format with vertical chroma subsampling. The allocation calculation truncates the chroma-plane height, while buffer filling rounds it up and writes an additional chroma line.

3

What can be done if the fix cannot be applied immediately?

Avoid odd capture heights for vertically subsampled formats, including the reported NV12 case. Using an even height prevents the allocation and fill calculations from disagreeing on the number of chroma lines.

4

How can I identify a likely occurrence?

A sanitizer-enabled kernel may report a KASAN vmalloc out-of-bounds write in tpg_fill_plane_pattern or tpg_fill_plane_buffer. The reported case performs a final chroma-line memcpy beyond the allocated buffer.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203