From: Andrew Morton Date: Sun, 30 Oct 2005 23:02:24 +0000 (-0800) Subject: [PATCH] add_timer() of a pending timer is illegal X-Git-Tag: v2.6.15-rc1~59^2~15^2~92 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=15d2bace5ec907530a3d0e0cf4bb1bd29f3ad7b7;p=linux-2.6 [PATCH] add_timer() of a pending timer is illegal In the recent timer rework we lost the check for an add_timer() of an already-pending timer. That check was useful for networking, so put it back. Cc: "David S. Miller" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/timer.h b/include/linux/timer.h index b1dc583bb4..72f3a77811 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -78,8 +78,9 @@ extern unsigned long next_timer_interrupt(void); * Timers with an ->expired field in the past will be executed in the next * timer tick. */ -static inline void add_timer(struct timer_list * timer) +static inline void add_timer(struct timer_list *timer) { + BUG_ON(timer_pending(timer)); __mod_timer(timer, timer->expires); }