wlan: Fix for issues with ARP resolution in IBSS mode

This can happen when the network stack pushes data packets when
there are no peers. Adding the checks to make sure IBSS state is
proper before delivering the packets down to TL. The HDD also
traps the failure code while indicating pending packet to TL and
returns appropriate status code to kernel stack.

Change-Id: Id3a9a1a6bacbd830474f32f18f885557e92d90c0
CRs-Fixed: 548885
diff --git a/CORE/HDD/src/wlan_hdd_tx_rx.c b/CORE/HDD/src/wlan_hdd_tx_rx.c
index 470b2a1..3aeb165 100644
--- a/CORE/HDD/src/wlan_hdd_tx_rx.c
+++ b/CORE/HDD/src/wlan_hdd_tx_rx.c
@@ -552,7 +552,8 @@
        return NETDEV_TX_BUSY;
    }
 
-   if (WLAN_HDD_IBSS == pAdapter->device_mode)
+   if (WLAN_HDD_IBSS == pAdapter->device_mode &&
+       eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)
    {
       v_MACADDR_t *pDestMacAddress = (v_MACADDR_t*)skb->data;
 
@@ -605,9 +606,18 @@
             * if it is in the mainline code and if the log level is enabled by someone for debugging
            VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,"%s:Queue is Filling up.Inform TL again about pending packets", __func__);*/
 
-       WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
-                              STAId, ac
-                             );
+      status = WLANTL_STAPktPending( (WLAN_HDD_GET_CTX(pAdapter))->pvosContext,
+                                    STAId, ac
+                                    );
+      if ( !VOS_IS_STATUS_SUCCESS( status ) )
+      {
+         VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                    "%s: WLANTL_STAPktPending() returned error code %d",
+                    __func__, status);
+         kfree_skb(skb);
+         spin_unlock(&pAdapter->wmm_tx_queue[ac].lock);
+         return NETDEV_TX_OK;
+      }
    }
    //If we have already reached the max queue size, disable the TX queue
    if ( pAdapter->wmm_tx_queue[ac].count == pAdapter->wmm_tx_queue[ac].max_size)