diff --git a/U_Fix-segfault-on-dock-suspend-unplug-resume.patch b/U_Fix-segfault-on-dock-suspend-unplug-resume.patch new file mode 100644 index 0000000..fd36e56 --- /dev/null +++ b/U_Fix-segfault-on-dock-suspend-unplug-resume.patch @@ -0,0 +1,44 @@ +From 2897e1769c5d14a74bccbacb483667933807ead8 Mon Sep 17 00:00:00 2001 +From: Chris Bainbridge +Date: Tue, 4 Jul 2023 22:34:27 +0100 +Subject: [PATCH] Fix segfault on dock suspend, unplug, resume + +`drmmode_set_mode` can segfault if a USB-C dock with external monitors +is disconnected during suspend. It appears that some data structures are +not updated, but the associated `drmModeConnectorPtr` associated with +those structures is NULL. Dereferencing that pointer results in Xorg +crashing. + +Backtrace: + + (crtc=crtc@entry=0x55a0c7610390, fb=fb@entry=0x55a0c86d7410, mode=mode@entry=0x55a0c76103a8, x=x@entry=0, y=y@entry=0) at drmmode_display.c:1267 + (crtc=0x55a0c7610390, mode=0x55a0c76103a8, rotation=, x=, y=) at drmmode_display.c:1371 + (main=main@entry=0x55a0c63f4b40, argc=argc@entry=10, argv=argv@entry=0x7fffb7cefbf8) + at ../sysdeps/nptl/libc_start_call_main.h:58 + (main=0x55a0c63f4b40, argc=10, argv=0x7fffb7cefbf8, init=, fini=, rtld_fini=, stack_end=0x7fffb7cefbe8) at ../csu/libc-start.c:381 + +Fix this by checking the pointer before dereferencing it. + +Fixes: https://gitlab.freedesktop.org/drm/amd/-/issues/2375 +Signed-off-by: Chris Bainbridge +--- + src/drmmode_display.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 5b73fce..32e7f21 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -1264,6 +1264,9 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode, + if (output->crtc != crtc) + continue; + ++ if (!drmmode_output->mode_output) ++ return FALSE; ++ + output_ids[output_count] = drmmode_output->mode_output->connector_id; + output_count++; + } +-- +2.43.0 + diff --git a/U_Free-output_ids.patch b/U_Free-output_ids.patch new file mode 100644 index 0000000..6739e13 --- /dev/null +++ b/U_Free-output_ids.patch @@ -0,0 +1,37 @@ +From ae22d12d420efbd8847f9b64b37e7a4cadde2600 Mon Sep 17 00:00:00 2001 +From: Chris Bainbridge +Date: Wed, 12 Jul 2023 21:15:35 +0100 +Subject: [PATCH] Free output_ids + +--- + src/drmmode_display.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/src/drmmode_display.c b/src/drmmode_display.c +index 32e7f21..00247ac 100644 +--- a/src/drmmode_display.c ++++ b/src/drmmode_display.c +@@ -1264,8 +1264,10 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode, + if (output->crtc != crtc) + continue; + +- if (!drmmode_output->mode_output) +- return FALSE; ++ if (!drmmode_output->mode_output) { ++ ret = FALSE; ++ goto out; ++ } + + output_ids[output_count] = drmmode_output->mode_output->connector_id; + output_count++; +@@ -1285,6 +1287,7 @@ drmmode_set_mode(xf86CrtcPtr crtc, struct drmmode_fb *fb, DisplayModePtr mode, + "failed to set mode: %s\n", strerror(errno)); + } + ++out: + free(output_ids); + return ret; + } +-- +2.43.0 + diff --git a/xf86-video-amdgpu.changes b/xf86-video-amdgpu.changes index 4f6c668..fd2fc82 100644 --- a/xf86-video-amdgpu.changes +++ b/xf86-video-amdgpu.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Fri Nov 15 15:49:37 UTC 2024 - Björn Bidar + +- U_Fix-segfault-on-dock-suspend-unplug-resume.patch, + U_Free-output_ids.patch + * Fix random segfaults when for example suspending. + glfo#xorg/driver/xf86-video-amdgpu#70 glfo#drm/amd#2375 + ------------------------------------------------------------------- Mon Feb 26 12:10:30 UTC 2024 - Dominique Leuenberger diff --git a/xf86-video-amdgpu.spec b/xf86-video-amdgpu.spec index 6108db0..4778c9e 100644 --- a/xf86-video-amdgpu.spec +++ b/xf86-video-amdgpu.spec @@ -1,7 +1,7 @@ # # spec file for package xf86-video-amdgpu # -# Copyright (c) 2023 SUSE LLC +# Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,7 +31,11 @@ Source: https://xorg.freedesktop.org/releases/individual/driver/%{name}- Source1: https://xorg.freedesktop.org/releases/individual/driver/%{name}-%{version}.tar.xz.sig Source2: %{name}.keyring Source3: amdgpu.ids +# PATCH-FIX-OPENSUSE Workaround to fix crashes when an external monitor is connected bsc#1169222 Patch1: N_amdgpu-present-Check-tiling-for-newer-versions-too.patch +# PATCH-FIX-UPSTREAM Fix segfaults when e.g. suspending glfo/xorg/driver/xf86-video-amdgpu#70 +Patch2: U_Fix-segfault-on-dock-suspend-unplug-resume.patch +Patch3: U_Free-output_ids.patch BuildRequires: autoconf >= 2.6.0 BuildRequires: automake BuildRequires: libtool