From a8a07f892c6f64d88a9848deed56a9f3b778301a Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 11 Nov 2013 23:42:30 +0100 Subject: [PATCH] bus: detect blocking message calls to our own connection and return ELOOP early --- src/libsystemd-bus/sd-bus.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c index 3ecda17..89437c1 100644 --- a/src/libsystemd-bus/sd-bus.c +++ b/src/libsystemd-bus/sd-bus.c @@ -1637,6 +1637,19 @@ _public_ int sd_bus_call( sd_bus_message_unref(incoming); return -EIO; + + } else if (incoming->header->serial == serial && + bus->unique_name && + incoming->sender && + streq(bus->unique_name, incoming->sender)) { + + /* Our own message? Somebody is trying + * to send its own client a message, + * let's not dead-lock, let's fail + * immediately. */ + + sd_bus_message_unref(incoming); + return -ELOOP; } /* There's already guaranteed to be room for -- 2.7.4