prima: check for NULL pointer before accessing roc context
Remain on channel context can be NULL in __wlan_hdd_mgmt_tx if
roc is not running already. So check for NULL before accessing
the roc context.
Change-Id: Ib48004d9eb195edb24d5a81656c4ad60809ab4ee
CRs-Fixed: 798180
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index 85a1955..434a9c4 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -1137,13 +1137,15 @@
//then set the wait to 200 ms
if (offchan && !wait)
{
- tANI_U32 current_time = vos_timer_get_system_time();
- int remaining_roc_time = ((int) cfgState->remain_on_chan_ctx->duration -
- (current_time - pAdapter->startRocTs));
- if ( remaining_roc_time > ACTION_FRAME_DEFAULT_WAIT)
- wait = remaining_roc_time;
- else
- wait = ACTION_FRAME_DEFAULT_WAIT;
+ wait = ACTION_FRAME_DEFAULT_WAIT;
+ if (pRemainChanCtx)
+ {
+ tANI_U32 current_time = vos_timer_get_system_time();
+ int remaining_roc_time = ((int) pRemainChanCtx->duration -
+ (current_time - pAdapter->startRocTs));
+ if ( remaining_roc_time > ACTION_FRAME_DEFAULT_WAIT)
+ wait = remaining_roc_time;
+ }
}
//Call sme API to send out a action frame.