The blocking wait in the "read" half of the ioctl could wake up on
signal delivery, and the default ERESTARTSYS handling would cause the
whole syscall to restart resulting in a doubled write.
Issue: AXIA-1880
Change-Id: Id49e4a088d08feca63bff43d28be6530820d9c3d
Signed-off-by: Andy Ross <andy.ross@windriver.com>
proc->ready_threads--;
thread->looper &= ~BINDER_LOOPER_STATE_WAITING;
+ /* We cannot return -ERESTARTSYS here. This code is called
+ * after binder_thread_write() has already interpreted the
+ * input buffer. A restart will result in a doubled set of
+ * commands. Just return success, having consumed zero
+ * bytes. */
if (ret)
- return ret;
+ return ret == -ERESTARTSYS ? 0 : ret;
while (1) {
uint32_t cmd;