aboutsummaryrefslogtreecommitdiff
path: root/ipc
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-06-19 21:46:39 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-07-06 18:08:50 +0200
commitbdac38baecf3b1af14b647f791a795a91ef7f6c6 (patch)
tree819dba6b64892999b21026b4cb25690a67b32c65 /ipc
parentc4146fd608177530fb3f6c6ad6e395d3fb0eee4e (diff)
kdbus: pass source connection to queue handling
Make sure we always pass the source-connection of a message along. Right now we drop it for queue allocation, which prevents us from accessing any source details in the queue helpers. We work around this, by passing everything manually, but that just makes things more complex. Pass the source connection down to the queue helpers to allow further cleanups in follow up patches. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/kdbus/connection.c15
-rw-r--r--ipc/kdbus/queue.c9
-rw-r--r--ipc/kdbus/queue.h6
3 files changed, 15 insertions, 15 deletions
diff --git a/ipc/kdbus/connection.c b/ipc/kdbus/connection.c
index 73cad58d2acd..f1667df70b7f 100644
--- a/ipc/kdbus/connection.c
+++ b/ipc/kdbus/connection.c
@@ -779,9 +779,9 @@ void kdbus_conn_lost_message(struct kdbus_conn *c)
/* Callers should take the conn_dst lock */
static struct kdbus_queue_entry *
-kdbus_conn_entry_make(struct kdbus_conn *conn_dst,
- const struct kdbus_kmsg *kmsg,
- struct kdbus_user *user)
+kdbus_conn_entry_make(struct kdbus_conn *conn_src,
+ struct kdbus_conn *conn_dst,
+ const struct kdbus_kmsg *kmsg)
{
/* The remote connection was disconnected */
if (!kdbus_conn_active(conn_dst))
@@ -799,7 +799,7 @@ kdbus_conn_entry_make(struct kdbus_conn *conn_dst,
kmsg->res && kmsg->res->fds_count > 0)
return ERR_PTR(-ECOMM);
- return kdbus_queue_entry_new(conn_dst, kmsg, user);
+ return kdbus_queue_entry_new(conn_src, conn_dst, kmsg);
}
/*
@@ -822,8 +822,8 @@ static int kdbus_conn_entry_sync_attach(struct kdbus_conn *conn_dst,
* entry and attach it to the reply object
*/
if (reply_wake->waiting) {
- entry = kdbus_conn_entry_make(conn_dst, kmsg,
- reply_wake->reply_src->user);
+ entry = kdbus_conn_entry_make(reply_wake->reply_src, conn_dst,
+ kmsg);
if (IS_ERR(entry))
ret = PTR_ERR(entry);
else
@@ -879,8 +879,7 @@ int kdbus_conn_entry_insert(struct kdbus_conn *conn_src,
kdbus_conn_lock2(conn_src, conn_dst);
- entry = kdbus_conn_entry_make(conn_dst, kmsg,
- conn_src ? conn_src->user : NULL);
+ entry = kdbus_conn_entry_make(conn_src, conn_dst, kmsg);
if (IS_ERR(entry)) {
ret = PTR_ERR(entry);
goto exit_unlock;
diff --git a/ipc/kdbus/queue.c b/ipc/kdbus/queue.c
index 1e7916155036..43824c93fb03 100644
--- a/ipc/kdbus/queue.c
+++ b/ipc/kdbus/queue.c
@@ -171,9 +171,9 @@ static void kdbus_queue_entry_unlink(struct kdbus_queue_entry *entry)
/**
* kdbus_queue_entry_new() - allocate a queue entry
+ * @conn_src: source connection
* @conn_dst: destination connection
* @kmsg: kmsg object the queue entry should track
- * @user: user to account message on (or NULL for kernel messages)
*
* Allocates a queue entry based on a given kmsg and allocate space for
* the message payload and the requested metadata in the connection's pool.
@@ -181,10 +181,11 @@ static void kdbus_queue_entry_unlink(struct kdbus_queue_entry *entry)
*
* Return: the allocated entry on success, or an ERR_PTR on failures.
*/
-struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *conn_dst,
- const struct kdbus_kmsg *kmsg,
- struct kdbus_user *user)
+struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *conn_src,
+ struct kdbus_conn *conn_dst,
+ const struct kdbus_kmsg *kmsg)
{
+ struct kdbus_user *user = conn_src ? conn_src->user : NULL;
struct kdbus_msg_resources *res = kmsg->res;
const struct kdbus_msg *msg = &kmsg->msg;
struct kdbus_queue_entry *entry;
diff --git a/ipc/kdbus/queue.h b/ipc/kdbus/queue.h
index 7f2db96fe308..ac471d0c809d 100644
--- a/ipc/kdbus/queue.h
+++ b/ipc/kdbus/queue.h
@@ -78,9 +78,9 @@ void kdbus_queue_init(struct kdbus_queue *queue);
struct kdbus_queue_entry *kdbus_queue_peek(struct kdbus_queue *queue,
s64 priority, bool use_priority);
-struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *conn_dst,
- const struct kdbus_kmsg *kmsg,
- struct kdbus_user *user);
+struct kdbus_queue_entry *kdbus_queue_entry_new(struct kdbus_conn *conn_src,
+ struct kdbus_conn *conn_dst,
+ const struct kdbus_kmsg *kmsg);
void kdbus_queue_entry_free(struct kdbus_queue_entry *entry);
int kdbus_queue_entry_install(struct kdbus_queue_entry *entry,
u64 *return_flags, bool install_fds);