From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 12/15] netfilter: xt_HL: prefer skb_ensure_writable
Date: Sat, 1 Jun 2019 20:23:37 +0200 [thread overview]
Message-ID: <20190601182340.2662-13-pablo@netfilter.org> (raw)
In-Reply-To: <20190601182340.2662-1-pablo@netfilter.org>
From: Florian Westphal <fw@strlen.de>
Also, make the argument to be only the needed size of the header
we're altering, no need to pull in the full packet into linear area.
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/xt_HL.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/netfilter/xt_HL.c b/net/netfilter/xt_HL.c
index 4653b071bed4..a37b8824221f 100644
--- a/net/netfilter/xt_HL.c
+++ b/net/netfilter/xt_HL.c
@@ -32,7 +32,7 @@ ttl_tg(struct sk_buff *skb, const struct xt_action_param *par)
const struct ipt_TTL_info *info = par->targinfo;
int new_ttl;
- if (!skb_make_writable(skb, skb->len))
+ if (skb_ensure_writable(skb, sizeof(*iph)))
return NF_DROP;
iph = ip_hdr(skb);
@@ -72,7 +72,7 @@ hl_tg6(struct sk_buff *skb, const struct xt_action_param *par)
const struct ip6t_HL_info *info = par->targinfo;
int new_hl;
- if (!skb_make_writable(skb, skb->len))
+ if (skb_ensure_writable(skb, sizeof(*ip6h)))
return NF_DROP;
ip6h = ipv6_hdr(skb);
--
2.11.0
next prev parent reply other threads:[~2019-06-01 18:24 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-01 18:23 [PATCH 00/15] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 01/15] ipvs: allow rs_table to contain different real server types Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 02/15] ipvs: add function to find tunnels Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 03/15] ipvs: strip udp tunnel headers from icmp errors Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 04/15] netfilter: xt_owner: Add supplementary groups option Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 05/15] netfilter: nf_flow_table: remove unnecessary variable in flow_offload_tuple Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 06/15] netfilter: nf_tables: free base chain counters from worker Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 07/15] netfilter: bridge: convert skb_make_writable to skb_ensure_writable Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 08/15] netfilter: ipvs: prefer skb_ensure_writable Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 09/15] netfilter: conntrack, nat: " Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 10/15] netfilter: ipv4: " Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 11/15] netfilter: nf_tables: " Pablo Neira Ayuso
2019-06-01 18:23 ` Pablo Neira Ayuso [this message]
2019-06-01 18:23 ` [PATCH 13/15] netfilter: tcpmss, optstrip: " Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 14/15] netfilter: replace skb_make_writable with skb_ensure_writable Pablo Neira Ayuso
2019-06-01 18:23 ` [PATCH 15/15] ipvs: add checksum support for gue encapsulation Pablo Neira Ayuso
2019-06-01 23:45 ` [PATCH 00/15] Netfilter/IPVS updates for net-next David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190601182340.2662-13-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).