Skip to content

Commit

Permalink
[PKTGEN]: Sleeping function called under lock
Browse files Browse the repository at this point in the history
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 <shemminger@osdl.org>
Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
  • Loading branch information
Stephen Hemminger authored and Arnaldo Carvalho de Melo committed Oct 26, 2005
1 parent 670c02c commit b7c8921
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions net/core/pktgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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];
Expand Down

0 comments on commit b7c8921

Please sign in to comment.