* [PATCH] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint()
@ 2020-06-22 9:06 Kaige Li
0 siblings, 0 replies; only message in thread
From: Kaige Li @ 2020-06-22 9:06 UTC (permalink / raw)
To: Christian Benvenuti, Govindarajulu Varadarajan
Cc: Tiezhu Yang, Xuefeng Li, Kaige Li, linux-mips, linux-kernel
The kernel module may sleep with holding a spinlock.
The function call paths (from bottom to top) are:
[FUNC] zalloc_cpumask_var(GFP_KERNEL)
drivers/net/ethernet/cisco/enic/enic_main.c, 125: zalloc_cpumask_var in enic_init_affinity_hint
drivers/net/ethernet/cisco/enic/enic_main.c, 1918: enic_init_affinity_hint in enic_open
drivers/net/ethernet/cisco/enic/enic_main.c, 2348: enic_open in enic_reset
drivers/net/ethernet/cisco/enic/enic_main.c, 2341: spin_lock in enic_reset
To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC.
Signed-off-by: Kaige Li <likaige@loongson.cn>
---
drivers/net/ethernet/cisco/enic/enic_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index cd5fe4f..ee62065 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -122,7 +122,7 @@ static void enic_init_affinity_hint(struct enic *enic)
!cpumask_empty(enic->msix[i].affinity_mask)))
continue;
if (zalloc_cpumask_var(&enic->msix[i].affinity_mask,
- GFP_KERNEL))
+ GFP_ATOMIC))
cpumask_set_cpu(cpumask_local_spread(i, numa_node),
enic->msix[i].affinity_mask);
}
--
2.1.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-22 9:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 9:06 [PATCH] net/cisco: Fix a sleep-in-atomic-context bug in enic_init_affinity_hint() Kaige Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).