From 59373e6cb1bfb686f5d74f0927409d4fd27c6ac6 Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Mon, 5 Jan 2015 14:32:26 +0100 Subject: [PATCH] connection: handle KDBUS_MSG_SIGNAL Add missed hunks for handling KDBUS_MSG_SIGNAL. Signed-off-by: Daniel Mack --- connection.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/connection.c b/connection.c index 5879833..8c2e7d8 100644 --- a/connection.c +++ b/connection.c @@ -989,8 +989,8 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src, goto exit_unref; if (msg->flags & KDBUS_MSG_EXPECT_REPLY) { - ret = kdbus_conn_check_access(conn_src, conn_dst, msg, - NULL); + ret = kdbus_conn_check_access(conn_src, conn_dst, + msg, NULL); if (ret < 0) goto exit_unref; @@ -1000,9 +1000,20 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src, ret = PTR_ERR(reply_wait); goto exit_unref; } + } else if (msg->flags & KDBUS_MSG_SIGNAL) { + ret = kdbus_conn_check_access(conn_dst, conn_src, + msg, NULL); + if (ret < 0) + goto exit_unref; + + if (!kdbus_match_db_match_kmsg(conn_dst->match_db, + conn_src, kmsg)) { + ret = -EPERM; + goto exit_unref; + } } else { - ret = kdbus_conn_check_access(conn_src, conn_dst, msg, - &reply_wake); + ret = kdbus_conn_check_access(conn_src, conn_dst, + msg, &reply_wake); if (ret < 0) goto exit_unref; } -- 2.34.1