gprs: Assign GPRS atom to GPRS context atom
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Oct 2010 12:03:47 +0000 (14:03 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 26 Oct 2010 12:03:47 +0000 (14:03 +0200)
If the GPRS atom is not assigned to the GPRS context atom, then possible
network triggered activation crashes.

src/gprs.c

index d1b7de0..103fd85 100644 (file)
@@ -1650,6 +1650,8 @@ void ofono_gprs_add_context(struct ofono_gprs *gprs,
        if (gc->driver == NULL)
                return;
 
+       gc->gprs = gprs;
+
        gprs->context_drivers = g_slist_append(gprs->context_drivers, gc);
        __ofono_atom_register(gc->atom, gprs_context_unregister);
 }
@@ -1662,6 +1664,9 @@ void ofono_gprs_context_deactivated(struct ofono_gprs_context *gc,
        struct pri_context *ctx;
        dbus_bool_t value;
 
+       if (gc->gprs == NULL)
+               return;
+
        for (l = gc->gprs->contexts; l; l = l->next) {
                ctx = l->data;