AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] drm/amdgpu/dm: Fix NULL pointer crash during DP MST hotplug
@ 2021-04-15 17:55 Shashank Sharma
  2021-04-15 17:58 ` Harry Wentland
  0 siblings, 1 reply; 2+ messages in thread
From: Shashank Sharma @ 2021-04-15 17:55 UTC (permalink / raw)
  To: amd-gfx; +Cc: alexander.deucher, Harry Wentland, Shashank Sharma

This patch checks the return value of the function
dc_link_add_remote_sink before using it. This was causing
a crash during consecutive hotplugs of DP MST displays.

Cc: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
index eee19edeeee5..8dc5005bec0a 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
@@ -226,6 +226,11 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
 			(aconnector->edid->extensions + 1) * EDID_LENGTH,
 			&init_params);
 
+		if (!dc_sink) {
+			DRM_ERROR("Unable to add a remote sink\n");
+			return 0;
+		}
+
 		dc_sink->priv = aconnector;
 		/* dc_link_add_remote_sink returns a new reference */
 		aconnector->dc_sink = dc_sink;
-- 
2.25.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amdgpu/dm: Fix NULL pointer crash during DP MST hotplug
  2021-04-15 17:55 [PATCH] drm/amdgpu/dm: Fix NULL pointer crash during DP MST hotplug Shashank Sharma
@ 2021-04-15 17:58 ` Harry Wentland
  0 siblings, 0 replies; 2+ messages in thread
From: Harry Wentland @ 2021-04-15 17:58 UTC (permalink / raw)
  To: Shashank Sharma, amd-gfx; +Cc: alexander.deucher

On 2021-04-15 1:55 p.m., Shashank Sharma wrote:
> This patch checks the return value of the function
> dc_link_add_remote_sink before using it. This was causing
> a crash during consecutive hotplugs of DP MST displays.
> 
> Cc: Harry Wentland <harry.wentland@amd.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>

Reviewed-by: Harry Wentland <harry.wentland@amd.com>

Harry

> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> index eee19edeeee5..8dc5005bec0a 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
> @@ -226,6 +226,11 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
>   			(aconnector->edid->extensions + 1) * EDID_LENGTH,
>   			&init_params);
>   
> +		if (!dc_sink) {
> +			DRM_ERROR("Unable to add a remote sink\n");
> +			return 0;
> +		}
> +
>   		dc_sink->priv = aconnector;
>   		/* dc_link_add_remote_sink returns a new reference */
>   		aconnector->dc_sink = dc_sink;
> 

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 17:55 [PATCH] drm/amdgpu/dm: Fix NULL pointer crash during DP MST hotplug Shashank Sharma
2021-04-15 17:58 ` Harry Wentland

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git