ofono: Fix NULL pointer access in set_disconnect()
authorDaniel Wagner <daniel.wagner@bmw-carit.de>
Fri, 30 Mar 2012 14:16:55 +0000 (16:16 +0200)
committerDaniel Wagner <daniel.wagner@bmw-carit.de>
Mon, 2 Apr 2012 12:52:01 +0000 (14:52 +0200)
oFono sends several ConnectionContext.PropertyChanged("Active", False)
after it was told to disconnect.

After studying the oFono part, it looks like that serveral CREGS updates
could trigger oFono to send us the same flag over and over again
(see ofono_gprs_status_notify()).

Even though oFono might missbehave, ConnMan should not crash so
easily. Luckely, the fix is very simple. We should just check if we still
have a valid network pointer before accessing it.

Fixes BMC#25026

plugins/ofono.c

index 74c12d8..754ff6e 100644 (file)
@@ -312,6 +312,9 @@ static void set_disconnected(struct modem_data *modem)
 {
        DBG("%s", modem->path);
 
+       if (modem->network == NULL)
+               return;
+
        connman_network_set_connected(modem->network, FALSE);
 }