Skip to content

Commit

Permalink
dereference null value issue fixed. (ARMmbed#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepakvenugopal authored Feb 6, 2018
1 parent d1378dc commit 6122d24
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
12 changes: 4 additions & 8 deletions source/6LoWPAN/Thread/thread_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1920,21 +1920,17 @@ void thread_mcast_group_change(struct protocol_interface_info_entry *interface,
}
}

void thread_old_partition_data_purge(thread_info_t *thread_info)
void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur)
{
protocol_interface_info_entry_t *cur;

/* Partition has been changed. Wipe out data related to old partition */
thread_management_client_pending_coap_request_kill(thread_info->interface_id);
thread_management_client_pending_coap_request_kill(cur->id);

/* Reset previous routing information */
thread_routing_reset(&thread_info->routing);

/* Clear previous context ID's */
cur = protocol_stack_interface_info_get_by_id(thread_info->interface_id);
thread_routing_reset(&cur->thread_info->routing);

/* Flush address cache */
ipv6_neighbour_cache_flush(&cur->ipv6_neighbour_cache);

}

#endif
Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ uint8_t thread_pending_timestamp_tlv_size(protocol_interface_info_entry_t *cur);
void thread_calculate_key_guard_timer(protocol_interface_info_entry_t *cur, link_configuration_s *linkConfiguration, bool is_init);
void thread_set_link_local_address(protocol_interface_info_entry_t *cur);
void thread_mcast_group_change(struct protocol_interface_info_entry *interface, struct if_group_entry *group, bool group_added);
void thread_old_partition_data_purge(thread_info_t *thread_info);
void thread_old_partition_data_purge(protocol_interface_info_entry_t *cur);

#else // HAVE_THREAD

Expand Down
2 changes: 1 addition & 1 deletion source/6LoWPAN/Thread/thread_leader_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ static void thread_leader_service_interface_setup_activate(protocol_interface_in
thread_leader_service_private_routemask_init(private);
//SET Router ID
thread_leader_allocate_router_id_by_allocated_id(private, routerId, cur->mac);
thread_old_partition_data_purge(cur->thread_info);
thread_old_partition_data_purge(cur);
cur->lowpan_address_mode = NET_6LOWPAN_GP16_ADDRESS;
thread_bootstrap_update_ml16_address(cur, cur->thread_info->routerShortAddress);
thread_generate_ml64_address(cur);
Expand Down
1 change: 0 additions & 1 deletion source/6LoWPAN/Thread/thread_lowpower_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ void thread_lowpower_process_response(uint8_t *src_address,int8_t instance_id, u
(void) instance_id;
mle_tlv_info_t linkMetricsReport;
if (memcmp(src_address, data_response_ptr->destination_address, 16) != 0) {
tr_debug("Data response not for me");
return;
}

Expand Down
6 changes: 3 additions & 3 deletions source/6LoWPAN/Thread/thread_mle_message_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ static void thread_parse_advertisement(protocol_interface_info_entry_t *cur, mle
if ((thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) ||
(thread_info(cur)->thread_leader_data->weighting != leaderData.weighting)) {
//parent changed partition/weight - reset own routing information
thread_old_partition_data_purge(cur->thread_info);
thread_old_partition_data_purge(cur);
}
//check if network data needs to be requested
if (!thread_bootstrap_request_network_data(cur, &leaderData, shortAddress)) {
Expand Down Expand Up @@ -577,7 +577,7 @@ static void thread_parse_data_response(protocol_interface_info_entry_t *cur, mle
if (thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) {
thread_info(cur)->thread_leader_data->leaderRouterId = leaderData.leaderRouterId;
thread_info(cur)->thread_leader_data->partitionId = leaderData.partitionId;
thread_old_partition_data_purge(cur->thread_info);
thread_old_partition_data_purge(cur);
accept_new_data = true;
}

Expand Down Expand Up @@ -716,7 +716,7 @@ static void thread_host_child_update_request_process(protocol_interface_info_ent
if (thread_info(cur)->thread_leader_data->partitionId != leaderData.partitionId) {
thread_info(cur)->thread_leader_data->leaderRouterId = leaderData.leaderRouterId;
thread_info(cur)->thread_leader_data->partitionId = leaderData.partitionId;
thread_old_partition_data_purge(cur->thread_info);
thread_old_partition_data_purge(cur);
}
//Check Network Data TLV
if (mle_tlv_read_tlv(MLE_TYPE_NETWORK_DATA, mle_msg->data_ptr, mle_msg->data_length, &networkDataTlv)) {
Expand Down

0 comments on commit 6122d24

Please sign in to comment.