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

Otavio Salvador otavio at ossystems.com.br
Tue Feb 28 04:29:10 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]
---
 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




More information about the connman mailing list