summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2014-02-03 18:36:46 +0100
committerKay Sievers <kay@vrfy.org>2014-02-03 18:36:46 +0100
commit136bd94f3d890e129bbc391838ea1888e189830c (patch)
treea9aca01459b1cc2d482bb1a09963bfb3f24f2cbb
parent35ddf13d403ed79a4755dd6891749b6166918826 (diff)
downloadkdbus-bus-136bd94f3d890e129bbc391838ea1888e189830c.tar.gz
kdbus-bus-136bd94f3d890e129bbc391838ea1888e189830c.tar.bz2
kdbus-bus-136bd94f3d890e129bbc391838ea1888e189830c.zip
save the bus when we fiddle with the function paramter
-rw-r--r--names.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/names.c b/names.c
index 3edb2e2a500..c43960a255f 100644
--- a/names.c
+++ b/names.c
@@ -95,8 +95,7 @@ int kdbus_name_registry_new(struct kdbus_name_registry **reg)
}
static struct kdbus_name_entry *
-__kdbus_name_lookup(struct kdbus_name_registry *reg,
- u32 hash, const char *name)
+__kdbus_name_lookup(struct kdbus_name_registry *reg, u32 hash, const char *name)
{
struct kdbus_name_entry *e;
@@ -592,6 +591,7 @@ int kdbus_cmd_name_release(struct kdbus_name_registry *reg,
struct kdbus_conn *conn,
struct kdbus_cmd_name *cmd)
{
+ struct kdbus_bus *bus = conn->bus;
struct kdbus_name_entry *e;
LIST_HEAD(notify_list);
int ret = 0;
@@ -602,7 +602,7 @@ int kdbus_cmd_name_release(struct kdbus_name_registry *reg,
hash = kdbus_str_hash(cmd->name);
- mutex_lock(&conn->bus->lock);
+ mutex_lock(&bus->lock);
mutex_lock(&reg->entries_lock);
e = __kdbus_name_lookup(reg, hash, cmd->name);
if (!e) {
@@ -613,12 +613,12 @@ int kdbus_cmd_name_release(struct kdbus_name_registry *reg,
/* privileged users can act on behalf of someone else */
if (cmd->owner_id > 0) {
- if (!kdbus_bus_uid_is_privileged(conn->bus)) {
+ if (!kdbus_bus_uid_is_privileged(bus)) {
ret = -EPERM;
goto exit_unlock;
}
- conn = kdbus_bus_find_conn_by_id(conn->bus, cmd->owner_id);
+ conn = kdbus_bus_find_conn_by_id(bus, cmd->owner_id);
if (!conn) {
ret = -ENXIO;
goto exit_unlock;
@@ -631,7 +631,7 @@ int kdbus_cmd_name_release(struct kdbus_name_registry *reg,
exit_unlock:
mutex_unlock(&reg->entries_lock);
- mutex_unlock(&conn->bus->lock);
+ mutex_unlock(&bus->lock);
if (conn) {
kdbus_conn_kmsg_list_send(conn->ep, &notify_list);