Преглед на файлове

qcacld-3.0: Check pointer from a function whether is NULL

Check pointer adapter returned from function which maybe NULL,
and explicitly dereferenced error.

Change-Id: Iaaf4bdfb145a146452a5925ac39483e32ed8955e
CRs-Fixed: 3454288
chunquan luo преди 2 години
родител
ревизия
c671d25226
променени са 1 файла, в които са добавени 5 реда и са изтрити 0 реда
  1. 5 0
      core/hdd/src/wlan_hdd_main.c

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

@@ -6299,6 +6299,11 @@ static int hdd_vdev_destroy_event_wait(struct hdd_context *hdd_ctx,
 
 	vdev_id = wlan_vdev_get_id(vdev);
 	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter) {
+		hdd_err("adapter is NULL, return");
+		return -EINVAL;
+	}
+
 	/* close sme session (destroy vdev in firmware via legacy API) */
 	INIT_COMPLETION(adapter->deflink->vdev_destroy_event);
 	status = sme_vdev_delete(hdd_ctx->mac_handle, vdev);