Re: [PATCH] ASoC: Intel: sst: fix kmalloc call with wrong flags

From: Curtis Malainey
Date: Fri Jun 07 2019 - 18:31:45 EST


On Fri, Jun 7, 2019 at 3:19 PM Alex Levin <levinale@xxxxxxxxxxxx> wrote:
>
> When calling kmalloc with GFP_KERNEL in case CONFIG_SLOB is unset,
> kmem_cache_alloc_trace is called.
>
> In case CONFIG_TRACING is set, kmem_cache_alloc_trace will ball
nit: *call
> slab_alloc, which will call slab_pre_alloc_hook which might_sleep_if.
>
> The context in which it is called in this case, the
> intel_sst_interrupt_mrfld, calling a sleeping kmalloc generates a BUG():
>
> Fixes: 972b0d456e64 ("ASoC: Intel: remove GFP_ATOMIC, use GFP_KERNEL")
>
> [ 20.250671] BUG: sleeping function called from invalid context at mm/slab.h:422
> [ 20.250683] in_atomic(): 1, irqs_disabled(): 1, pid: 1791, name: Chrome_IOThread
> [ 20.250690] CPU: 0 PID: 1791 Comm: Chrome_IOThread Tainted: G W 4.19.43 #61
> [ 20.250693] Hardware name: GOOGLE Kefka, BIOS Google_Kefka.7287.337.0 03/02/2017
> [ 20.250893] R10: 0000562dd1064d30 R11: 00003c8cc825b908 R12: 00003c8cc966d3c0
> [ 20.250896] R13: 00003c8cc9e280c0 R14: 0000000000000000 R15: 0000000000000000
>
> Signed-off-by: Alex Levin <levinale@xxxxxxxxxxxx>
Reviewed-by: Curtis Malainey <cujomalainey@xxxxxxxxxxxx>
> ---
>