Skip to content

Commit cdbe8fa

Browse files
congwangsfX-bot
authored andcommitted
net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too
[ Upstream commit 6ccbda44e2cc3d26fd22af54c650d6d5d801addf ] Similarly to the previous patch, we need to safe guard hfsc_dequeue() too. But for this one, we don't have a reliable reproducer. Fixes: 1da177e ("Linux-2.6.12-rc2") Reported-by: Gerrard Tai <[email protected]> Signed-off-by: Cong Wang <[email protected]> Reviewed-by: Jamal Hadi Salim <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent f7be39e commit cdbe8fa

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

net/sched/sch_hfsc.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,10 +1633,16 @@ hfsc_dequeue(struct Qdisc *sch)
16331633
if (cl->qdisc->q.qlen != 0) {
16341634
/* update ed */
16351635
next_len = qdisc_peek_len(cl->qdisc);
1636-
if (realtime)
1637-
update_ed(cl, next_len);
1638-
else
1639-
update_d(cl, next_len);
1636+
/* Check queue length again since some qdisc implementations
1637+
* (e.g., netem/codel) might empty the queue during the peek
1638+
* operation.
1639+
*/
1640+
if (cl->qdisc->q.qlen != 0) {
1641+
if (realtime)
1642+
update_ed(cl, next_len);
1643+
else
1644+
update_d(cl, next_len);
1645+
}
16401646
} else {
16411647
/* the class becomes passive */
16421648
eltree_remove(cl);

0 commit comments

Comments
 (0)