Jelajahi Sumber

qcacld-3.0: Mem zero dynamic fields only in dp_prealloc_deinit

As per current driver implementation, whenever we load the wlan
driver, we initialize the dp_prealloc structs with default values,
which are used by dp_prealloc_init to allocate memory and during
driver unload, in the function dp_prealloc_deinit, after freeing
the allocated memory, we mem_zero the dp_prealloc structures.
Unfortunately, this zeros both the static and dynamic content.

In case of soft driver unload/load, where we internally
de-init/init the wlan driver, dp_prealloc_init fails because
we now don't know size of memory to be allocated. That info
was part of the static memory that had been zeroed during
deinit.

To address this issue, only zero the dynamic fields of
dp_prealloc structs in dp_prealloc_deinit.

Change-Id: If450d426ee655f6c2b32febdd001ab6d5489b51e
CRs-Fixed: 3174685
Aditya Kodukula 3 tahun lalu
induk
melakukan
b1e0b17591
1 mengubah file dengan 10 tambahan dan 3 penghapusan
  1. 10 3
      core/dp/txrx3.0/dp_txrx.c

+ 10 - 3
core/dp/txrx3.0/dp_txrx.c

@@ -510,7 +510,11 @@ void dp_prealloc_deinit(void)
 						p->size,
 						p->va_unaligned,
 						p->pa_unaligned, 0);
-			qdf_mem_zero(p, sizeof(*p));
+			p->in_use = false;
+			p->va_unaligned = NULL;
+			p->va_aligned = NULL;
+			p->pa_unaligned = 0;
+			p->pa_aligned = 0;
 		}
 	}
 
@@ -528,7 +532,8 @@ void dp_prealloc_deinit(void)
 				mp->pages.num_pages);
 			qdf_mem_multi_pages_free(qdf_ctx, &mp->pages,
 						 0, mp->cacheable);
-			qdf_mem_zero(mp, sizeof(*mp));
+			mp->in_use = false;
+			qdf_mem_zero(&mp->pages, sizeof(mp->pages));
 		}
 	}
 
@@ -546,7 +551,9 @@ void dp_prealloc_deinit(void)
 						up->size,
 						up->va_unaligned,
 						up->pa_unaligned, 0);
-			qdf_mem_zero(up, sizeof(*up));
+			up->in_use = false;
+			up->va_unaligned = NULL;
+			up->pa_unaligned = 0;
 		}
 	}