[PATCH] vpn: Do not access invalid hash table pointer

Daniel Wagner wagi at monom.org
Fri Nov 23 09:06:04 PST 2012


From: Daniel Wagner <daniel.wagner at bmw-carit.de>

The vpn deamon went down before create_configuration() was called.

connmand[20065]: src/provider.c:provider_destruct() provider 0x6b9fe0
connmand[20065]: plugins/vpn.c:remove_connection() path /net/connman/vpn/connection/monom_org_monom_org
connmand[20065]: plugins/vpn.c:connection_destroy() data 0x6bc9d0
connmand[20065]: plugins/vpn.c:remove_connection_reply()
connmand[20065]: plugins/vpn.c:vpnd_removed() connection 0x6aa9e0
[...]
connmand[20065]: src/manager.c:connect_provider() conn 0x6aa9e0
connmand[20065]: src/provider.c:__connman_provider_create_and_connect() msg 0x6ad4b0
connmand[20065]: plugins/vpn.c:create_configuration() OpenVPN.Cert /home/wagi/.config/openvpn/monom/cesium.crt
connmand[20065]: plugins/vpn.c:create_configuration() OpenVPN.Key /home/wagi/.config/openvpn/monom/cesium.key
connmand[20065]: plugins/vpn.c:create_configuration() Host monom.org
connmand[20065]: plugins/vpn.c:create_configuration() Name MonoM VPN
connmand[20065]: plugins/vpn.c:create_configuration() OpenVPN.CACert /home/wagi/.config/openvpn/monom/ca.crt
connmand[20065]: plugins/vpn.c:create_configuration() VPN.Domain monom.org
connmand[20065]: plugins/vpn.c:create_configuration() OpenVPN.RemoteCertTls server
connmand[20065]: plugins/vpn.c:create_configuration() Type openvpn
connmand[20065]: plugins/vpn.c:create_configuration() OpenVPN.TLSRemote /C=DE/ST=Bayern/L=Munich/O=monom/CN=cesium/emailAddress=root at monom.org
connmand[20065]: plugins/vpn.c:create_configuration() VPN type openvpn name MonoM VPN host monom.org domain monom.org networks (nil)
connmand[20065]: plugins/vpn.c:create_configuration() ident monom_org_monom_org

(gdb) bt
#0  0x0000003903e4eaa0 in g_log () from /lib64/libglib-2.0.so.0
#1  0x0000003903e37f29 in g_hash_table_lookup () from /lib64/libglib-2.0.so.0
#2  0x000000000043125d in create_configuration (msg=0x6ad4b0, callback=0x44a970 <connection_ready>) at plugins/vpn.c:1233
#3  0x000000000043c211 in connect_provider (conn=<optimized out>, msg=0x6ad4b0, data=<optimized out>) at src/manager.c:237
#4  0x0000000000410841 in process_message (connection=0x6aa9e0, message=<optimized out>, iface_user_data=<optimized out>,
    method=<optimized out>, method=<optimized out>) at gdbus/object.c:197
#5  0x000000397161da45 in ?? () from /lib64/libdbus-1.so.3
#6  0x000000397160fa83 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
#7  0x000000000040ef08 in message_dispatch (data=0x6aa9e0) at gdbus/mainloop.c:76
#8  0x0000003903e483bb in ?? () from /lib64/libglib-2.0.so.0
#9  0x0000003903e47825 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#10 0x0000003903e47b58 in ?? () from /lib64/libglib-2.0.so.0
#11 0x0000003903e47f52 in g_main_loop_run () from /lib64/libglib-2.0.so.0
#12 0x000000000040e9f2 in main (argc=1, argv=0x7fffffffe568) at src/main.c:604
---
 plugins/vpn.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index c7f59a9..c4733ed 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -1230,7 +1230,11 @@ static int create_configuration(DBusMessage *msg, connection_ready_cb callback)
 
 	DBG("ident %s", ident);
 
-	data = g_hash_table_lookup(vpn_connections, ident);
+	if (vpn_connections != NULL)
+		data = g_hash_table_lookup(vpn_connections, ident);
+	else
+		data = NULL;
+
 	if (data != NULL) {
 		if (data->call != NULL) {
 			connman_error("Dbus call already pending");
-- 
1.7.11.7




More information about the connman mailing list