diff options
author | Grant Erickson <marathon96@gmail.com> | 2011-05-31 22:01:24 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-05-31 22:01:24 +0200 |
commit | 6fd94b729495d6b9cdb66ae33adafd59f8b38957 (patch) | |
tree | ebfeccf6dcc51acf02c1327d70030b584d5d9f66 /src | |
parent | 1121ed73e9a582d8b92574b00202070a65fb150b (diff) | |
download | connman-6fd94b729495d6b9cdb66ae33adafd59f8b38957.tar.gz connman-6fd94b729495d6b9cdb66ae33adafd59f8b38957.tar.bz2 connman-6fd94b729495d6b9cdb66ae33adafd59f8b38957.zip |
notifier: Limit Counter Underflow
When network and service events occur from the bottom up
(e.g. supplicant, link state, etc.) that also incur IP configuration
changes, it is possible for one or more of the notifier counters to
underflow, leaving connman in a state from which it can never recover
without a process restart.
By limiting underflow of the three notifier counters, these non-
recoverable states are prevented.
Diffstat (limited to 'src')
-rw-r--r-- | src/notifier.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/notifier.c b/src/notifier.c index 27e53a1d..3d83e431 100644 --- a/src/notifier.c +++ b/src/notifier.c @@ -241,6 +241,11 @@ void __connman_notifier_unregister(enum connman_service_type type) { DBG("type %d", type); + if (g_atomic_int_get(®istered[type]) == 0) { + connman_error("notifier unregister underflow"); + return; + } + switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_SYSTEM: @@ -287,6 +292,11 @@ void __connman_notifier_disable(enum connman_service_type type) { DBG("type %d", type); + if (g_atomic_int_get(&enabled[type]) == 0) { + connman_error("notifier disable underflow"); + return; + } + switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_SYSTEM: @@ -333,6 +343,11 @@ void __connman_notifier_disconnect(enum connman_service_type type) { DBG("type %d", type); + if (g_atomic_int_get(&connected[type]) == 0) { + connman_error("notifier disconnect underflow"); + return; + } + switch (type) { case CONNMAN_SERVICE_TYPE_UNKNOWN: case CONNMAN_SERVICE_TYPE_SYSTEM: |