drm: msm: fix list corruption problem
When multiple worker threads compete to update event_list, with current vblank_ctrl_worker mechanism, there is one risk which can casue list node is deleted for twice. This is because, due to the protected scope by the spin_lock, mutex can exit when one thread is transvering the list, but another queue thread may continue to add new event to the list. This brings conflict risk. This patch is to correct this. Change-Id: Ice31462d196c57ce18d7b998c1a1f0b7feeb08fc Signed-off-by: Xiaowen Wu <wxiaowen@codeaurora.org> Signed-off-by: Guchun Chen <guchunc@codeaurora.org>
This commit is contained in:
parent
9551e129dd
commit
d0db21101b
1 changed files with 5 additions and 5 deletions
|
@ -185,12 +185,16 @@ static void vblank_ctrl_worker(struct kthread_work *work)
|
|||
struct msm_kms *kms = priv->kms;
|
||||
struct vblank_event *vbl_ev, *tmp;
|
||||
unsigned long flags;
|
||||
LIST_HEAD(tmp_head);
|
||||
|
||||
spin_lock_irqsave(&vbl_ctrl->lock, flags);
|
||||
list_for_each_entry_safe(vbl_ev, tmp, &vbl_ctrl->event_list, node) {
|
||||
list_del(&vbl_ev->node);
|
||||
spin_unlock_irqrestore(&vbl_ctrl->lock, flags);
|
||||
list_add_tail(&vbl_ev->node, &tmp_head);
|
||||
}
|
||||
spin_unlock_irqrestore(&vbl_ctrl->lock, flags);
|
||||
|
||||
list_for_each_entry_safe(vbl_ev, tmp, &tmp_head, node) {
|
||||
if (vbl_ev->enable)
|
||||
kms->funcs->enable_vblank(kms,
|
||||
priv->crtcs[vbl_ev->crtc_id]);
|
||||
|
@ -199,11 +203,7 @@ static void vblank_ctrl_worker(struct kthread_work *work)
|
|||
priv->crtcs[vbl_ev->crtc_id]);
|
||||
|
||||
kfree(vbl_ev);
|
||||
|
||||
spin_lock_irqsave(&vbl_ctrl->lock, flags);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&vbl_ctrl->lock, flags);
|
||||
}
|
||||
|
||||
static int vblank_ctrl_queue_work(struct msm_drm_private *priv,
|
||||
|
|
Loading…
Add table
Reference in a new issue