Browse Source

qcacld-3.0: Handle error cases cleanly during open adapter

While processing open adapter, error handling is not taken
care appropriately, leading to device crash due to invalid
memory access.

Handle error cases cleanly while processing open adapter.

Change-Id: If01d1018ddc3b9a17c4d059c30bcc3a424538c3e
CRs-Fixed: 1087824
Hanumanth Reddy Pothula 8 years ago
parent
commit
00a39e7519
1 changed files with 5 additions and 5 deletions
  1. 5 5
      core/hdd/src/wlan_hdd_main.c

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

@@ -3243,7 +3243,7 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
 		status = hdd_register_interface(adapter, rtnl_held);
 		if (QDF_STATUS_SUCCESS != status) {
 			hdd_deinit_adapter(hdd_ctx, adapter, rtnl_held);
-			goto err_lro_cleanup;
+			goto err_free_netdev;
 		}
 
 		/* Stop the Interface TX queue. */
@@ -3340,7 +3340,7 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
 		/* Initialize the WoWL service */
 		if (!hdd_init_wowl(adapter)) {
 			hdd_alert("hdd_init_wowl failed");
-			goto err_lro_cleanup;
+			goto err_close_adapter;
 		}
 
 		/* Adapter successfully added. Increment the vdev count */
@@ -3357,11 +3357,11 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
 
 	return adapter;
 
-err_lro_cleanup:
-	hdd_lro_disable(hdd_ctx, adapter);
+err_close_adapter:
+	hdd_close_adapter(hdd_ctx, adapter, rtnl_held);
 err_free_netdev:
-	free_netdev(adapter->dev);
 	wlan_hdd_release_intf_addr(hdd_ctx, adapter->macAddressCurrent.bytes);
+	free_netdev(adapter->dev);
 
 	return NULL;
 }