| From 88fae9898b16d91017723368686425c997073d01 Mon Sep 17 00:00:00 2001 |
| From: ZY Zheng <zy.zheng@mediatek.com> |
| Date: Tue, 29 Aug 2017 10:50:42 +0800 |
| Subject: [PATCH 16/16] connman: access null pointer for some timing |
| |
| 1.access null pointer for some timing |
| 2.remove rebundant log |
| Test: test ok on 2635 |
| |
| Change-Id: I4089df70e8cb679db8a2ae3da59e158868df066f |
| Signed-off-by: ZY Zheng <zy.zheng@mediatek.com> |
| CR-Id: AUTO00006773 |
| --- |
| plugins/telephony.c | 151 ++++++---------------------------------------------- |
| 1 file changed, 15 insertions(+), 136 deletions(-) |
| mode change 100755 => 100644 plugins/telephony.c |
| |
| diff --git a/plugins/telephony.c b/plugins/telephony.c |
| old mode 100755 |
| new mode 100644 |
| index 81388cb..ad19660 |
| --- a/plugins/telephony.c |
| +++ b/plugins/telephony.c |
| @@ -705,7 +705,6 @@ static void set_connected(struct modem_data *modem, |
| |
| |
| index = connman_inet_ifindex(context->ifname);//context->index; |
| - //connman_inet_ifup(index);//ZY it will makred |
| DBG("ifname[%s] index[%d]", context->ifname, index); |
| |
| service = connman_service_lookup_from_network(context->network); |
| @@ -996,133 +995,66 @@ static void send_method_call(DBusConnection * connection, enum DBusType dbusType |
| switch(dbusType){ |
| case DMethodCallSetupdatacall: |
| { |
| - DBG("modem->call_setup_data_call[%p]", modem->call_setup_data_call); |
| + |
| + if (!modem) |
| + return; |
| + |
| if (modem->call_setup_data_call) { |
| + DBG("modem->call_setup_data_call[%p]", modem->call_setup_data_call); |
| DBG("Cancel pending SetProperty"); |
| dbus_pending_call_cancel(modem->call_setup_data_call); |
| dbus_pending_call_unref(modem->call_setup_data_call); |
| modem->call_setup_data_call = NULL; |
| } |
| |
| - DBG("methodType1"); |
| msg = dbus_message_new_method_call (TELEPHONY_SERVICE, TELEPHONY_DATA_PATH, TELEPHONY_DATA_INTERFACE, METHODC_ENABLE_DATA); |
| if(msg == NULL){ |
| DBG("MessageNULL"); |
| return; |
| } |
| - DBG("methodType2"); |
| + |
| status = true; |
| dbus_message_iter_init_append(msg, &arg); |
| if(!dbus_message_iter_append_basic(&arg, DBUS_TYPE_BOOLEAN, &status)){ |
| DBG("dbus_message_iter_append_basic Out of Memory!"); |
| - } |
| + } |
| |
| - DBG("methodType3 pdn[%p] &pdn[%p]", pdn, &pdn); |
| if(!dbus_message_iter_append_basic(&arg, DBUS_TYPE_STRING, &pdn)){ |
| DBG("dbus_message_iter_append_basic Out of Memory!"); |
| - } |
| + } |
| |
| - DBG("methodType4"); |
| if(!dbus_connection_send_with_reply (connection, msg, &modem->call_setup_data_call, DBUS_TIMEOUT_INFINITE)){ |
| DBG("dbus_connection_send_with_reply Out of Memory!"); |
| - } |
| + } |
| |
| - DBG("methodType5"); |
| |
| if (!modem->call_setup_data_call) { |
| connman_error("D-Bus connection not available"); |
| dbus_message_unref(msg); |
| return; |
| - } |
| + } |
| |
| - DBG("dbus_message_unref1"); |
| dbus_message_unref(msg); |
| |
| - #if 1 |
| - |
| - #if 0 //error |
| - if (!dbus_pending_call_get_completed(modem->call_setup_data_call)) |
| - { |
| - DBG("time out"); |
| - dbus_pending_call_cancel(modem->call_setup_data_call); |
| - dbus_pending_call_unref(modem->call_setup_data_call); |
| - modem->call_setup_data_call = NULL; |
| - |
| - } |
| - #endif |
| - |
| - |
| dbus_pending_call_set_notify(modem->call_setup_data_call, |
| setup_datacall_reply, NULL, NULL); |
| - #else |
| - |
| - |
| - dbus_pending_call_block (modem->call_setup_data_call); |
| - |
| - reply =dbus_pending_call_steal_reply (modem->call_setup_data_call); |
| - if (msg == NULL) |
| - { |
| - DBG("ReplyNull!"); |
| - dbus_message_unref(reply); |
| - return; |
| - } |
| - |
| - |
| - |
| - ret = dbus_message_get_args( reply, &err, |
| - DBUS_TYPE_INT32, &dataCallResponse.active, |
| - DBUS_TYPE_INT32, &dataCallResponse.status, |
| - DBUS_TYPE_INT32, &dataCallResponse.cid, |
| - DBUS_TYPE_STRING, &dataCallResponse.type, |
| - DBUS_TYPE_STRING, &dataCallResponse.ifname, |
| - DBUS_TYPE_STRING, &dataCallResponse.addresses, |
| - DBUS_TYPE_STRING, &dataCallResponse.dnses, |
| - DBUS_TYPE_STRING, &dataCallResponse.gateway, |
| - DBUS_TYPE_INT32, &dataCallResponse.mtu, |
| - DBUS_TYPE_INVALID ); |
| - |
| - if (FALSE == ret) |
| - { |
| - DBG("error.nam[%s]: error.message[%s]", error.name, error.message); |
| - dbus_message_unref(msg); |
| - dbus_pending_call_unref(modem->call_setup_data_call); |
| - modem->call_setup_data_call = NULL; |
| - dbus_message_unref(reply); |
| - return; |
| - } |
| - |
| - DBG("active[%d] status[%d] cid[%d]", dataCallResponse.active, dataCallResponse.status, dataCallResponse.cid); |
| - DBG("type[%s] ifname[%s] addresses[%s]", dataCallResponse.type, dataCallResponse.ifname, dataCallResponse.addresses); |
| - DBG("dnses[%s] gateway[%s] mtu[%d]", dataCallResponse.dnses, dataCallResponse.gateway , dataCallResponse.mtu); |
| - |
| - extract_dbus_info(&dataCallResponse, context, DMethodCallSetupdatacall); |
| - |
| - if (context->active == CONNECTED) |
| - { |
| - set_connected(modem, context); |
| - } |
| - |
| - |
| - dbus_message_unref(reply); |
| - dbus_pending_call_unref(modem->call_setup_data_call); |
| - modem->call_setup_data_call = NULL; |
| - |
| - #endif |
| break; |
| |
| } |
| |
| case DMethodDeactivedatacall: |
| { |
| - DBG("modem->call_deactive_data_call[%p]", modem->call_deactive_data_call); |
| + if (!modem) |
| + return; |
| + |
| if (modem->call_deactive_data_call) { |
| + DBG("modem->call_deactive_data_call[%p]", modem->call_deactive_data_call); |
| DBG("Cancel pending SetProperty"); |
| dbus_pending_call_cancel(modem->call_deactive_data_call); |
| dbus_pending_call_unref(modem->call_deactive_data_call); |
| modem->call_deactive_data_call = NULL; |
| } |
| |
| - DBG("DMethodDeactivedatacall"); |
| status = false; |
| |
| msg = dbus_message_new_method_call(TELEPHONY_SERVICE, TELEPHONY_DATA_PATH, TELEPHONY_DATA_INTERFACE, METHODC_ENABLE_DATA); |
| @@ -1148,58 +1080,8 @@ static void send_method_call(DBusConnection * connection, enum DBusType dbusType |
| |
| dbus_message_unref(msg); |
| |
| - #if 1 |
| - |
| dbus_pending_call_set_notify(modem->call_deactive_data_call, |
| deactive_datacall_reply, NULL, NULL); |
| - #else |
| - |
| - |
| - dbus_pending_call_block (modem->call_deactive_data_call); |
| - |
| - reply =dbus_pending_call_steal_reply (modem->call_deactive_data_call); |
| - if (msg == NULL) |
| - { |
| - DBG("ReplyNull!"); |
| - dbus_message_unref(reply); |
| - return; |
| - } |
| - |
| - |
| - |
| - ret = dbus_message_get_args(reply, &err, |
| - DBUS_TYPE_INT32, &dataCallResponse.active, |
| - DBUS_TYPE_INT32, &dataCallResponse.status, |
| - DBUS_TYPE_INT32, &dataCallResponse.cid, |
| - DBUS_TYPE_INVALID); |
| - |
| - if (FALSE == ret) |
| - { |
| - DBG("error.name [%s]: error.message[%s]", error.name, error.message); |
| - dbus_message_unref(msg); |
| - dbus_pending_call_unref(modem->call_deactive_data_call); |
| - modem->call_deactive_data_call = NULL; |
| - dbus_message_unref(reply); |
| - return; |
| - } |
| - |
| - DBG("active[%d] status[%d] cid[%d]", dataCallResponse.active, dataCallResponse.status, dataCallResponse.cid); |
| - |
| - extract_dbus_info(&dataCallResponse, context, DMethodDeactivedatacall); |
| - |
| - if (context->active == DISCONNECTED) |
| - { |
| - set_disconnected(context); |
| - }else{ |
| - |
| - } |
| - |
| - |
| - dbus_message_unref(reply); |
| - dbus_pending_call_unref(modem->call_deactive_data_call); |
| - modem->call_deactive_data_call = NULL; |
| - |
| - #endif |
| break; |
| |
| } |
| @@ -1208,9 +1090,6 @@ static void send_method_call(DBusConnection * connection, enum DBusType dbusType |
| break; |
| } |
| } |
| - |
| - DBG("methodType6"); |
| - |
| } |
| |
| #endif |
| @@ -1298,7 +1177,7 @@ static int network_connect(struct connman_network *network) |
| if (!connection) |
| return -EIO; |
| |
| - DBG("context->pdnStatus zy[%d]", context->pdnStatus); |
| + DBG("context->pdnStatus [%d]", context->pdnStatus); |
| if (context->pdnStatus != ConnmanPDNStatusConnected) |
| { |
| DBG("send_method_call"); |
| -- |
| 1.9.1 |
| |