Skip to content

Commit a85dc5e

Browse files
committed
net: sched: sch_multiq: fix possible OOB write in multiq_tune()
jira VULN-5452 cve CVE-2024-36978 commit-author Hangyu Hua <hbh25y@gmail.com> commit affc18f q->bands will be assigned to qopt->bands to execute subsequent code logic after kmalloc. So the old q->bands should not be used in kmalloc. Otherwise, an out-of-bounds write will occur. Fixes: c2999f7 ("net: sched: multiq: don't call qdisc_put() while holding tree lock") Signed-off-by: Hangyu Hua <hbh25y@gmail.com> Acked-by: Cong Wang <cong.wang@bytedance.com> Signed-off-by: David S. Miller <davem@davemloft.net> (cherry picked from commit affc18f) Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
1 parent a2da756 commit a85dc5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sched/sch_multiq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
186186

187187
qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
188188

189-
removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands),
189+
removed = kmalloc(sizeof(*removed) * (q->max_bands - qopt->bands),
190190
GFP_KERNEL);
191191
if (!removed)
192192
return -ENOMEM;

0 commit comments

Comments
 (0)