Skip to content
Commit f283d227 authored by NeilBrown's avatar NeilBrown Committed by Jiri Kosina
Browse files

APM: fix deadlock in APM_IOC_SUSPEND ioctl



I found the Xorg server on my ARM device stuck in the 'msleep()' loop
in apm_ioctl.

I suspect it had attempted suspend immediately after resuming and lost
a race.
During that msleep(10);, a new suspend cycle must have started and
changed ->suspend_state to SUSPEND_PENDING, so it was never seen to
be SUSPEND_DONE and the loop could never exited.  It would have moved on
to SUSPEND_ACKTO but never been able to reach SUSPEND_DONE.

So change the loop to only run while SUSPEND_ACKED rather than until
SUSPEND_DONE.  This is much safer.

Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent b4a133da
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