From c520d7fe8383100ecdcc2631ea91834054e5c3aa Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Fri, 19 Aug 2022 01:24:20 +0800 Subject: [PATCH] qcacmn: fix GFP flag for memory allocation As per implementation of might_sleep(), rcu_read_lock() nesting depth should be taken into consideration too to figure out whether sleeping is allowable or not. To make align with it, allocate memory with GFP_ATOMIC if rcu_read_lock() nesting depth is not zero. Change-Id: I83c042827db4024cedf4f043a4243e399a33f6e5 CRs-Fixed: 3272683 --- qdf/linux/src/qdf_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qdf/linux/src/qdf_mem.c b/qdf/linux/src/qdf_mem.c index d872724cda..258398327a 100644 --- a/qdf/linux/src/qdf_mem.c +++ b/qdf/linux/src/qdf_mem.c @@ -510,7 +510,7 @@ qdf_export_symbol(prealloc_disabled); int qdf_mem_malloc_flags(void) { - if (in_interrupt() || irqs_disabled() || in_atomic()) + if (in_interrupt() || !preemptible() || rcu_preempt_depth()) return GFP_ATOMIC; return GFP_KERNEL;