Skip to content

Commit 15d2bac

Browse files
Andrew MortonLinus Torvalds
authored andcommitted
[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" <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 2ca7d93 commit 15d2bac

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/timer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ extern unsigned long next_timer_interrupt(void);
7878
* Timers with an ->expired field in the past will be executed in the next
7979
* timer tick.
8080
*/
81-
static inline void add_timer(struct timer_list * timer)
81+
static inline void add_timer(struct timer_list *timer)
8282
{
83+
BUG_ON(timer_pending(timer));
8384
__mod_timer(timer, timer->expires);
8485
}
8586

0 commit comments

Comments
 (0)