From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2BFD817DFFB; Wed, 25 Sep 2024 11:45:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264740; cv=none; b=GVE9A7wn4JOd0Ro7fxy6qK9uUQtn3x/A+ealeWhzAH8Mhz+0iPDZ5L3KB5bCUwOOf9dYOGhecUiA3rS1OuNpcHlVfv8mp7IttYPzehJkEXXXAjNfYPwyETRWu5CilHkyV1i4+D0wqlzDjwzn4m+vIfcZWuY3rpefptkohIg7JcU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727264740; c=relaxed/simple; bh=C8g0ES+qoly0fvKbC7Efmkp2SJ1isAe+/xEgVxT1dZ8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dcZkhUFvyTNfnYGHhF6hD4aT5eV2QKINKtKTu9w6vmMSCP5V3xZ69scPaM9o0acTfTYsZsG5hONWj292nmrk/5l/OIlUP5oAY0EikPhgSRZ/ihz4IGaidNxaKxS50vogdo9BHUmOBmt5wxVGtadvQ1I5viH6FIfBurv5Wq0EuMw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O1nb0eur; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O1nb0eur" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20380C4CEC3; Wed, 25 Sep 2024 11:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727264739; bh=C8g0ES+qoly0fvKbC7Efmkp2SJ1isAe+/xEgVxT1dZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O1nb0eurJ19rU1tnpMs+nvwRYCVV61NzSrIaYgqWUNhd1nGCgIyimLL7G8WixZ9Tr 0w/j8KDaasqcOdDi8GGjaTjzz/aoT25g099/b4T2c8ttvmXy8Bv/KNapHdv6Lstow7 +QVLXUfZwmV2teKtPipfrh6J/RbBFiDGL/U12aYfILI2BhrR0KN7VBSorhDShdknyU FwVhL4opekOoKsVCXYe7+t0K/nQ+xJ+WswjA7MjQUnodGpiKnoqwG31hS9qNlZ3Kt/ ULtEyW1KL1bbbwF3A201vvt9E7stHeMzIBhXXfxHTNrX2VD6r0aCqptxOhFxh/HOqk z4DibJ4YhbfUg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Srinivasan Shanmugam , Tom Chung , Rodrigo Siqueira , Roman Li , Alex Hung , Aurabindo Pillai , Harry Wentland , Hamza Mahfooz , Alex Deucher , Sasha Levin , sunpeng.li@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, alvin.lee2@amd.com, wenjing.liu@amd.com, sungjoon.kim@amd.com, dillon.varone@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.11 143/244] drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream Date: Wed, 25 Sep 2024 07:26:04 -0400 Message-ID: <20240925113641.1297102-143-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240925113641.1297102-1-sashal@kernel.org> References: <20240925113641.1297102-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.11 Content-Transfer-Encoding: 8bit From: Srinivasan Shanmugam [ Upstream commit 66d71a72539e173a9b00ca0b1852cbaa5f5bf1ad ] This commit addresses a null pointer dereference issue in the `commit_planes_for_stream` function at line 4140. The issue could occur when `top_pipe_to_program` is null. The fix adds a check to ensure `top_pipe_to_program` is not null before accessing its stream_res. This prevents a null pointer dereference. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:4140 commit_planes_for_stream() error: we previously assumed 'top_pipe_to_program' could be null (see line 3906) Cc: Tom Chung Cc: Rodrigo Siqueira Cc: Roman Li Cc: Alex Hung Cc: Aurabindo Pillai Cc: Harry Wentland Cc: Hamza Mahfooz Signed-off-by: Srinivasan Shanmugam Reviewed-by: Tom Chung Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 85a2ef82afa53..9e7ba846e032b 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -4127,7 +4127,8 @@ static void commit_planes_for_stream(struct dc *dc, } if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { top_pipe_to_program->stream_res.tg->funcs->wait_for_state( top_pipe_to_program->stream_res.tg, CRTC_STATE_VACTIVE); -- 2.43.0