Skip to content

Commit ed8157f

Browse files
Du Chengdavem330
authored andcommitted
net: sched: tapr: prevent cycle_time == 0 in parse_taprio_schedule
There is a reproducible sequence from the userland that will trigger a WARN_ON() condition in taprio_get_start_time, which causes kernel to panic if configured as "panic_on_warn". Catch this condition in parse_taprio_schedule to prevent this condition. Reported as bug on syzkaller: https://syzkaller.appspot.com/bug?extid=d50710fd0873a9c6b40c Reported-by: syzbot+d50710fd0873a9c6b40c@syzkaller.appspotmail.com Signed-off-by: Du Cheng <ducheng2@gmail.com> Acked-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent e16edc9 commit ed8157f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

net/sched/sch_taprio.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,6 +901,12 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
901901

902902
list_for_each_entry(entry, &new->entries, list)
903903
cycle = ktime_add_ns(cycle, entry->interval);
904+
905+
if (!cycle) {
906+
NL_SET_ERR_MSG(extack, "'cycle_time' can never be 0");
907+
return -EINVAL;
908+
}
909+
904910
new->cycle_time = cycle;
905911
}
906912

0 commit comments

Comments
 (0)