]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
drm: Check locking in drm_for_each_fb
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 9 Jul 2015 21:44:30 +0000 (23:44 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 22 Jul 2015 14:25:46 +0000 (16:25 +0200)
Ever since framebuffers are reference counted we have a special lock
for the global fb list. Make sure users of that list do hold that
lock when using the new iterators.

Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
include/drm/drm_crtc.h

index 499562274353aa55e58e09a38469e1ec6c7133d0..10547be5684a4b0d65d33e1bc17b2d6e707dbe6a 100644 (file)
@@ -1606,6 +1606,10 @@ assert_drm_connector_list_read_locked(struct drm_mode_config *mode_config)
        list_for_each_entry(encoder, &(dev)->mode_config.encoder_list, head)
 
 #define drm_for_each_fb(fb, dev) \
-       list_for_each_entry(fb, &(dev)->mode_config.fb_list, head)
+       for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)),            \
+            fb = list_first_entry(&(dev)->mode_config.fb_list, \
+                                         struct drm_framebuffer, head);        \
+            &fb->head != (&(dev)->mode_config.fb_list);                        \
+            fb = list_next_entry(fb, head))
 
 #endif /* __DRM_CRTC_H__ */