From mboxrd@z Thu Jan 1 00:00:00 1970 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 7AEF846AF1B; Tue, 16 Jun 2026 18:25:26 +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=1781634327; cv=none; b=KMIbJVeuguu6PifxF8qX+LHvZJwLlu2d2E2zr7upOqyK/hUj4h13kc/7Abz9u8jdR+vE+9r45iMonipOLGpRx5HBy40IcAnkO17aT6iNy8cxTI7WXabKdN4LMXJZeKeOuAQwTReKVy1meEMc9VJCL21Rvet4dAiJXWCt9Bd+V+M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781634327; c=relaxed/simple; bh=NEiKEsCyHODI/hZlNNS3enqffv5gJbv1jHnz3jrwsY8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hC+6oCJNy/rw+kbaelbiZzVJEH6APOkfnUH38dJsgl94sp9BlTTa3NE7fYqZwfowZV8drpQiySKSe6voWQO1kKu8TmlRkladRnN75drOvnDQu9ENX3rw1tL+E1/kdg2YhIg3dZOjapDU/pWWIYoYyeBZbcUYQAIHIzYhlvoyPRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HhE/hU7f; 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="HhE/hU7f" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C5F21F000E9; Tue, 16 Jun 2026 18:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781634326; bh=p8kN++zfbuAtfryGUbM1SSPH9PXAZH0ZZO8OWQhHgGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HhE/hU7fnbxmmEROPEEBzhs/Ny7/iOXuJVorV9Bufnr2P7HZv5ASDbvf4wwvV/E0C k/awYayoDtQywmFhb36Hj3pkxuK+gFT1BTJ8FT1qA2FhD7EOEy/NQ00We3j2w0qHLs e4gVuFbkUidZzAWg5kymT5QS5qE9BDNGzJyWVY0o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Alex Hung , Harry Wentland , Ray Wu , Daniel Wheeler , Alex Deucher Subject: [PATCH 5.15 244/411] drm/amd/display: Fix NULL deref and buffer over-read in SDP debugfs Date: Tue, 16 Jun 2026 20:28:02 +0530 Message-ID: <20260616145113.903425910@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145100.376842714@linuxfoundation.org> References: <20260616145100.376842714@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Harry Wentland commit adf67034b1f61f7119295208085bfd43f85f56af upstream. [Why & How] dp_sdp_message_debugfs_write() dereferences connector->base.state->crtc without checking for NULL. A connector can be connected but not bound to any CRTC (e.g. after hot-plug before the next atomic commit), causing a kernel crash when writing to the sdp_message debugfs node. The function also ignores the user-provided size argument and always passes 36 bytes to copy_from_user(), reading past the user buffer when size < 36. Fix both issues by: - Returning -ENODEV when connector->base.state or state->crtc is NULL - Clamping write_size to min(size, sizeof(data)) Fixes: c7ba3653e977 ("drm/amd/display: Generic SDP message access in amdgpu") Assisted-by: Copilot:claude-opus-4.6 Reviewed-by: Alex Hung Signed-off-by: Harry Wentland Signed-off-by: Ray Wu Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher (cherry picked from commit 6ab4c36a522842ff70474a1c0af2e40e50fc8300) Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c @@ -1016,8 +1016,13 @@ static ssize_t dp_sdp_message_debugfs_wr if (size == 0) return 0; + if (!connector->base.state || !connector->base.state->crtc) + return -ENODEV; + acrtc_state = to_dm_crtc_state(connector->base.state->crtc->state); + write_size = min_t(size_t, size, sizeof(data)); + r = copy_from_user(data, buf, write_size); write_size -= r;