aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ipv4.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/ipv4.c')
-rw-r--r--net/dccp/ipv4.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index a835b88237cb..882c5c4de69e 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -196,8 +196,8 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
196static void dccp_v4_err(struct sk_buff *skb, u32 info) 196static void dccp_v4_err(struct sk_buff *skb, u32 info)
197{ 197{
198 const struct iphdr *iph = (struct iphdr *)skb->data; 198 const struct iphdr *iph = (struct iphdr *)skb->data;
199 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + 199 const u8 offset = iph->ihl << 2;
200 (iph->ihl << 2)); 200 const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset);
201 struct dccp_sock *dp; 201 struct dccp_sock *dp;
202 struct inet_sock *inet; 202 struct inet_sock *inet;
203 const int type = icmp_hdr(skb)->type; 203 const int type = icmp_hdr(skb)->type;
@@ -207,7 +207,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
207 int err; 207 int err;
208 struct net *net = dev_net(skb->dev); 208 struct net *net = dev_net(skb->dev);
209 209
210 if (skb->len < (iph->ihl << 2) + 8) { 210 if (skb->len < offset + sizeof(*dh) ||
211 skb->len < offset + __dccp_basic_hdr_len(dh)) {
211 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); 212 ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS);
212 return; 213 return;
213 } 214 }
@@ -238,7 +239,7 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
238 dp = dccp_sk(sk); 239 dp = dccp_sk(sk);
239 seq = dccp_hdr_seq(dh); 240 seq = dccp_hdr_seq(dh);
240 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) && 241 if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_LISTEN) &&
241 !between48(seq, dp->dccps_swl, dp->dccps_swh)) { 242 !between48(seq, dp->dccps_awl, dp->dccps_awh)) {
242 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS); 243 NET_INC_STATS_BH(net, LINUX_MIB_OUTOFWINDOWICMPS);
243 goto out; 244 goto out;
244 } 245 }