endpoint: check if the endpoint has a policy before locking DB and connection
authorDjalal Harouni <tixxdz@opendz.org>
Fri, 3 Oct 2014 23:22:00 +0000 (00:22 +0100)
committerDaniel Mack <daniel@zonque.org>
Sat, 4 Oct 2014 08:27:38 +0000 (10:27 +0200)
Littel optimization on kdbus_ep_policy_check_notification().

Default bus endpoints do not enforce the endpoint policy, so instead
of checking if the endpoint is using the policy in
kdbus_ep_policy_check_see_access_unlocked(), just do the check at the
beginning and avoid all the useless locking.

This is already done for kdbus_ep_policy_check_src_names().

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
endpoint.c

index 49e7b1857838c0d11c6f807c0e99c188618a5d5b..6e8e361c77ed8d7a92bf5633cf98f4a39459320d 100644 (file)
@@ -330,7 +330,7 @@ int kdbus_ep_policy_check_notification(struct kdbus_ep *ep,
 {
        int ret = 0;
 
-       if (kmsg->msg.src_id != KDBUS_SRC_ID_KERNEL)
+       if (kmsg->msg.src_id != KDBUS_SRC_ID_KERNEL || !ep->has_policy)
                return 0;
 
        switch (kmsg->notify_type) {