Skip to content

Commit c601fd5

Browse files
Jonathan-Cavittvsyrjala
authored andcommitted
drm/client: Do not destroy NULL modes
'modes' in drm_client_modeset_probe may fail to kcalloc. If this occurs, we jump to 'out', calling modes_destroy on it, which dereferences it. This may result in a NULL pointer dereference in the error case. Prevent that. Fixes: 3039cc0 ("drm/client: Make copies of modes") Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patch.msgid.link/20260224221227.69126-2-jonathan.cavitt@intel.com
1 parent 74b6e83 commit c601fd5

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpu/drm/drm_client_modeset.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,8 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width,
930930
mutex_unlock(&client->modeset_mutex);
931931
out:
932932
kfree(crtcs);
933-
modes_destroy(dev, modes, connector_count);
933+
if (modes)
934+
modes_destroy(dev, modes, connector_count);
934935
kfree(modes);
935936
kfree(offsets);
936937
kfree(enabled);

0 commit comments

Comments
 (0)