Signed-off-by: Djalal Harouni <tix...@opendz.org>
---
 connection.c |  7 ++-----
 match.c      | 14 ++------------
 names.c      |  5 +----
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/connection.c b/connection.c
index 97fde97..f14cedc 100644
--- a/connection.c
+++ b/connection.c
@@ -1752,11 +1752,8 @@ int kdbus_cmd_conn_info(struct kdbus_conn *conn,
                }
 
                name = cmd_info->name;
-       } else {
-               mutex_lock(&conn->bus->lock);
-               owner_conn = kdbus_bus_find_conn_by_id(conn->bus, cmd_info->id);
-               mutex_unlock(&conn->bus->lock);
-       }
+       } else
+               owner_conn = kdbus_conn_find_peer(conn, cmd_info->id);
 
        /*
         * If a lookup by name was requested, set owner_conn to the
diff --git a/match.c b/match.c
index 4a12a24..ccc4042 100644
--- a/match.c
+++ b/match.c
@@ -358,12 +358,7 @@ int kdbus_match_db_add(struct kdbus_conn *conn,
                return -EPERM;
 
        if (cmd->owner_id != 0 && cmd->owner_id != conn->id) {
-               struct kdbus_bus *bus = conn->bus;
-
-               mutex_lock(&bus->lock);
-               target_conn = kdbus_bus_find_conn_by_id(bus, cmd->owner_id);
-               mutex_unlock(&bus->lock);
-
+               target_conn = kdbus_conn_find_peer(conn, cmd->owner_id);
                if (!target_conn) {
                        ret = -ENXIO;
                        goto exit_free;
@@ -534,12 +529,7 @@ int kdbus_match_db_remove(struct kdbus_conn *conn,
                return -EPERM;
 
        if (cmd->owner_id != 0 && cmd->owner_id != conn->id) {
-               struct kdbus_bus *bus = conn->bus;
-
-               mutex_lock(&bus->lock);
-               target_conn = kdbus_bus_find_conn_by_id(bus, cmd->owner_id);
-               mutex_unlock(&bus->lock);
-
+               target_conn = kdbus_conn_find_peer(conn, cmd->owner_id);
                if (!target_conn)
                        return -ENXIO;
 
diff --git a/names.c b/names.c
index a7761d1..f4f56d8 100644
--- a/names.c
+++ b/names.c
@@ -605,10 +605,7 @@ int kdbus_cmd_name_acquire(struct kdbus_name_registry *reg,
                if (!kdbus_bus_uid_is_privileged(bus))
                        return -EPERM;
 
-               mutex_lock(&bus->lock);
-               new_conn = kdbus_bus_find_conn_by_id(bus, cmd->owner_id);
-               mutex_unlock(&bus->lock);
-
+               new_conn = kdbus_conn_find_peer(conn, cmd->owner_id);
                if (!new_conn)
                        return -ENXIO;
 
-- 
1.8.5.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to