浏览代码

qcacld-3.0: Fix net_device destructor for 4.12+ kernels

Linux kernel version 4.12 changes the way net_device destruction works.
Add conditional compilation to properly setup the net_device destruction
based on which version of the Linux kernel is being compiled against.

Change-Id: Idcc2186ff8593ed1467e7c0b08ece7c4dd70843a
CRs-Fixed: 2093367
Dustin Brown 8 年之前
父节点
当前提交
c81dd41399
共有 3 个文件被更改,包括 13 次插入3 次删除
  1. 11 1
      core/hdd/inc/wlan_hdd_main.h
  2. 1 1
      core/hdd/src/wlan_hdd_hostapd.c
  3. 1 1
      core/hdd/src/wlan_hdd_main.c

+ 11 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -2740,6 +2740,11 @@ static inline void hdd_clear_fils_connection_info(struct hdd_adapter *adapter)
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
+static inline void hdd_dev_setup_destructor(struct net_device *dev)
+{
+	dev->destructor = free_netdev;
+}
+
 static inline int
 hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
 	      int len, const struct nla_policy *policy)
@@ -2747,13 +2752,18 @@ hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
 	return nla_parse(tb, maxtype, head, len, policy);
 }
 #else
+static inline void hdd_dev_setup_destructor(struct net_device *dev)
+{
+	dev->needs_free_netdev = true;
+}
+
 static inline int
 hdd_nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
 	      int len, const struct nla_policy *policy)
 {
 	return nla_parse(tb, maxtype, head, len, policy, NULL);
 }
-#endif
+#endif /* KERNEL_VERSION(4, 12, 0) */
 
 /**
  * hdd_dp_trace_init() - initialize DP Trace by calling the QDF API

+ 1 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -6705,7 +6705,7 @@ struct hdd_adapter *hdd_wlan_create_ap_dev(struct hdd_context *hdd_ctx,
 			     (void *)macAddr, sizeof(tSirMacAddr));
 
 		pHostapdAdapter->offloads_configured = false;
-		pWlanHostapdDev->destructor = free_netdev;
+		hdd_dev_setup_destructor(pWlanHostapdDev);
 		pWlanHostapdDev->ieee80211_ptr = &pHostapdAdapter->wdev;
 		pHostapdAdapter->wdev.wiphy = hdd_ctx->wiphy;
 		pHostapdAdapter->wdev.netdev = pWlanHostapdDev;

+ 1 - 1
core/hdd/src/wlan_hdd_main.c

@@ -3062,7 +3062,7 @@ static struct hdd_adapter *hdd_alloc_station_adapter(struct hdd_context *hdd_ctx
 
 		hdd_set_station_ops(adapter->dev);
 
-		pWlanDev->destructor = free_netdev;
+		hdd_dev_setup_destructor(pWlanDev);
 		pWlanDev->ieee80211_ptr = &adapter->wdev;
 		pWlanDev->tx_queue_len = HDD_NETDEV_TX_QUEUE_LEN;
 		adapter->wdev.wiphy = hdd_ctx->wiphy;