Skip to content

Commit 52d15e9

Browse files
HBh25YSasha Levin
authored andcommitted
net: sched: sch_multiq: fix possible OOB write in multiq_tune()
[ Upstream 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 <[email protected]> Acked-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent dd759bb commit 52d15e9

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
@@ -185,7 +185,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
185185

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

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

0 commit comments

Comments
 (0)