6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ma Ke <make24@xxxxxxxxxxx> commit 113fd6372a5bb3689aba8ef5b8a265ed1529a78f upstream. In drm_client_modeset_probe(), the return value of drm_mode_duplicate() is assigned to modeset->mode, which will lead to a possible NULL pointer dereference on failure of drm_mode_duplicate(). Add a check to avoid npd. Cc: stable@xxxxxxxxxxxxxxx Fixes: cf13909aee05 ("drm/fb-helper: Move out modeset config code") Signed-off-by: Ma Ke <make24@xxxxxxxxxxx> Reviewed-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20240802044736.1570345-1-make24@xxxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_client_modeset.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -873,6 +873,11 @@ int drm_client_modeset_probe(struct drm_ kfree(modeset->mode); modeset->mode = drm_mode_duplicate(dev, mode); + if (!modeset->mode) { + ret = -ENOMEM; + break; + } + drm_connector_get(connector); modeset->connectors[modeset->num_connectors++] = connector; modeset->x = offset->x;