Re: [PATCH] drm: make sure drm_vblank_init() has been called before touching vbl_lock

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

 



On Mon, 2011-07-04 at 13:16 +1000, skeggsb@xxxxxxxxx wrote:
> From: Ben Skeggs <bskeggs@xxxxxxxxxx>
> 
> Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_irq.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 2022a5c..c3c87a1 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -397,13 +397,16 @@ int drm_irq_uninstall(struct drm_device *dev)
>  	/*
>  	 * Wake up any waiters so they don't hang.
>  	 */
> -	spin_lock_irqsave(&dev->vbl_lock, irqflags);
> -	for (i = 0; i < dev->num_crtcs; i++) {
> -		DRM_WAKEUP(&dev->vbl_queue[i]);
> -		dev->vblank_enabled[i] = 0;
> -		dev->last_vblank[i] = dev->driver->get_vblank_counter(dev, i);
> +	if (dev->num_crtcs) {
> +		spin_lock_irqsave(&dev->vbl_lock, irqflags);
> +		for (i = 0; i < dev->num_crtcs; i++) {
> +			DRM_WAKEUP(&dev->vbl_queue[i]);
> +			dev->vblank_enabled[i] = 0;
> +			dev->last_vblank[i] =
> +				dev->driver->get_vblank_counter(dev, i);
> +		}
> +		spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
>  	}
> -	spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
>  
>  	if (!irq_enabled)
>  		return -EINVAL;

Makes sense, but according to commit
7a1c2f6c8d8485af5ac6c2a313f6a7162207a4af ('vmwgfx: Enable use of the
vblank system'), the vblank ioctls will also access uninitialized data
if drm_vblank_init() hasn't been called. So, is this just for cases
where drm_irq_uninstall() is called before the driver gets a chance to
call drm_vblank_init()? 


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer
_______________________________________________
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