From 4c6a8a9123ee3cde774dbdea191291338b510708 Mon Sep 17 00:00:00 2001 From: Sravan Kumar Kairam Date: Sat, 19 Jan 2019 15:55:08 +0530 Subject: [PATCH] qcacmn: Zero out the memory of hal shadow pointers Currently hal shadow pointers after memory allocation are not memset to zero. In case of SMMU S1 enable when host starts to access hal srng the random value of shadow memory is copied to host cached values which leads to accessing the rings even when HW has not updated to it. So zero out the memory of hal shadow ring pointers after memory allocation. Change-Id: I10ac6bfff957e953ee9caa15056ce3fa9d57b70e CRs-Fixed: 2368491 --- hal/wifi3.0/hal_srng.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hal/wifi3.0/hal_srng.c b/hal/wifi3.0/hal_srng.c index 9af562086f..aabfffdb1a 100644 --- a/hal/wifi3.0/hal_srng.c +++ b/hal/wifi3.0/hal_srng.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 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 @@ -311,6 +311,8 @@ void *hal_attach(void *hif_handle, qdf_device_t qdf_dev) __func__); goto fail1; } + qdf_mem_zero(hal->shadow_rdptr_mem_vaddr, + sizeof(*(hal->shadow_rdptr_mem_vaddr)) * HAL_SRNG_ID_MAX); hal->shadow_wrptr_mem_vaddr = (uint32_t *)qdf_mem_alloc_consistent(qdf_dev, qdf_dev->dev, @@ -322,6 +324,8 @@ void *hal_attach(void *hif_handle, qdf_device_t qdf_dev) __func__); goto fail2; } + qdf_mem_zero(hal->shadow_wrptr_mem_vaddr, + sizeof(*(hal->shadow_wrptr_mem_vaddr)) * HAL_MAX_LMAC_RINGS); for (i = 0; i < HAL_SRNG_ID_MAX; i++) { hal->srng_list[i].initialized = 0;