Commit 6ccbda44 authored by Cong Wang's avatar Cong Wang Committed by Jakub Kicinski
Browse files

net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too



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: 1da177e4 ("Linux-2.6.12-rc2")
Reported-by: default avatarGerrard Tai <gerrard.tai@starlabs.sg>
Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20250417184732.943057-3-xiyou.wangcong@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 3df275ef
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1641,10 +1641,16 @@ hfsc_dequeue(struct Qdisc *sch)
		if (cl->qdisc->q.qlen != 0) {
			/* update ed */
			next_len = qdisc_peek_len(cl->qdisc);
			/* Check queue length again since some qdisc implementations
			 * (e.g., netem/codel) might empty the queue during the peek
			 * operation.
			 */
			if (cl->qdisc->q.qlen != 0) {
				if (realtime)
					update_ed(cl, next_len);
				else
					update_d(cl, next_len);
			}
		} else {
			/* the class becomes passive */
			eltree_remove(cl);