From f7df2f8c56600bbad0f002ed684e188717e1e5cb Mon Sep 17 00:00:00 2001 From: jsg Date: Thu, 15 Aug 2024 03:20:40 +0000 Subject: [PATCH] drm/client: fix null pointer dereference in drm_client_modeset_probe From Ma Ke d64fc94f7bb24fc2be0d6bd5df8df926da461a6d in linux-6.6.y/6.6.46 113fd6372a5bb3689aba8ef5b8a265ed1529a78f in mainline linux --- sys/dev/pci/drm/drm_client_modeset.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/pci/drm/drm_client_modeset.c b/sys/dev/pci/drm/drm_client_modeset.c index 21b9c6b5a48..5c5b0a96284 100644 --- a/sys/dev/pci/drm/drm_client_modeset.c +++ b/sys/dev/pci/drm/drm_client_modeset.c @@ -879,6 +879,11 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, 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; -- 2.20.1