From nobody Tue Feb 10 06:25:01 2026 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 215D630149F for ; Tue, 6 Jan 2026 06:19: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=1767680380; cv=none; b=ormJ7tnSQkmAo5l9zCEJ20bRZrT/x+K+S/Qthwy8OpjctS1rQR/bvHqm6IZFhMaQic76wZF9WiVzUpDpuNgCTrUHCZZm7l+6U8wtMPvN/dYLrmUmRW4odr84AMCshkIe/ByEvPhJKXXJS5myWHnZvHHKr2ahCiMTP9mxKz10jtg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767680380; c=relaxed/simple; bh=nQISPNsvpgTbK/pW/zGIRHoRnprV4VUvh5jRhi1PzeE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=QgthGmqhH8j6WUaaPhVUTsCiXBrE3M2Mwt9igSb27wXRKN4DzT5Wt5SXAOvte2LuoC8lhoUG0hREcK4XyfefEX2rnyPL7XuzD7pHSj0++Z4o9PIjMdFKwjSwianY5gzFKBoDVz0sS3PRD2DlZR0gdECuxjnveD8JpUBLikcjM1k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UHI7YIrE; 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="UHI7YIrE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E7D8C19423; Tue, 6 Jan 2026 06:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767680379; bh=nQISPNsvpgTbK/pW/zGIRHoRnprV4VUvh5jRhi1PzeE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=UHI7YIrE7+jzdpDVxinCiipfm2r+mu9jjGtt8T6FR3gdcUUXJyxv7G6gMlN6zWo1N iPPQSMGGrai3QG5d6w/9Q/RvOD8yiK/O+Sicr+kXsu2/pQiklXdQH0N5uK/25ER4zI R+kIJNP8u4lr+MwbXE62tr+c9nTZHWYT8HO6+F+ady6btX74eLCHh7gwuWvp3Z7/pj BW0gAxnvgCfQMnYyMasqh20iQiPIOJzxTW+VHi2866JtKHiN5nIYjbDSKnrpb0dCur k6+xrsg63elq4jA/3ueJsjNb24UcHPMKiaSpaE2T0YAHYStizdJag9VrjXcuQOVzoV 4zOeRGU9bcR3A== From: Nathan Chancellor Date: Mon, 05 Jan 2026 23:19:26 -0700 Subject: [PATCH 1/2] drm/panic: Ensure drm_panic_type is initialized to a valid value Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260105-drm_panic-handle-invalid-drm_panic_screen-v1-1-55228bd4b0f8@kernel.org> References: <20260105-drm_panic-handle-invalid-drm_panic_screen-v1-0-55228bd4b0f8@kernel.org> In-Reply-To: <20260105-drm_panic-handle-invalid-drm_panic_screen-v1-0-55228bd4b0f8@kernel.org> To: Jocelyn Falempe , Javier Martinez Canillas , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Tvrtko Ursulin Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Nathan Chancellor X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2063; i=nathan@kernel.org; h=from:subject:message-id; bh=nQISPNsvpgTbK/pW/zGIRHoRnprV4VUvh5jRhi1PzeE=; b=owGbwMvMwCUmm602sfCA1DTG02pJDJkxK8t7mix/Fu25qml49gzPJ9laGY9e10Ua9+xubc77/ i75UO2rjlIWBjEuBlkxRZbqx6rHDQ3nnGW8cWoSzBxWJpAhDFycAjARl+2MDJ9efFb7EZQdkVDA snbPuc9/X59+FyO1afmK740aXyRFVU4xMqx/yGEkOePB6snfQlcZrTILU5twOk5t0jvp74UfTIL m/2QFAA== X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 If a user has set an invalid CONFIG_DRM_PANIC_SCREEN value (such as "qr_code" without CONFIG_DRM_PANIC_SCREEN_QR_CODE=3Dy due to missing or incorrect Rust dependencies), there is a panic when accessing /sys/module/drm/parameters/panic_screen: [ 12.218375] BUG: unable to handle page fault for address: 0000000796dd= 8818 [ 12.219737] #PF: supervisor read access in kernel mode ... [ 12.227167] RIP: 0010:drm_panic_type_get+0x1b/0x30 If drm_panic_type_set() does not find a valid drm_panic_type enumeration in drm_panic_type_map based on the provided value, it does not change drm_panic_type from the default -1 value, which is not a valid index for accessing drm_panic_type_map in drm_panic_type_get(), resulting in the crash. Validate the value of CONFIG_DRM_PANIC_SCREEN at boot time via the return value of drm_panic_type_set() in drm_panic_init() and explicitly fall back to the default of "user" with a message to the user so that they can adjust their configuration or fix missing dependencies. [ 0.800697] Unsupported value for CONFIG_DRM_PANIC_SCREEN ('qr_code'),= falling back to 'user'... Fixes: e85e9ccf3f84 ("drm/panic: Report invalid or unsupported panic modes") Signed-off-by: Nathan Chancellor Reviewed-by: Jocelyn Falempe Reviewed-by: Tvrtko Ursulin --- drivers/gpu/drm/drm_panic.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_panic.c b/drivers/gpu/drm/drm_panic.c index eb7ef17b9c71..0cd574dd9d88 100644 --- a/drivers/gpu/drm/drm_panic.c +++ b/drivers/gpu/drm/drm_panic.c @@ -1072,8 +1072,11 @@ void drm_panic_unregister(struct drm_device *dev) */ void __init drm_panic_init(void) { - if (drm_panic_type =3D=3D -1) - drm_panic_type_set(CONFIG_DRM_PANIC_SCREEN, NULL); + if (drm_panic_type =3D=3D -1 && drm_panic_type_set(CONFIG_DRM_PANIC_SCREE= N, NULL)) { + pr_warn("Unsupported value for CONFIG_DRM_PANIC_SCREEN ('%s'), falling b= ack to 'user'...\n", + CONFIG_DRM_PANIC_SCREEN); + drm_panic_type =3D DRM_PANIC_TYPE_USER; + } drm_panic_qr_init(); } =20 --=20 2.52.0