Commit f11cb2c2aa1ba28091910eaecaa40906ec31101a
Committed by
Pablo Neira Ayuso
1 parent
183dce554a
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
ipvs: do not use skb_share_check
We run in contexts like ip_rcv, ipv6_rcv, br_handle_frame, do not expect shared skbs. Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off by: Hans Schillstrom <hans@schillstrom.com> Signed-off-by: Simon Horman <horms@verge.net.au>
Showing 1 changed file with 2 additions and 43 deletions Side-by-side Diff
net/netfilter/ipvs/ip_vs_xmit.c
... | ... | @@ -421,14 +421,6 @@ |
421 | 421 | goto tx_error; |
422 | 422 | } |
423 | 423 | |
424 | - /* | |
425 | - * Call ip_send_check because we are not sure it is called | |
426 | - * after ip_defrag. Is copy-on-write needed? | |
427 | - */ | |
428 | - if (unlikely((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)) { | |
429 | - ip_rt_put(rt); | |
430 | - return NF_STOLEN; | |
431 | - } | |
432 | 424 | ip_send_check(ip_hdr(skb)); |
433 | 425 | |
434 | 426 | /* drop old route */ |
... | ... | @@ -482,16 +474,6 @@ |
482 | 474 | goto tx_error; |
483 | 475 | } |
484 | 476 | |
485 | - /* | |
486 | - * Call ip_send_check because we are not sure it is called | |
487 | - * after ip_defrag. Is copy-on-write needed? | |
488 | - */ | |
489 | - skb = skb_share_check(skb, GFP_ATOMIC); | |
490 | - if (unlikely(skb == NULL)) { | |
491 | - dst_release(&rt->dst); | |
492 | - return NF_STOLEN; | |
493 | - } | |
494 | - | |
495 | 477 | /* drop old route */ |
496 | 478 | skb_dst_drop(skb); |
497 | 479 | skb_dst_set(skb, &rt->dst); |
... | ... | @@ -708,7 +690,6 @@ |
708 | 690 | ipv6_hdr(skb)->daddr = cp->daddr.in6; |
709 | 691 | |
710 | 692 | if (!local || !skb->dev) { |
711 | - /* drop the old route when skb is not shared */ | |
712 | 693 | skb_dst_drop(skb); |
713 | 694 | skb_dst_set(skb, &rt->dst); |
714 | 695 | } else { |
... | ... | @@ -814,8 +795,7 @@ |
814 | 795 | */ |
815 | 796 | max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct iphdr); |
816 | 797 | |
817 | - if (skb_headroom(skb) < max_headroom | |
818 | - || skb_cloned(skb) || skb_shared(skb)) { | |
798 | + if (skb_headroom(skb) < max_headroom || skb_cloned(skb)) { | |
819 | 799 | struct sk_buff *new_skb = |
820 | 800 | skb_realloc_headroom(skb, max_headroom); |
821 | 801 | if (!new_skb) { |
... | ... | @@ -935,8 +915,7 @@ |
935 | 915 | */ |
936 | 916 | max_headroom = LL_RESERVED_SPACE(tdev) + sizeof(struct ipv6hdr); |
937 | 917 | |
938 | - if (skb_headroom(skb) < max_headroom | |
939 | - || skb_cloned(skb) || skb_shared(skb)) { | |
918 | + if (skb_headroom(skb) < max_headroom || skb_cloned(skb)) { | |
940 | 919 | struct sk_buff *new_skb = |
941 | 920 | skb_realloc_headroom(skb, max_headroom); |
942 | 921 | if (!new_skb) { |
... | ... | @@ -1034,14 +1013,6 @@ |
1034 | 1013 | goto tx_error; |
1035 | 1014 | } |
1036 | 1015 | |
1037 | - /* | |
1038 | - * Call ip_send_check because we are not sure it is called | |
1039 | - * after ip_defrag. Is copy-on-write needed? | |
1040 | - */ | |
1041 | - if (unlikely((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)) { | |
1042 | - ip_rt_put(rt); | |
1043 | - return NF_STOLEN; | |
1044 | - } | |
1045 | 1016 | ip_send_check(ip_hdr(skb)); |
1046 | 1017 | |
1047 | 1018 | /* drop old route */ |
... | ... | @@ -1099,16 +1070,6 @@ |
1099 | 1070 | goto tx_error; |
1100 | 1071 | } |
1101 | 1072 | |
1102 | - /* | |
1103 | - * Call ip_send_check because we are not sure it is called | |
1104 | - * after ip_defrag. Is copy-on-write needed? | |
1105 | - */ | |
1106 | - skb = skb_share_check(skb, GFP_ATOMIC); | |
1107 | - if (unlikely(skb == NULL)) { | |
1108 | - dst_release(&rt->dst); | |
1109 | - return NF_STOLEN; | |
1110 | - } | |
1111 | - | |
1112 | 1073 | /* drop old route */ |
1113 | 1074 | skb_dst_drop(skb); |
1114 | 1075 | skb_dst_set(skb, &rt->dst); |
... | ... | @@ -1220,7 +1181,6 @@ |
1220 | 1181 | ip_vs_nat_icmp(skb, pp, cp, 0); |
1221 | 1182 | |
1222 | 1183 | if (!local) { |
1223 | - /* drop the old route when skb is not shared */ | |
1224 | 1184 | skb_dst_drop(skb); |
1225 | 1185 | skb_dst_set(skb, &rt->dst); |
1226 | 1186 | } else |
... | ... | @@ -1337,7 +1297,6 @@ |
1337 | 1297 | ip_vs_nat_icmp_v6(skb, pp, cp, 0); |
1338 | 1298 | |
1339 | 1299 | if (!local || !skb->dev) { |
1340 | - /* drop the old route when skb is not shared */ | |
1341 | 1300 | skb_dst_drop(skb); |
1342 | 1301 | skb_dst_set(skb, &rt->dst); |
1343 | 1302 | } else { |