Re: [PATCH v8 5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI

[email protected]
Newsgroups dev.linux.lists.linux-sunxi,org.freedesktop.lists.dri-devel
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing `mutex_unlock()` in `scdc_status_show()` error path leads to a permanent deadlock.
--

--- Patch [5]: [PATCH v8 5/5] drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI ---
commit a1a858eb6a63d66446abae1340fa115153801dc6
Author: Nicolas Frattaroli <[email protected]>

drm/display: hdmi-state-helper: Init SCDC debugfs for HDMI

This commit initialises the SCDC debugfs file for connectors that call the
HDMI state helper's debugfs_init helper, making the scdc_status file
available in their connector debugfs.

> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index 8d5ee10ceb874..709524b40c26f 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
[ ... ]
> @@ -1116,6 +1117,7 @@ void drm_hdmi_connector_debugfs_init(struct drm_connector *connector,
>  		return;
>  
>  	create_hdmi_infoframe_files(connector, dir);
> +	drm_scdc_debugfs_init(connector, root);

[Severity: High]
Does exposing this debugfs file introduce a deadlock if it is read while the
display is disconnected?

Looking at the file operations wired up here, if a user reads the scdc_status
file when the connector is disconnected:

drivers/gpu/drm/display/drm_scdc_helper.c:scdc_status_show() {
	...
	mutex_lock(&connector->dev->mode_config.mutex);
	...
	if (connector->status != connector_status_connected) {
		ret = -ENODEV;
		goto err_conn_put;
	}
	...
err_unlock:
	mutex_unlock(&connector->dev->mode_config.mutex);
err_conn_put:
	drm_connector_put(connector);
	...
}

It appears the error path jumps to err_conn_put, bypassing the mutex_unlock() 
at err_unlock. Could this permanently lock mode_config.mutex and cause 
subsequent DRM mode setting operations to hang?

>  }
>  EXPORT_SYMBOL(drm_hdmi_connector_debugfs_init);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.