diff options
Diffstat (limited to 'net/dccp/ipv6.c')
| -rw-r--r-- | net/dccp/ipv6.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index da509127e00c..5e1ee0da2c40 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
| @@ -89,12 +89,19 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 89 | { | 89 | { |
| 90 | struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; | 90 | struct ipv6hdr *hdr = (struct ipv6hdr *)skb->data; |
| 91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); | 91 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); |
| 92 | struct dccp_sock *dp; | ||
| 92 | struct ipv6_pinfo *np; | 93 | struct ipv6_pinfo *np; |
| 93 | struct sock *sk; | 94 | struct sock *sk; |
| 94 | int err; | 95 | int err; |
| 95 | __u64 seq; | 96 | __u64 seq; |
| 96 | struct net *net = dev_net(skb->dev); | 97 | struct net *net = dev_net(skb->dev); |
| 97 | 98 | ||
| 99 | if (skb->len < offset + sizeof(*dh) || | ||
| 100 | skb->len < offset + __dccp_basic_hdr_len(dh)) { | ||
| 101 | ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); | ||
| 102 | return; | ||
| 103 | } | ||
| 104 | |||
| 98 | sk = inet6_lookup(net, &dccp_hashinfo, | 105 | sk = inet6_lookup(net, &dccp_hashinfo, |
| 99 | &hdr->daddr, dh->dccph_dport, | 106 | &hdr->daddr, dh->dccph_dport, |
| 100 | &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); | 107 | &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); |
| @@ -116,6 +123,14 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 116 | if (sk->sk_state == DCCP_CLOSED) | 123 | if (sk->sk_state == DCCP_CLOSED) |
| 117 | goto out; | 124 | goto out; |
| 118 | 125 | ||
| 126 | dp = dccp_sk(sk); | ||
| 127 | seq = dccp_hdr_seq(dh); | ||
| 128 | if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) && | ||
| 129 | !between48(seq, dp->dccps_awl, dp->dccps_awh)) { | ||
| 130 | NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); | ||
| 131 | goto out; | ||
| 132 | } | ||
| 133 | |||
| 119 | np = inet6_sk(sk); | 134 | np = inet6_sk(sk); |
| 120 | 135 | ||
| 121 | if (type == ICMPV6_PKT_TOOBIG) { | 136 | if (type == ICMPV6_PKT_TOOBIG) { |
| @@ -168,7 +183,6 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
| 168 | 183 | ||
| 169 | icmpv6_err_convert(type, code, &err); | 184 | icmpv6_err_convert(type, code, &err); |
| 170 | 185 | ||
| 171 | seq = dccp_hdr_seq(dh); | ||
| 172 | /* Might be for an request_sock */ | 186 | /* Might be for an request_sock */ |
| 173 | switch (sk->sk_state) { | 187 | switch (sk->sk_state) { |
| 174 | struct request_sock *req, **prev; | 188 | struct request_sock *req, **prev; |
