Browse Source

qcacmn: Fix race condition in enabling group interrupts

Fix race condition in initialising irq_enabled variable. Initialize it to
true before enabling interrupts.

Change-Id: I53a53ee729ca2dc54e47ac65a5bce00b0260f84e
CRs-Fixed: 2173907
Venkateswara Swamy Bandaru 7 years ago
parent
commit
ed9697f4aa
1 changed files with 8 additions and 5 deletions
  1. 8 5
      hif/src/hif_exec.c

+ 8 - 5
hif/src/hif_exec.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -295,13 +295,16 @@ uint32_t hif_configure_ext_group_interrupts(struct hif_opaque_softc *hif_ctx)
 	for (i = 0; i < hif_state->hif_num_extgroup; i++) {
 		hif_ext_group = hif_state->hif_ext_group[i];
 		status = 0;
+		qdf_spinlock_create(&hif_ext_group->irq_lock);
 		if (hif_ext_group->configured &&
-		    hif_ext_group->irq_requested == false)
+		    hif_ext_group->irq_requested == false) {
+			hif_ext_group->irq_enabled = true;
 			status = hif_grp_irq_configure(scn, hif_ext_group);
-		if (status != 0)
+		}
+		if (status != 0) {
 			HIF_ERROR("%s: failed for group %d", __func__, i);
-		qdf_spinlock_create(&hif_ext_group->irq_lock);
-		hif_ext_group->irq_enabled = true;
+			hif_ext_group->irq_enabled = false;
+		}
 	}
 
 	scn->ext_grp_irq_configured = true;