qcacld-3.0: check net dev ref leak before removing adapter from list

Currently driver checks net dev ref leak for adapter, once it
removes adapter from the list which is not the correct way as
in some cases it is possible that one thread loops through the
the adapter list and uses one of the adapter and the other thread
deletes the adapter from the list, since the adapter is deleted
from the list, it's next and previous pointers will point to
itself which will lead first thread to fall into infinite loop.

To address above issue check net dev ref leak before removing
adapter from the adapter list so that it will make sure that
no other thread is holding the referene of this adapter.

Change-Id: I819458e9de8f016898e24bf3bb376acb657e8187
CRs-Fixed: 2854000
1 file changed