]> Pileus Git - ~andy/linux/commitdiff
drm: delete unconsumed pending event list in drm_events_release
authorYoungJun Cho <yj44.cho@samsung.com>
Tue, 29 Oct 2013 11:30:26 +0000 (20:30 +0900)
committerDave Airlie <airlied@redhat.com>
Wed, 6 Nov 2013 03:21:54 +0000 (13:21 +1000)
When there are unconsumed pending events, the events are
destroyed by calling destroy callback, but the events list
are remained, because there is no list_del().

It is possible that the page flip request is handled after
drm_events_release() is called and before drm_fb_release().
In this case a drm_pending_event is remained not freed.
So exynos driver checks again to remove it in its post
close routine. But the file_priv->event_list contains
undeleted ones, this can make oops for accessing invalid
memory.

Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_fops.c

index d0e27667a4eb7200700b500804c574c7a9b40d1e..ee2d330a2fa0740b645debf9a14eeb7180fcbbd7 100644 (file)
@@ -378,8 +378,10 @@ static void drm_events_release(struct drm_file *file_priv)
                }
 
        /* Remove unconsumed events */
-       list_for_each_entry_safe(e, et, &file_priv->event_list, link)
+       list_for_each_entry_safe(e, et, &file_priv->event_list, link) {
+               list_del(&e->link);
                e->destroy(e);
+       }
 
        spin_unlock_irqrestore(&dev->event_lock, flags);
 }