UPSTREAM: net/sched: sch_hfsc: Ensure inner classes have fsc curve
[ Upstream commit b3d26c5702c7d6c45456326e56d2ccf3f103e60f ]
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.
Bug: 299921101
Fixes: 1da177e4c3
("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
(cherry picked from commit 4cf994d3f4ff42d604fae2b461bdd5195a7dfabd)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I5b44ae6bb340b978372ed9657ba2e23f75b850e5
This commit is contained in:
parent
ca2edd4a03
commit
9f659ee1e9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user