[PATCH] agent: Check for pointer validity before cancelling agent request
In the case where agent disappears from D-Bus while there are pending requests, request->driver may become null. As it's useless to send a Cancel to a nonexistent agent, not to mention accessing null pointer causes a crash, check for the pointer value before creating a D-Bus message. --- src/agent.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/agent.c b/src/agent.c index a340026..f67b30f 100644 --- a/src/agent.c +++ b/src/agent.c @@ -166,6 +166,9 @@ static int send_cancel_request(struct connman_agent *agent, { DBusMessage *message; + if (!request->driver) + return 0; + DBG("send cancel req to %s %s", agent->owner, agent->path); message = dbus_message_new_method_call(agent->owner, -- 1.9.1 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] agent: Check for pointer validity before cancelling agent request
Hi, On Wed, 2014-10-22 at 11:09 +0300, Hannu Mallat wrote: > In the case where agent disappears from D-Bus while there are pending > requests, request->driver may become null. As it's useless to send a > Cancel to a nonexistent agent, not to mention accessing null pointer > causes a crash, check for the pointer value before creating a D-Bus > message. > --- > src/agent.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/src/agent.c b/src/agent.c > index a340026..f67b30f 100644 > --- a/src/agent.c > +++ b/src/agent.c > @@ -166,6 +166,9 @@ static int send_cancel_request(struct connman_agent > *agent, > { > DBusMessage *message; > > + if (!request->driver) > + return 0; > + Mmmm, but the above can only happen in Jolla's version of ConnMan, there is/was commit 81195279ed07af08caf8c44fc390840b54b19ce2 in the Mer/Jolla tree that caused ->driver to become NULL in some special circumstances. Cheers, Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] agent: Check for pointer validity before cancelling agent request
On 22.10.2014 13:04, Patrik Flykt wrote: Mmmm, but the above can only happen in Jolla's version of ConnMan, there is/was commit 81195279ed07af08caf8c44fc390840b54b19ce2 in the Mer/Jolla tree that caused ->driver to become NULL in some special circumstances. Ah, you're correct. Forgot about that when checking if I had something I hadn't upstreamed yet. BR, H. ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman