Commit efb4cd11 authored by Russell King's avatar Russell King

[ARM] Prevent state machine leakage in ARM APM emulation.

Don't allow threads which are acking a suspend request to leave
the APM ioctl call.  This prevents the state machine breaking.
parent e7f10a52
......@@ -202,7 +202,7 @@ static void apm_suspend(void)
}
up_read(&user_list_lock);
wake_up_interruptible(&apm_suspend_waitqueue);
wake_up(&apm_suspend_waitqueue);
}
static ssize_t apm_read(struct file *fp, char __user *buf, size_t count, loff_t *ppos)
......@@ -306,6 +306,14 @@ apm_ioctl(struct inode * inode, struct file *filp, u_int cmd, u_long arg)
flags = current->flags;
current->flags |= PF_NOFREEZE;
/*
* Note: do not allow a thread which is acking the suspend
* to escape until the resume is complete.
*/
if (as->suspend_state == SUSPEND_ACKED)
wait_event(apm_suspend_waitqueue,
as->suspend_state == SUSPEND_DONE);
else
wait_event_interruptible(apm_suspend_waitqueue,
as->suspend_state == SUSPEND_DONE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment