|
@@ -1991,8 +1991,14 @@ static void binder_send_failed_reply(struct binder_transaction *t,
|
|
&target_thread->reply_error.work);
|
|
&target_thread->reply_error.work);
|
|
wake_up_interruptible(&target_thread->wait);
|
|
wake_up_interruptible(&target_thread->wait);
|
|
} else {
|
|
} else {
|
|
- WARN(1, "Unexpected reply error: %u\n",
|
|
|
|
- target_thread->reply_error.cmd);
|
|
|
|
|
|
+ /*
|
|
|
|
+ * Cannot get here for normal operation, but
|
|
|
|
+ * we can if multiple synchronous transactions
|
|
|
|
+ * are sent without blocking for responses.
|
|
|
|
+ * Just ignore the 2nd error in this case.
|
|
|
|
+ */
|
|
|
|
+ pr_warn("Unexpected reply error: %u\n",
|
|
|
|
+ target_thread->reply_error.cmd);
|
|
}
|
|
}
|
|
binder_inner_proc_unlock(target_thread->proc);
|
|
binder_inner_proc_unlock(target_thread->proc);
|
|
binder_thread_dec_tmpref(target_thread);
|
|
binder_thread_dec_tmpref(target_thread);
|
|
@@ -2193,7 +2199,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
|
int debug_id = buffer->debug_id;
|
|
int debug_id = buffer->debug_id;
|
|
|
|
|
|
binder_debug(BINDER_DEBUG_TRANSACTION,
|
|
binder_debug(BINDER_DEBUG_TRANSACTION,
|
|
- "%d buffer release %d, size %zd-%zd, failed at %p\n",
|
|
|
|
|
|
+ "%d buffer release %d, size %zd-%zd, failed at %pK\n",
|
|
proc->pid, buffer->debug_id,
|
|
proc->pid, buffer->debug_id,
|
|
buffer->data_size, buffer->offsets_size, failed_at);
|
|
buffer->data_size, buffer->offsets_size, failed_at);
|
|
|
|
|
|
@@ -3705,7 +3711,7 @@ static int binder_thread_write(struct binder_proc *proc,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
binder_debug(BINDER_DEBUG_DEAD_BINDER,
|
|
binder_debug(BINDER_DEBUG_DEAD_BINDER,
|
|
- "%d:%d BC_DEAD_BINDER_DONE %016llx found %p\n",
|
|
|
|
|
|
+ "%d:%d BC_DEAD_BINDER_DONE %016llx found %pK\n",
|
|
proc->pid, thread->pid, (u64)cookie,
|
|
proc->pid, thread->pid, (u64)cookie,
|
|
death);
|
|
death);
|
|
if (death == NULL) {
|
|
if (death == NULL) {
|
|
@@ -4376,6 +4382,15 @@ static int binder_thread_release(struct binder_proc *proc,
|
|
|
|
|
|
binder_inner_proc_unlock(thread->proc);
|
|
binder_inner_proc_unlock(thread->proc);
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ * This is needed to avoid races between wake_up_poll() above and
|
|
|
|
+ * and ep_remove_waitqueue() called for other reasons (eg the epoll file
|
|
|
|
+ * descriptor being closed); ep_remove_waitqueue() holds an RCU read
|
|
|
|
+ * lock, so we can be sure it's done after calling synchronize_rcu().
|
|
|
|
+ */
|
|
|
|
+ if (thread->looper & BINDER_LOOPER_STATE_POLL)
|
|
|
|
+ synchronize_rcu();
|
|
|
|
+
|
|
if (send_reply)
|
|
if (send_reply)
|
|
binder_send_failed_reply(send_reply, BR_DEAD_REPLY);
|
|
binder_send_failed_reply(send_reply, BR_DEAD_REPLY);
|
|
binder_release_work(proc, &thread->todo);
|
|
binder_release_work(proc, &thread->todo);
|
|
@@ -4391,6 +4406,8 @@ static __poll_t binder_poll(struct file *filp,
|
|
bool wait_for_proc_work;
|
|
bool wait_for_proc_work;
|
|
|
|
|
|
thread = binder_get_thread(proc);
|
|
thread = binder_get_thread(proc);
|
|
|
|
+ if (!thread)
|
|
|
|
+ return POLLERR;
|
|
|
|
|
|
binder_inner_proc_lock(thread->proc);
|
|
binder_inner_proc_lock(thread->proc);
|
|
thread->looper |= BINDER_LOOPER_STATE_POLL;
|
|
thread->looper |= BINDER_LOOPER_STATE_POLL;
|
|
@@ -5034,7 +5051,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
|
|
spin_lock(&t->lock);
|
|
spin_lock(&t->lock);
|
|
to_proc = t->to_proc;
|
|
to_proc = t->to_proc;
|
|
seq_printf(m,
|
|
seq_printf(m,
|
|
- "%s %d: %p from %d:%d to %d:%d code %x flags %x pri %ld r%d",
|
|
|
|
|
|
+ "%s %d: %pK from %d:%d to %d:%d code %x flags %x pri %ld r%d",
|
|
prefix, t->debug_id, t,
|
|
prefix, t->debug_id, t,
|
|
t->from ? t->from->proc->pid : 0,
|
|
t->from ? t->from->proc->pid : 0,
|
|
t->from ? t->from->pid : 0,
|
|
t->from ? t->from->pid : 0,
|
|
@@ -5058,7 +5075,7 @@ static void print_binder_transaction_ilocked(struct seq_file *m,
|
|
}
|
|
}
|
|
if (buffer->target_node)
|
|
if (buffer->target_node)
|
|
seq_printf(m, " node %d", buffer->target_node->debug_id);
|
|
seq_printf(m, " node %d", buffer->target_node->debug_id);
|
|
- seq_printf(m, " size %zd:%zd data %p\n",
|
|
|
|
|
|
+ seq_printf(m, " size %zd:%zd data %pK\n",
|
|
buffer->data_size, buffer->offsets_size,
|
|
buffer->data_size, buffer->offsets_size,
|
|
buffer->data);
|
|
buffer->data);
|
|
}
|
|
}
|