From: jsg Date: Thu, 18 Apr 2024 00:58:03 +0000 (+0000) Subject: drm/client: Fully protect modes[] with dev->mode_config.mutex X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=4be9ff632d6dde0b14d6802e106de6827dfb159b;p=openbsd drm/client: Fully protect modes[] with dev->mode_config.mutex From Ville Syrjala 04e018bd913d3d3336ab7d21c2ad31a9175fe984 in linux-6.6.y/6.6.28 3eadd887dbac1df8f25f701e5d404d1b90fd0fea in mainline linux --- diff --git a/sys/dev/pci/drm/drm_client_modeset.c b/sys/dev/pci/drm/drm_client_modeset.c index 8d160dfad9d..21b9c6b5a48 100644 --- a/sys/dev/pci/drm/drm_client_modeset.c +++ b/sys/dev/pci/drm/drm_client_modeset.c @@ -777,6 +777,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, unsigned int total_modes_count = 0; struct drm_client_offset *offsets; unsigned int connector_count = 0; + /* points to modes protected by mode_config.mutex */ struct drm_display_mode **modes; struct drm_crtc **crtcs; int i, ret = 0; @@ -855,7 +856,6 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, drm_client_pick_crtcs(client, connectors, connector_count, crtcs, modes, 0, width, height); } - mutex_unlock(&dev->mode_config.mutex); drm_client_modeset_release(client); @@ -885,6 +885,7 @@ int drm_client_modeset_probe(struct drm_client_dev *client, unsigned int width, modeset->y = offset->y; } } + mutex_unlock(&dev->mode_config.mutex); mutex_unlock(&client->modeset_mutex); out: