diff options
author | Julian Anastasov <ja@ssi.bg> | 2011-05-29 16:42:29 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2011-06-05 19:36:46 -0400 |
commit | d9be76f38526dccf84062e3ac3ed3a6a97698565 (patch) | |
tree | cc819ad8ffd4f11bf916d624010863d978874b30 /net | |
parent | b48e3c5c323fea08c12a340cbb8dcc8ca2431d5b (diff) |
netfilter: nf_nat: fix crash in nf_nat_csum
Fix crash in nf_nat_csum when mangling packets
in OUTPUT hook where skb->dev is not defined, it is set
later before POSTROUTING. Problem happens for CHECKSUM_NONE.
We can check device from rt but using CHECKSUM_PARTIAL
should be safe (skb_checksum_help).
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_helper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c index 99cfa28b6d38..ebc5f8894f99 100644 --- a/net/ipv4/netfilter/nf_nat_helper.c +++ b/net/ipv4/netfilter/nf_nat_helper.c | |||
@@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *skb, const struct iphdr *iph, void *data | |||
160 | 160 | ||
161 | if (skb->ip_summed != CHECKSUM_PARTIAL) { | 161 | if (skb->ip_summed != CHECKSUM_PARTIAL) { |
162 | if (!(rt->rt_flags & RTCF_LOCAL) && | 162 | if (!(rt->rt_flags & RTCF_LOCAL) && |
163 | skb->dev->features & NETIF_F_V4_CSUM) { | 163 | (!skb->dev || skb->dev->features & NETIF_F_V4_CSUM)) { |
164 | skb->ip_summed = CHECKSUM_PARTIAL; | 164 | skb->ip_summed = CHECKSUM_PARTIAL; |
165 | skb->csum_start = skb_headroom(skb) + | 165 | skb->csum_start = skb_headroom(skb) + |
166 | skb_network_offset(skb) + | 166 | skb_network_offset(skb) + |