qcacld-3.0: Keep adapter->dev for netdev ref check

adapter->dev is used for get ref, issue happens
1  adapter is used to dev hold in thread_1
2  adapter is removed in thread_2 for interface
   delete, and adapter->dev is set to NULL in
   hdd_uninit.
3  thread_1 use adapter->dev for dev_put, then
   adapter->dev is invalid here.

As adapter->dev will be invalid only after dev_put,
so not set null adapter->dev in hdd_uninit in case
dev_put need it.

Change-Id: Id764a6ef15ef8fc4eae24a3f2428d8cec55716aa
CRs-Fixed: 2912285
This commit is contained in:
Jingxiang Ge 2021-03-30 20:27:31 +08:00 • committed by snandini
commit 93871ddbaa

View file

@ -4517,7 +4517,6 @@ static void hdd_uninit(struct net_device *dev)
hdd_deinit_adapter(hdd_ctx, adapter, true);
/* after uninit our adapter structure will no longer be valid */
adapter->dev = NULL;
adapter->magic = 0;
exit:
@ -8561,7 +8560,12 @@ void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter,
QDF_BUG(0);
}
dev_put(adapter->dev);
if (adapter->dev) {
dev_put(adapter->dev);
} else {
hdd_err("adapter->dev is NULL");
QDF_BUG(0);
}
}
QDF_STATUS hdd_get_front_adapter(struct hdd_context *hdd_ctx,