]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/panic: Report invalid or unsupported panic modes
authorTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Thu, 27 Nov 2025 09:03:49 +0000 (09:03 +0000)
committerTvrtko Ursulin <tursulin@ursulin.net>
Fri, 28 Nov 2025 15:20:34 +0000 (15:20 +0000)
commite85e9ccf3f8404007f62dff9a02273fcdeb44206
treee7add1e133568ef9bd441d97002a4c42642b4b70
parent36c5dff41fd958c9e32d931eb90b5ae638a7e600
drm/panic: Report invalid or unsupported panic modes

Currently the user can write anything into the drm.panic_screen modparam,
either at runtime via sysfs, or as a kernel boot time argument. Invalid
strings will be silently accepted and ignored at use time by defaulting to
the 'user' panic mode.

Let instead add some validation in order to have immediate feedback when
something has been mistyped, or not compiled in.

For example during kernel boot:

 Booting kernel: `bsod' invalid for parameter `drm.panic_screen'

Or at runtime:

 # echo -n bsod > /sys/module/drm/parameters/panic_screen
 -bash: echo: write error: Invalid argument

Change of behavior is that when invalid mode is attempted to be
configured, currently the code will default to the 'user' mode, while with
this change the code will ignore it, and default to the mode set at kernel
build time via CONFIG_DRM_PANIC_SCREEN.

While at it lets also fix the module parameter description to include all
compiled in modes.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Jocelyn Falempe <jfalempe@redhat.com>
Cc: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Jocelyn Falempe <jfalempe@redhat.com>
Signed-off-by: Tvrtko Ursulin <tursulin@ursulin.net>
Link: https://lore.kernel.org/r/20251127090349.92717-1-tvrtko.ursulin@igalia.com
drivers/gpu/drm/drm_panic.c