From 3f10c81bec843e0c6ec53e8ca23a54e6e9fe26c3 Mon Sep 17 00:00:00 2001 From: Djalal Harouni Date: Mon, 5 Jan 2015 20:33:56 +0100 Subject: [PATCH] connection: for KDBUS_MSG_SIGNAL check match db then the policy db Minor optimization, before locking the endpoint policy db in order to check for TALK access, check first that the destination match db is interested in the signal. Signed-off-by: Djalal Harouni --- connection.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/connection.c b/connection.c index 9b016d5..2fcf813 100644 --- a/connection.c +++ b/connection.c @@ -1001,6 +1001,12 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src, goto exit_unref; } } else if (msg->flags & KDBUS_MSG_SIGNAL) { + if (!kdbus_match_db_match_kmsg(conn_dst->match_db, + conn_src, kmsg)) { + ret = -EPERM; + goto exit_unref; + } + /* * A receiver needs TALK access to the sender * in order to receive signals. @@ -1009,12 +1015,6 @@ int kdbus_cmd_msg_send(struct kdbus_conn *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); -- 2.34.1