Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 516743FFAA1 for ; Wed, 29 Jul 2026 10:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785321297; cv=none; b=eWigxpLYw77dc3AdVVyfzsKI5XhnF5rdPxxsDladFYfODrWDwMo0INcJM0BNxQDJ84Nq0CYhoouKOszc9I8nCVLn3DplmeZeIbdgh6JOB0a2h6HlSHlttfwyq9Qi5Blt5/Vf8cpxBBQ2dGtz1s93E0+phzEIV4xYzgG3FLj4LH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785321297; c=relaxed/simple; bh=AhvLFs6bIY4Bls6fjrveDdOac6ZCR8Tmx5Myp45kaTw=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=tp9zwegETGRUzbb9PnL/20hcXzyvZYQdzXJIzIBZPmVKH2JYp8mVx47Qh2B9lTcKFB592Y732H8tkbIyLLMCRFUnMxI2/9dive+a7T9Keztmhd0qo6yVNoYT1QEuJ3j4SApEZrzll0oRz1b7JInVxAK/Yhe98Do7m29CttgqZc0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=B5N8Q7ur; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="B5N8Q7ur" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE9B1F000E9; Wed, 29 Jul 2026 10:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785321296; bh=JMSPTjqRySqzNNk8/bLEQocZT97UM/gckW88MzjxYh8=; h=Subject:To:Cc:From:Date; b=B5N8Q7ur2G/jqiXNMdarW+ShYe4f4BGN0eTbY4DGUwut2Huss9o6elEh1Y132X7hW L8kSwEwYIxMWfJP3QIyKMFVn75s6HUWYPEu82WUpCsva5KKrrIe9SuD/4gktoE60cQ bvVB4FJjpV+1kjnebgxFtPapoaR8LKdeah7+PjV8= Subject: FAILED: patch "[PATCH] drm/dp/mst: fix buffer overflows in sideband chunk" failed to apply to 5.15-stable tree To: ashutoshdesai993@gmail.com,lyude@redhat.com,stable@vger.kernel.org Cc: From: Date: Wed, 29 Jul 2026 12:34:34 +0200 Message-ID: <2026072934-rotten-illicitly-c4e2@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 55bd5e685bda455b9b50c835f8c8442d52a344a3 # git commit -s git send-email --to '' --in-reply-to '2026072934-rotten-illicitly-c4e2@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ From 55bd5e685bda455b9b50c835f8c8442d52a344a3 Mon Sep 17 00:00:00 2001 From: Ashutosh Desai Date: Fri, 10 Apr 2026 04:19:01 +0000 Subject: [PATCH] drm/dp/mst: fix buffer overflows in sideband chunk accumulation drm_dp_sideband_append_payload() has three related bugs when processing device-provided sideband reply data: 1. Zero-length curchunk_len underflow: msg_len is a 6-bit field taken directly from the DP sideband header. If a device sends msg_len=0, curchunk_len is set to zero. The condition (curchunk_idx >= curchunk_len) is immediately true, and curchunk_len-1 wraps to 255 (u8 underflow). drm_dp_msg_data_crc4() reads 255 bytes from chunk[48], then memcpy() writes 255 bytes into msg[], both far out of bounds. 2. chunk[48] overflow: curchunk_len can reach 63 (6-bit field). chunk[] is only 48 bytes. Multi-iteration payload assembly appends 16-byte blocks until curchunk_idx reaches curchunk_len, writing up to 15 bytes past the end of chunk[] into msg[]. 3. msg[256] overflow: each chunk contributes (curchunk_len-1) bytes to msg[]. No check ensures curlen + (curchunk_len-1) stays within msg[256], so the memcpy can spill into adjacent struct fields. All three are reachable from any DP MST device that can forge sideband reply messages on a physical connection. Fixes: ad7f8a1f9ced ("drm/helper: add Displayport multi-stream helper (v0.6)") Cc: # v3.17+ Signed-off-by: Ashutosh Desai Reviewed-by: Lyude Paul Signed-off-by: Lyude Paul Link: https://patch.msgid.link/20260410041901.2438960-1-ashutoshdesai993@gmail.com diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 35dc4f24ae53..fe72245fb9ca 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -789,6 +789,12 @@ static bool drm_dp_sideband_append_payload(struct drm_dp_sideband_msg_rx *msg, { u8 crc4; + /* curchunk_len must be >= 1 (min 1 CRC byte) and fit in chunk[] */ + if (!msg->curchunk_len || + msg->curchunk_len > ARRAY_SIZE(msg->chunk) || + msg->curchunk_idx + replybuflen > ARRAY_SIZE(msg->chunk)) + return false; + memcpy(&msg->chunk[msg->curchunk_idx], replybuf, replybuflen); msg->curchunk_idx += replybuflen; @@ -799,6 +805,9 @@ static bool drm_dp_sideband_append_payload(struct drm_dp_sideband_msg_rx *msg, print_hex_dump(KERN_DEBUG, "wrong crc", DUMP_PREFIX_NONE, 16, 1, msg->chunk, msg->curchunk_len, false); + /* Guard against accumulated msg[] overflow */ + if (msg->curlen + msg->curchunk_len - 1 > ARRAY_SIZE(msg->msg)) + return false; /* copy chunk into bigger msg */ memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1); msg->curlen += msg->curchunk_len - 1;