Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: ipvs: prefer skb_ensure_writable

It does the same thing, use it instead so we can remove skb_make_writable.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Florian Westphal and committed by
Pablo Neira Ayuso
ec0974df c1a83116

+18 -18
+2 -2
net/netfilter/ipvs/ip_vs_app.c
··· 363 363 struct tcphdr *th; 364 364 __u32 seq; 365 365 366 - if (!skb_make_writable(skb, tcp_offset + sizeof(*th))) 366 + if (skb_ensure_writable(skb, tcp_offset + sizeof(*th))) 367 367 return 0; 368 368 369 369 th = (struct tcphdr *)(skb_network_header(skb) + tcp_offset); ··· 440 440 struct tcphdr *th; 441 441 __u32 seq; 442 442 443 - if (!skb_make_writable(skb, tcp_offset + sizeof(*th))) 443 + if (skb_ensure_writable(skb, tcp_offset + sizeof(*th))) 444 444 return 0; 445 445 446 446 th = (struct tcphdr *)(skb_network_header(skb) + tcp_offset);
+2 -2
net/netfilter/ipvs/ip_vs_core.c
··· 898 898 if (IPPROTO_TCP == protocol || IPPROTO_UDP == protocol || 899 899 IPPROTO_SCTP == protocol) 900 900 offset += 2 * sizeof(__u16); 901 - if (!skb_make_writable(skb, offset)) 901 + if (skb_ensure_writable(skb, offset)) 902 902 goto out; 903 903 904 904 #ifdef CONFIG_IP_VS_IPV6 ··· 1288 1288 1289 1289 IP_VS_DBG_PKT(11, af, pp, skb, iph->off, "Outgoing packet"); 1290 1290 1291 - if (!skb_make_writable(skb, iph->len)) 1291 + if (skb_ensure_writable(skb, iph->len)) 1292 1292 goto drop; 1293 1293 1294 1294 /* mangle the packet */
+2 -2
net/netfilter/ipvs/ip_vs_ftp.c
··· 273 273 return 1; 274 274 275 275 /* Linear packets are much easier to deal with. */ 276 - if (!skb_make_writable(skb, skb->len)) 276 + if (skb_ensure_writable(skb, skb->len)) 277 277 return 0; 278 278 279 279 if (cp->app_data == (void *) IP_VS_FTP_PASV) { ··· 439 439 return 1; 440 440 441 441 /* Linear packets are much easier to deal with. */ 442 - if (!skb_make_writable(skb, skb->len)) 442 + if (skb_ensure_writable(skb, skb->len)) 443 443 return 0; 444 444 445 445 data = data_start = ip_vs_ftp_data_ptr(skb, ipvsh);
+2 -2
net/netfilter/ipvs/ip_vs_proto_sctp.c
··· 101 101 #endif 102 102 103 103 /* csum_check requires unshared skb */ 104 - if (!skb_make_writable(skb, sctphoff + sizeof(*sctph))) 104 + if (skb_ensure_writable(skb, sctphoff + sizeof(*sctph))) 105 105 return 0; 106 106 107 107 if (unlikely(cp->app != NULL)) { ··· 148 148 #endif 149 149 150 150 /* csum_check requires unshared skb */ 151 - if (!skb_make_writable(skb, sctphoff + sizeof(*sctph))) 151 + if (skb_ensure_writable(skb, sctphoff + sizeof(*sctph))) 152 152 return 0; 153 153 154 154 if (unlikely(cp->app != NULL)) {
+2 -2
net/netfilter/ipvs/ip_vs_proto_tcp.c
··· 163 163 oldlen = skb->len - tcphoff; 164 164 165 165 /* csum_check requires unshared skb */ 166 - if (!skb_make_writable(skb, tcphoff+sizeof(*tcph))) 166 + if (skb_ensure_writable(skb, tcphoff + sizeof(*tcph))) 167 167 return 0; 168 168 169 169 if (unlikely(cp->app != NULL)) { ··· 241 241 oldlen = skb->len - tcphoff; 242 242 243 243 /* csum_check requires unshared skb */ 244 - if (!skb_make_writable(skb, tcphoff+sizeof(*tcph))) 244 + if (skb_ensure_writable(skb, tcphoff + sizeof(*tcph))) 245 245 return 0; 246 246 247 247 if (unlikely(cp->app != NULL)) {
+2 -2
net/netfilter/ipvs/ip_vs_proto_udp.c
··· 153 153 oldlen = skb->len - udphoff; 154 154 155 155 /* csum_check requires unshared skb */ 156 - if (!skb_make_writable(skb, udphoff+sizeof(*udph))) 156 + if (skb_ensure_writable(skb, udphoff + sizeof(*udph))) 157 157 return 0; 158 158 159 159 if (unlikely(cp->app != NULL)) { ··· 236 236 oldlen = skb->len - udphoff; 237 237 238 238 /* csum_check requires unshared skb */ 239 - if (!skb_make_writable(skb, udphoff+sizeof(*udph))) 239 + if (skb_ensure_writable(skb, udphoff + sizeof(*udph))) 240 240 return 0; 241 241 242 242 if (unlikely(cp->app != NULL)) {
+6 -6
net/netfilter/ipvs/ip_vs_xmit.c
··· 279 279 } 280 280 281 281 /* don't propagate ttl change to cloned packets */ 282 - if (!skb_make_writable(skb, sizeof(struct ipv6hdr))) 282 + if (skb_ensure_writable(skb, sizeof(struct ipv6hdr))) 283 283 return false; 284 284 285 285 ipv6_hdr(skb)->hop_limit--; ··· 294 294 } 295 295 296 296 /* don't propagate ttl change to cloned packets */ 297 - if (!skb_make_writable(skb, sizeof(struct iphdr))) 297 + if (skb_ensure_writable(skb, sizeof(struct iphdr))) 298 298 return false; 299 299 300 300 /* Decrease ttl */ ··· 796 796 } 797 797 798 798 /* copy-on-write the packet before mangling it */ 799 - if (!skb_make_writable(skb, sizeof(struct iphdr))) 799 + if (skb_ensure_writable(skb, sizeof(struct iphdr))) 800 800 goto tx_error; 801 801 802 802 if (skb_cow(skb, rt->dst.dev->hard_header_len)) ··· 885 885 } 886 886 887 887 /* copy-on-write the packet before mangling it */ 888 - if (!skb_make_writable(skb, sizeof(struct ipv6hdr))) 888 + if (skb_ensure_writable(skb, sizeof(struct ipv6hdr))) 889 889 goto tx_error; 890 890 891 891 if (skb_cow(skb, rt->dst.dev->hard_header_len)) ··· 1404 1404 } 1405 1405 1406 1406 /* copy-on-write the packet before mangling it */ 1407 - if (!skb_make_writable(skb, offset)) 1407 + if (skb_ensure_writable(skb, offset)) 1408 1408 goto tx_error; 1409 1409 1410 1410 if (skb_cow(skb, rt->dst.dev->hard_header_len)) ··· 1493 1493 } 1494 1494 1495 1495 /* copy-on-write the packet before mangling it */ 1496 - if (!skb_make_writable(skb, offset)) 1496 + if (skb_ensure_writable(skb, offset)) 1497 1497 goto tx_error; 1498 1498 1499 1499 if (skb_cow(skb, rt->dst.dev->hard_header_len))