Re: [PATCH 3/6] drm/atomic: Don't overrun the connector array when hotplugging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 19, 2014 at 06:38:08PM +0100, Daniel Vetter wrote:
[...]
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
[...]
> @@ -304,6 +306,21 @@ drm_atomic_get_connector_state(struct drm_atomic_state *state,
>  
>  	index = drm_connector_index(connector);
>  
> +	/*
> +	 * Construction of atomic state updates can race with a connector
> +	 * hot-add which might overflow. In this case flip the table and just
> +	 * restart the entire ioctl - no one is fast enough to livelock a cpu
> +	 * with physical hotplug events anyway.
> +	 *
> +	 * Note that we only grab the indexes once we have the right lock to
> +	 * prevent hotplug/unplugging of connectors. So removal is no problem,
> +	 * at most the array is a bit too large.
> +	 */
> +	if (index >= state->num_connector) {
> +		DRM_DEBUG_KMS("Hot-added connector would overflow state array, restarting\n");
> +		return -EAGAIN;

This function returns a pointer, so this needs to be ERR_PTR(-EAGAIN).

Thierry

Attachment: pgpTIMCKzIFGP.pgp
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux