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 8B86F189B8F; Thu, 1 Aug 2024 00:29:05 +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=1722472145; cv=none; b=qoovwbVs4aE6EXkBHDGpEZl3RH7FyVwI+pjD6y4rccjyO2YZja/wc385rJsSUynKX4Iqb7lQXtRbtl9VHc9VgJQzjpmIa+3B8W8YPvHqh+oKViLragz7XHMdPvI3u3JE3rrogG/61X7n1j3UTzIV21yuEykxNdWWc2/A7WbvSQ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722472145; c=relaxed/simple; bh=xPqf615xEatr5jKlkYY1blrVeMrjZRnOk5TNcqL8P2o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Af25o4xkZO4tZSV9Az25MuxIgMT3WxFAaTupVS6O6/g0cvbLOIvSCnE3Iz2j0jfHorXNYHMfBxQ06w8Nirn/E98FDVqFa2KtD4cZQN6eUAcSWboa6gxWBhurqf1sHZeXhpi6+gCsAISrHd5+PLAo5I2B/ACo13xeN0Vhj4bhQcw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=m4oa+gSW; 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="m4oa+gSW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D503FC116B1; Thu, 1 Aug 2024 00:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722472145; bh=xPqf615xEatr5jKlkYY1blrVeMrjZRnOk5TNcqL8P2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m4oa+gSW6j+KqKDCHuPHjdzbXB/5JMwq3Uor/pfqUglv3jI/HvuLHJb+u3xYNH2L3 CjNVSC1fSUNX24zWOcvQ6fHK+I+fiPDk6cBE4GLwFGoeVlnHDOzBNGS1lIsq6/fVu1 K6Zx/C0aHn0rwq6G7gvKPTmBrzVT6USGCyK2uawD2AqfZMkyAXi463HyYKdGpWXBML pNrhxBolE7Asqae3OYPYUf29C1eEsIwUz/82Pc4Qb2Yvjn9AZ02hBAR4PZr+BXFtco BF2ORZIFWTKY3M+l5lxVRT3F9vM2Tae9amk1ldst00LuSjFaRm08RyN07ewsL3RZ5g jm8QAtvJdd9+w== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Alex Hung , Harry Wentland , Tom Chung , Daniel Wheeler , Alex Deucher , Sasha Levin , sunpeng.li@amd.com, Rodrigo.Siqueira@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, hamza.mahfooz@amd.com, roman.li@amd.com, mario.limonciello@amd.com, Wayne.Lin@amd.com, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH AUTOSEL 6.1 13/61] drm/amd/display: Spinlock before reading event Date: Wed, 31 Jul 2024 20:25:31 -0400 Message-ID: <20240801002803.3935985-13-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240801002803.3935985-1-sashal@kernel.org> References: <20240801002803.3935985-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@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.1.102 Content-Transfer-Encoding: 8bit From: Alex Hung [ Upstream commit ae13c8a5cff92015b9a3eb7cee65ebc75859487f ] [WHY & HOW] A read of acrtc_attach->base.state->event was not locked so moving it inside the spinlock. This fixes a LOCK_EVASION issue reported by Coverity. Reviewed-by: Harry Wentland Acked-by: Tom Chung Signed-off-by: Alex Hung Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 160811ac1fb97..2c6caddf1de34 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -8052,15 +8052,13 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, bundle->stream_update.vrr_infopacket = &acrtc_state->stream->vrr_infopacket; } - } else if (cursor_update && acrtc_state->active_planes > 0 && - acrtc_attach->base.state->event) { - drm_crtc_vblank_get(pcrtc); - + } else if (cursor_update && acrtc_state->active_planes > 0) { spin_lock_irqsave(&pcrtc->dev->event_lock, flags); - - acrtc_attach->event = acrtc_attach->base.state->event; - acrtc_attach->base.state->event = NULL; - + if (acrtc_attach->base.state->event) { + drm_crtc_vblank_get(pcrtc); + acrtc_attach->event = acrtc_attach->base.state->event; + acrtc_attach->base.state->event = NULL; + } spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); } -- 2.43.0