We could walk of a bad list otherwise when someone concurrently
unbinds stuff for fun.
I've suspected this as the root-cause behind seemingly inconsistent
state, but alas it's not.
Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
        struct drm_device *dev = node->minor->dev;
        unsigned long flags;
        struct intel_crtc *crtc;
+       int ret;
+
+       ret = mutex_lock_interruptible(&dev->struct_mutex);
+       if (ret)
+               return ret;
 
        for_each_intel_crtc(dev, crtc) {
                const char pipe = pipe_name(crtc->pipe);
                spin_unlock_irqrestore(&dev->event_lock, flags);
        }
 
+       mutex_unlock(&dev->struct_mutex);
+
        return 0;
 }