If a timeout occurs before we can queue a reply to a message, we might
queue it _after_ the sync caller already returned and dropped its ref.
Avoid this by using the 'waiting' flag to sync between sender and
receiver.
Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
mutex_unlock(&conn_dst->lock);
mutex_lock(&conn_src->lock);
+ reply_wait->waiting = false;
entry = reply_wait->queue_entry;
if (entry) {
if (ret == 0)
* The connection's queue will never get to see it.
*/
mutex_lock(&conn_dst->lock);
- if (kdbus_conn_active(conn_dst))
+ if (reply_wake->waiting && kdbus_conn_active(conn_dst))
ret = kdbus_queue_entry_alloc(conn_dst, kmsg,
&reply_wake->queue_entry);
else