[PATCH] inet: rs_cleanup: ensure data->channel exist before accessing it

Otavio Salvador otavio at ossystems.com.br
Mon Feb 27 09:40:43 PST 2012


Log of segfault:
...
connmand[676]: src/network.c:check_dhcpv6() reply (nil)
connmand[676]: src/network.c:check_dhcpv6() re-send router solicitation 3
connmand[676]: src/inet.c:__connman_inet_ipv6_send_rs()
connmand[676]: Aborting (signal 11) [connmand]
---

The full log are available at
http://parenteses.org/mario/misc/connman-backtrace.txt

 src/inet.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/inet.c b/src/inet.c
index d9e12a9..5bf5f1b 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -1433,9 +1433,11 @@ static const struct in6_addr in6addr_all_routers_mc =

 static void rs_cleanup(struct rs_cb_data *data)
 {
-       g_io_channel_shutdown(data->channel, TRUE, NULL);
-       g_io_channel_unref(data->channel);
-       data->channel = 0;
+       if (data->channel) {
+               g_io_channel_shutdown(data->channel, TRUE, NULL);
+               g_io_channel_unref(data->channel);
+               data->channel = 0;
+       }

       if (data->rs_timeout > 0)
               g_source_remove(data->rs_timeout);
--
1.7.9.1

-- 
Otavio Salvador                             O.S. Systems
E-mail: otavio at ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br



More information about the connman mailing list