Commit 820892db authored by Eric Dumazet's avatar Eric Dumazet Committed by Ziyang Xuan
Browse files

sch_netem: fix issues in netem_change() vs get_dist_table()

stable inclusion
from stable-v5.10.191
commit 3b55ce96efc5e6722d8374e04d9f721cc29e4d4b
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I80FL9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3b55ce96efc5e6722d8374e04d9f721cc29e4d4b



--------------------------------

commit 11b73313 upstream.

In blamed commit, I missed that get_dist_table() was allocating
memory using GFP_KERNEL, and acquiring qdisc lock to perform
the swap of newly allocated table with current one.

In this patch, get_dist_table() is allocating memory and
copy user data before we acquire the qdisc lock.

Then we perform swap operations while being protected by the lock.

Note that after this patch netem_change() no longer can do partial changes.
If an error is returned, qdisc conf is left unchanged.

Fixes: 2174a08d ("sch_netem: acquire qdisc lock in netem_change()")
Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230622181503.2327695-1-edumazet@google.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
parent 42d7d2ee
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment