connection: make sure to delete reply_wake entries
authorDavid Herrmann <dh.herrmann@gmail.com>
Thu, 23 Oct 2014 12:02:55 +0000 (14:02 +0200)
committerDavid Herrmann <dh.herrmann@gmail.com>
Thu, 23 Oct 2014 12:02:55 +0000 (14:02 +0200)
If we reply to a pending method call, we must make sure to only allow a
single connection to respond. Therefore, unqueue reply_wake entries
unconditionally after we allowed a single call to pass through.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection.c

index ad467ea27ff0b9a3ac7e6c955752749f8fe1d9a1..68b0cad5a8a650323721d841f8ce399b46559e1d 100644 (file)
@@ -425,12 +425,11 @@ static int kdbus_conn_check_access(struct kdbus_ep *ep,
                list_for_each_entry_safe(r, tmp, &conn_src->reply_list, entry) {
                        if (r->reply_dst == conn_dst &&
                            r->cookie == msg->cookie_reply) {
-                               if (r->sync) {
+                               list_del_init(&r->entry);
+                               if (r->sync)
                                        *reply_wake = kdbus_conn_reply_ref(r);
-                               } else {
-                                       list_del_init(&r->entry);
+                               else
                                        kdbus_conn_reply_unref(r);
-                               }
 
                                allowed = true;
                                break;