summaryrefslogtreecommitdiffstats
path: root/net/ipv6/icmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r--net/ipv6/icmp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 5d7aa2c2770c..bbcdfd299692 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -423,10 +423,10 @@ static int icmp6_iif(const struct sk_buff *skb)
423static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info, 423static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
424 const struct in6_addr *force_saddr) 424 const struct in6_addr *force_saddr)
425{ 425{
426 struct net *net = dev_net(skb->dev);
427 struct inet6_dev *idev = NULL; 426 struct inet6_dev *idev = NULL;
428 struct ipv6hdr *hdr = ipv6_hdr(skb); 427 struct ipv6hdr *hdr = ipv6_hdr(skb);
429 struct sock *sk; 428 struct sock *sk;
429 struct net *net;
430 struct ipv6_pinfo *np; 430 struct ipv6_pinfo *np;
431 const struct in6_addr *saddr = NULL; 431 const struct in6_addr *saddr = NULL;
432 struct dst_entry *dst; 432 struct dst_entry *dst;
@@ -437,12 +437,16 @@ static void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
437 int iif = 0; 437 int iif = 0;
438 int addr_type = 0; 438 int addr_type = 0;
439 int len; 439 int len;
440 u32 mark = IP6_REPLY_MARK(net, skb->mark); 440 u32 mark;
441 441
442 if ((u8 *)hdr < skb->head || 442 if ((u8 *)hdr < skb->head ||
443 (skb_network_header(skb) + sizeof(*hdr)) > skb_tail_pointer(skb)) 443 (skb_network_header(skb) + sizeof(*hdr)) > skb_tail_pointer(skb))
444 return; 444 return;
445 445
446 if (!skb->dev)
447 return;
448 net = dev_net(skb->dev);
449 mark = IP6_REPLY_MARK(net, skb->mark);
446 /* 450 /*
447 * Make sure we respect the rules 451 * Make sure we respect the rules
448 * i.e. RFC 1885 2.4(e) 452 * i.e. RFC 1885 2.4(e)