Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 264387
b: refs/heads/master
c: 4ea2739
h: refs/heads/master
i:
  264385: 176db11
  264383: 5086f7f
v: v3
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Oct 19, 2011
1 parent fde3639 commit cf091f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 58af19e387d8821927e49be3f467da5e6a0aa8fd
refs/heads/master: 4ea2739ea89883ddf79980a8aa27d5e57093e464
20 changes: 12 additions & 8 deletions trunk/drivers/net/pptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,11 +307,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
}

header = (struct pptp_gre_header *)(skb->data);
headersize = sizeof(*header);

/* test if acknowledgement present */
if (PPTP_GRE_IS_A(header->ver)) {
__u32 ack = (PPTP_GRE_IS_S(header->flags)) ?
header->ack : header->seq; /* ack in different place if S = 0 */
__u32 ack;

if (!pskb_may_pull(skb, headersize))
goto drop;
header = (struct pptp_gre_header *)(skb->data);

/* ack in different place if S = 0 */
ack = PPTP_GRE_IS_S(header->flags) ? header->ack : header->seq;

ack = ntohl(ack);

Expand All @@ -320,21 +327,18 @@ static int pptp_rcv_core(struct sock *sk, struct sk_buff *skb)
/* also handle sequence number wrap-around */
if (WRAPPED(ack, opt->ack_recv))
opt->ack_recv = ack;
} else {
headersize -= sizeof(header->ack);
}

/* test if payload present */
if (!PPTP_GRE_IS_S(header->flags))
goto drop;

headersize = sizeof(*header);
payload_len = ntohs(header->payload_len);
seq = ntohl(header->seq);

/* no ack present? */
if (!PPTP_GRE_IS_A(header->ver))
headersize -= sizeof(header->ack);
/* check for incomplete packet (length smaller than expected) */
if (skb->len - headersize < payload_len)
if (!pskb_may_pull(skb, headersize + payload_len))
goto drop;

payload = skb->data + headersize;
Expand Down

0 comments on commit cf091f2

Please sign in to comment.