mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-05 17:05:21 +02:00
UPSTREAM: net: sched: sch_multiq: fix possible OOB write in multiq_tune()
[ Upstream commitaffc18fdc6
] 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. Bug: 349777785 Fixes:c2999f7fb0
("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> Signed-off-by: Sasha Levin <sashal@kernel.org> (cherry picked from commit 0f208fad86631e005754606c3ec80c0d44a11882) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: Iec8413c39878596795420ae58bbe6974890cf2de
This commit is contained in:
parent
30cb122068
commit
77a8b2e3a1
|
@ -185,7 +185,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt,
|
|||
|
||||
qopt->bands = qdisc_dev(sch)->real_num_tx_queues;
|
||||
|
||||
removed = kmalloc(sizeof(*removed) * (q->max_bands - q->bands),
|
||||
removed = kmalloc(sizeof(*removed) * (q->max_bands - qopt->bands),
|
||||
GFP_KERNEL);
|
||||
if (!removed)
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Reference in New Issue
Block a user