diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index c4c0d760d2527984a59fcdcf330117156c2a18fe..f2a636e7acc46ea3d54b3c0c9f856b46f6bf7374 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1527,8 +1527,12 @@ static void enqueue_task_dl(struct rq *rq, struct task_struct *p, int flags) * The replenish timer needs to be canceled. No * problem if it fires concurrently: boosted threads * are ignored in dl_task_timer(). + * + * If the timer callback was running (hrtimer_try_to_cancel == -1), + * it will eventually call put_task_struct(). */ - hrtimer_try_to_cancel(&p->dl.dl_timer); + if (hrtimer_try_to_cancel(&p->dl.dl_timer) == 1) + put_task_struct(p); p->dl.dl_throttled = 0; } } else if (!dl_prio(p->normal_prio)) {