瀏覽代碼

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
Jingxiang Ge 4 年之前
父節點
當前提交
fd681878a7
共有 1 個文件被更改,包括 6 次插入2 次删除
  1. 6 2
      core/hdd/src/wlan_hdd_main.c

+ 6 - 2
core/hdd/src/wlan_hdd_main.c

@@ -4581,7 +4581,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:
@@ -8614,7 +8613,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,