diff options
author | Budimir Markovic <markovicbudimir@gmail.com> | 2023-08-24 01:49:05 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-08-25 18:57:54 -0700 |
commit | b3d26c5702c7d6c45456326e56d2ccf3f103e60f (patch) | |
tree | 2eccdcba9fa443c15c89918ca1a3c99e0532beb5 /net/sched | |
parent | c4413a20fa6d7c4888009fb7dd391685f196cd36 (diff) | |
download | linux-b3d26c5702c7d6c45456326e56d2ccf3f103e60f.tar.gz linux-b3d26c5702c7d6c45456326e56d2ccf3f103e60f.tar.bz2 linux-b3d26c5702c7d6c45456326e56d2ccf3f103e60f.zip |
net/sched: sch_hfsc: Ensure inner classes have fsc curve
HFSC assumes that inner classes have an fsc curve, but it is currently
possible for classes without an fsc curve to become parents. This leads
to bugs including a use-after-free.
Don't allow non-root classes without HFSC_FSC to become parents.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Budimir Markovic <markovicbudimir@gmail.com>
Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://lore.kernel.org/r/20230824084905.422-1-markovicbudimir@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/sch_hfsc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 70b0c5873d32..61d52594ff6d 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c @@ -1012,6 +1012,10 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, if (parent == NULL) return -ENOENT; } + if (!(parent->cl_flags & HFSC_FSC) && parent != &q->root) { + NL_SET_ERR_MSG(extack, "Invalid parent - parent class must have FSC"); + return -EINVAL; + } if (classid == 0 || TC_H_MAJ(classid ^ sch->handle) != 0) return -EINVAL; |