Commit 11b7331
sch_netem: fix issues in netem_change() vs get_dist_table()
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: 2174a08 ("sch_netem: acquire qdisc lock in netem_change()")
Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/20230622181503.2327695-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>1 parent eb44128 commit 11b7331
1 file changed
Lines changed: 25 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
773 | 773 | | |
774 | 774 | | |
775 | 775 | | |
776 | | - | |
777 | | - | |
| 776 | + | |
778 | 777 | | |
779 | 778 | | |
780 | 779 | | |
781 | | - | |
782 | 780 | | |
783 | 781 | | |
784 | 782 | | |
| |||
793 | 791 | | |
794 | 792 | | |
795 | 793 | | |
796 | | - | |
797 | | - | |
798 | | - | |
799 | | - | |
800 | | - | |
801 | | - | |
802 | | - | |
| 794 | + | |
803 | 795 | | |
804 | 796 | | |
805 | 797 | | |
| |||
956 | 948 | | |
957 | 949 | | |
958 | 950 | | |
| 951 | + | |
| 952 | + | |
959 | 953 | | |
960 | 954 | | |
961 | 955 | | |
| |||
966 | 960 | | |
967 | 961 | | |
968 | 962 | | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
969 | 975 | | |
970 | 976 | | |
971 | 977 | | |
| |||
975 | 981 | | |
976 | 982 | | |
977 | 983 | | |
| 984 | + | |
978 | 985 | | |
979 | 986 | | |
980 | 987 | | |
981 | 988 | | |
982 | 989 | | |
983 | 990 | | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | | - | |
997 | | - | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
998 | 995 | | |
999 | 996 | | |
1000 | 997 | | |
| |||
1044 | 1041 | | |
1045 | 1042 | | |
1046 | 1043 | | |
1047 | | - | |
1048 | 1044 | | |
1049 | | - | |
1050 | | - | |
1051 | | - | |
1052 | | - | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
1058 | 1049 | | |
1059 | 1050 | | |
1060 | 1051 | | |
| |||
0 commit comments