BUG_ON(*c);
+ /* can't be activator and monitor at the same time */
if (hello->conn_flags & KDBUS_HELLO_ACTIVATOR &&
hello->conn_flags & KDBUS_HELLO_MONITOR)
return -EINVAL;
+ /* only privileged connections can activate and monitor */
+ if ((hello->conn_flags & KDBUS_HELLO_ACTIVATOR ||
+ hello->conn_flags & KDBUS_HELLO_MONITOR) &&
+ !kdbus_bus_uid_is_privileged(bus))
+ return -EPERM;
+
KDBUS_ITEM_FOREACH(item, hello, items) {
switch (item->type) {
case KDBUS_ITEM_NAME: