mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-10-30 01:52:51 +00:00
opensync: Fix SM crash during chan switch event
Fix SM crash event during chan switch event due to global chan switch struct not being freed properly. Signed-off-by: Chaitanya Godavarthi <chaitanya.kiran@netexperience.com>
This commit is contained in:
committed by
Rick Sommerville
parent
3fc41fac2c
commit
482cfee8d5
34
feeds/wlan-ap/opensync/patches/35-channel-switch-fix.patch
Normal file
34
feeds/wlan-ap/opensync/patches/35-channel-switch-fix.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
Index: opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
||||
===================================================================
|
||||
--- opensync-2.0.5.0.orig/src/lib/datapipeline/src/dppline.c
|
||||
+++ opensync-2.0.5.0/src/lib/datapipeline/src/dppline.c
|
||||
@@ -652,8 +652,8 @@ static bool dppline_copysts(dppline_stat
|
||||
dst->u.events.client_event_qty++;
|
||||
}
|
||||
|
||||
- size = dst->u.events.client_event_qty * sizeof(dpp_event_record_session_t);
|
||||
- dst->u.events.client_event_list = calloc(1, size);
|
||||
+ int size_cl = dst->u.events.client_event_qty * sizeof(dpp_event_record_session_t);
|
||||
+ dst->u.events.client_event_list = calloc(1, size_cl);
|
||||
int count = 0;
|
||||
ds_dlist_foreach(&report_data->client_event_list, result)
|
||||
{
|
||||
@@ -671,8 +671,8 @@ static bool dppline_copysts(dppline_stat
|
||||
dst->u.events.channel_event_qty++;
|
||||
}
|
||||
|
||||
- size = dst->u.events.channel_event_qty * sizeof(dpp_event_record_channel_switch_t);
|
||||
- dst->u.events.channel_event_list = calloc(1, size);
|
||||
+ int size_ch = dst->u.events.channel_event_qty * sizeof(dpp_event_record_channel_switch_t);
|
||||
+ dst->u.events.channel_event_list = calloc(1, size_ch);
|
||||
ds_dlist_foreach(&report_data->channel_switch_list, channel_result)
|
||||
{
|
||||
assert(count < (int)dst->u.events.channel_event_qty);
|
||||
@@ -680,6 +680,7 @@ static bool dppline_copysts(dppline_stat
|
||||
sizeof(dpp_event_record_channel_switch_t));
|
||||
count++;
|
||||
}
|
||||
+ size = size_cl + size_ch;
|
||||
|
||||
} break;
|
||||
|
||||
@@ -463,6 +463,19 @@ dpp_event_record_alloc()
|
||||
return record;
|
||||
}
|
||||
|
||||
static inline dpp_event_channel_switch_t *
|
||||
dpp_event_channel_switch_alloc()
|
||||
{
|
||||
dpp_event_channel_switch_t *record = NULL;
|
||||
|
||||
record = calloc(1, sizeof(dpp_event_channel_switch_t));
|
||||
if (record) {
|
||||
memset(record, 0, sizeof(dpp_event_channel_switch_t));
|
||||
}
|
||||
return record;
|
||||
}
|
||||
|
||||
|
||||
static inline void
|
||||
dpp_event_channel_record_free(dpp_event_channel_switch_t *record)
|
||||
{
|
||||
|
||||
@@ -105,7 +105,6 @@ static void sm_events_report_clear_client(ds_dlist_t *report_list)
|
||||
static void sm_events_report_clear_channel(ds_dlist_t *report_list)
|
||||
{
|
||||
if (!ds_dlist_is_empty(report_list)) {
|
||||
|
||||
dpp_event_channel_switch_t *record = NULL;
|
||||
ds_dlist_iter_t record_iter;
|
||||
|
||||
@@ -129,6 +128,8 @@ static void sm_events_report(EV_P_ ev_timer *w, int revents)
|
||||
/* Event Record */
|
||||
dpp_event_record_t *dpp_record = NULL;
|
||||
dpp_event_record_t *sm_record = NULL;
|
||||
dpp_event_channel_switch_t *dpp_record_cs = NULL;
|
||||
dpp_event_channel_switch_t *sm_record_cs = NULL;
|
||||
ds_dlist_iter_t record_iter;
|
||||
|
||||
dpp_events_report_timer_restart(report_timer);
|
||||
@@ -153,8 +154,23 @@ static void sm_events_report(EV_P_ ev_timer *w, int revents)
|
||||
ds_dlist_insert_tail(&report_ctx->client_event_list, dpp_record);
|
||||
}
|
||||
|
||||
if(!ds_dlist_is_empty(&g_event_report.channel_switch_list))
|
||||
report_ctx->channel_switch_list = g_event_report.channel_switch_list;
|
||||
for (sm_record_cs = ds_dlist_ifirst(&record_iter, &g_event_report.channel_switch_list); sm_record_cs != NULL; sm_record_cs = ds_dlist_inext(&record_iter)) {
|
||||
dpp_record_cs = dpp_event_channel_switch_alloc();
|
||||
|
||||
dpp_record_cs->channel_event.band = sm_record_cs->channel_event.band;
|
||||
dpp_record_cs->channel_event.reason = sm_record_cs->channel_event.reason;
|
||||
dpp_record_cs->channel_event.freq = sm_record_cs->channel_event.freq;
|
||||
dpp_record_cs->channel_event.timestamp = sm_record_cs->channel_event.timestamp;
|
||||
|
||||
ds_dlist_iremove(&record_iter);
|
||||
dpp_event_channel_record_free(sm_record_cs);
|
||||
sm_record_cs = NULL;
|
||||
|
||||
if (ds_dlist_is_empty(&report_ctx->channel_switch_list)) {
|
||||
ds_dlist_init(&report_ctx->channel_switch_list, dpp_event_channel_switch_t, node);
|
||||
}
|
||||
ds_dlist_insert_tail(&report_ctx->channel_switch_list, dpp_record_cs);
|
||||
}
|
||||
|
||||
if (!ds_dlist_is_empty(&report_ctx->client_event_list) || !ds_dlist_is_empty(&report_ctx->channel_switch_list)) {
|
||||
LOG(DEBUG, "Sending events report...");
|
||||
|
||||
Reference in New Issue
Block a user