From: Stephen Hemminger Date: Fri, 14 Oct 2005 22:26:34 +0000 (-0700) Subject: [PKTGEN]: Sleeping function called under lock X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b7c8921bf1a8a9c1907b1eeb029d3f167be226f3;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PKTGEN]: Sleeping function called under lock pktgen is calling kmalloc GFP_KERNEL and vmalloc with lock held. The simplest fix is to turn the lock into a semaphore, since the thread lock is only used for admin control from user context. Signed-off-by: Stephen Hemminger Signed-off-by: Robert Olsson Signed-off-by: David S. Miller Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 00116d8b3b28..8a90bf79261a 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -177,8 +177,8 @@ #define T_REMDEV (1<<3) /* Remove all devs */ /* Locks */ -#define thread_lock() spin_lock(&_thread_lock) -#define thread_unlock() spin_unlock(&_thread_lock) +#define thread_lock() down(&pktgen_sem) +#define thread_unlock() up(&pktgen_sem) /* If lock -- can be removed after some work */ #define if_lock(t) spin_lock(&(t->if_lock)); @@ -503,7 +503,7 @@ static int pg_delay_d = 0; static int pg_clone_skb_d = 0; static int debug = 0; -static DEFINE_SPINLOCK(_thread_lock); +static DECLARE_MUTEX(pktgen_sem); static struct pktgen_thread *pktgen_threads = NULL; static char module_fname[128];