kdbus: don't unlink synchronous replies 79/264879/2
authorAdrian Szyndela <adrian.s@samsung.com>
Thu, 30 Sep 2021 06:44:57 +0000 (15:44 +0900)
committerAdrian Szyndela <adrian.s@samsung.com>
Fri, 8 Oct 2021 07:19:41 +0000 (09:19 +0200)
When a signal breaks a synchronous call, and a reply is received
before restart is executed, then the reply is unlinked and the restarted
call can't pick it up anymore.

But keeping only interrupted synchronous calls linked is not enough.
If a reply comes just after the signal, before marking the reply structure
as interrupted, then the reply is - again - unlinked and the restarted call
can't pick it up anymore.

This commit leaves all synchronous replies linked.

This way:
- asynchronous calls work as before the changes - replies are unlinked
  by the replier in kdbus_conn_reply();
- replies for synchronous calls are unlinked by the caller in
  kdbus_conn_wait_reply().

Change-Id: I0e3d8f53cf24a0aa8c59244e0768eebeb3fee110
Signed-off-by: Adrian Szyndela <adrian.s@samsung.com>
ipc/kdbus/connection.c

index 02deba3..a40be5f 100644 (file)
@@ -1135,7 +1135,8 @@ static int kdbus_conn_reply(struct kdbus_conn *src,
        if (reply) {
                if (reply->sync)
                        wake = kdbus_reply_ref(reply);
-               kdbus_reply_unlink(reply);
+               else
+                       kdbus_reply_unlink(reply);
        }
        mutex_unlock(&dst->lock);