WLAN squashed commits

wlan: fix VOSS packet leak

The VOSS API to return packets to the system
had a bug which causes packet leak, the problem
occurs when low resource condition is hit and
the API is called to return a chain of VOSS packets
to the system. When the condition is hit the VOSS
packets are not added to the free or replenish
list and they are lost forever from the system.

Change-Id: I62d9238ba4ccb62365443650c8ad765c5042826f
CRs-Fixed: 653612

wlan: add check for size of cache aligned skb->data

In receive path we check if the memory DMA'd is more
than the allocated memory. alloc_skb() can allocate
more memory than specified if the specified memory
size is not cache aligned, so check for the size
of cache aligned memory for deciding if the data
DMA's was more that allocated memory.

Change-Id: Iaf5b75b73d1f84d6d64ed0975414218a7bb6f591
CRs-Fixed: 717798

wlan: flush cached frames on assoc failure

Prima driver caches RX frames till the peer
is registered in TL. If assocication failure
occurs then free the cached frames so that
the RX resources are returned back to the
system.

Change-Id: I37d6c08075dc77026ad85863e4838eb5e3742fc3
CRs-Fixed: 643670

wlan: avoid race condition while accessing wpalPacketAvailableCB

wpalPacketAvailableCB can be called from the MC_Thread as well
as the RX_Thread, the race condition can occur when the callback
is called from the MC_Thread and immediately set to NULL after
the function returns and in between that the RX_Thread running
on another core has detected a low resource condition and set
wpalPacketAvailableCB before the MC_Thread sets it to NULL.
To avoid the race conditions always set/reset the values to
wpalPacketAvailableCB in RX_thread only.

Change-Id: Idb1700287186df4b3ede45324cfa2062b1b81d9e
CRs-Fixed: 599184

prima: update to LNX.LA.3.5.1.5

Change-Id: I17cd07b80cb6f3e2f43532cfb3928db0d0cffa3b

wlan: Filter out all zero bssid from Scan results.

Some malfunctional APs will send zero bssid in probe response
which causes connection failure.
Filter out these wrong bssids in driver.

CRs-Fixed: 690979
Change-Id: I526db27dd84fcf96d81273df6f3a400b90e05df7

wlan: LIM: check add to null check dereference

Add code to check null dereference check.

Change-Id: I339f3aa9014b013f939179f22ed1650e8c3d6aed
Crs-Fixed: 667938

wlan: Fix static analysis issue(Buffer Overflow) in HDD

Fix Buffer Overflow Array Index Out of Boundsfound in static
analysis in HDD.In hdd_wmm_select_queue/hdd_hostapd_select_queue
skb->priority is assigned as enum which can have value 0 to 8,
we use global array hddLinuxUpToAcMap for up to ac mapping purpose,
which can take maximum index range from 0 to 7.As up (enum)
might be assgined up to 0-8(8 is SME_QOS_WMM_UP_MAX), so
we should check up before going for mapping to ac.

Change-Id: Ia2855cd0989fef44c55aa2b7af73f95ad0c5954a
CRs-Fixed: 689045

wlan: Failed to Send Action frame.

When GO exist and  invites peer on the same
operating channel where GO is formed,i.e
when GO is on channel, if supplicant sends,
a non zero wait time , driver is not able to
send action frame. As a part of fix , setting
wait time as zero when GO is operating on channel
explicitly in driver.

Change-Id: I652060c53fb4b731b381ebb28996124bc39b4480
CRs-Fixed: 668530

wlan: Acquire rtnl lock while unregistering ioctls.

While unregistering ioctl, HOST will set wireless_handlers to NULL,
at the same time if kernel is processing any IOCTL command
(wireless_process_ioctl), there are chances of deferring
wireless_handler, leading to crash.
Hence, taking rtnl_lock while making wireless_handlers to NULL, as
same lock is taken while processing ioctl.

Change-Id: Idcd907fa345eae9e36d3698225aaa8780576f679
CRs-Fixed: 716024

wlan: Switch off the carrier in case of NULL bss.

In hdd_AssociationCompletionHandler, if we get NULL bss
from wlan_hdd_cfg80211_update_bss_db, it returns from
there only. But when it does, hdd_AssociationCompletionHandler
has to make sure that it does not leave the carrier on with
TX queues enabled, this leads to hdd_tx_timeout being called
continuously.
This crash is avoided by turning off the carrier when
wlan_hdd_cfg80211_update_bss_db fails.

Change-Id: Ie927cb920f20bfaf89c4a2319397a16d4efa4d8f
CRs-Fixed: 716690

wlan: Fix possible null pointer dereference in WDA_IsSelfSTA

In function WDA_IsSelfSTA(), pointer pWDA will be NULL
dereferenced if VOS_GET_WDA_CTXT() returns NULL.
Added NULL pointer check before accessing the pointer.

Change-Id: I40dcac790d0bc76939c13b4af864139889403a02
CRs-Fixed: 679406.

wlan: check for pAdapter NULL dereference.

this fix will ensure NULL pointer derefernce
in function hdd_deinit_batch_scan.

Change-Id: I0877dde6fff3534477c4a866a91607561b61d33c
CRs-Fixed: 621421

wlan: Clean up WD thread to avoid crash.

In function VosWDThread() we check if resetinprogress
is set in WD context but still execute WLAN re-init
which causes system to crash.
Clean up WD thread so that it doesnot execute WLAN
re-init when it is not shutdown.

Change-Id: Ica0ab74e98f2153dcab91e9aa111bc6dacc6e9ba
CRs-Fixed: 682616

wlan: Remove the NULL SSID check from AP caps mismatch logic.

In limDetectChangeInApCapabilities if SSID is NULL DUT sends an
unicast probe request to AP and recheck the capability once
it gets the probe resp.Some APs sends NULL SSID even in Probe
resp and thus AP is disconnected.

Removed the NULL SSID check from limDetectChangeInApCapabilities.

Change-Id: Ie195b8ab9a0e24e5c6082d62090cfa7c22ee3ccc
CRs-Fixed: 669282

wlan: wda: Null pointer check for invalid vos packet

Add a null pointer check for WDA_CFG_RXP_FILTER_REQ
in WDA agaist packet received from SME.
This is preventive fix.

Change-Id: I4abe44b56cf0499798baecc9e3ea10d706f270cf
CRs-Fixed: 647410

wlan: Invalid Staid is sent to HDD

During reassociation to associated AP,invalid staid is getting
passed to HDD from CSR and HDD is using the same to update
the adpater address in HDD context and causing a memory
corruption.

As part of this change updated the staId at CSR and added
Condition checks at HDD layer before updating the HDD context.

Change-Id: I5f057caac5f766c6c95332484e531366f68a49dd
CRs-Fixed: 681249