Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 78109
b: refs/heads/master
c: 668dc8a
h: refs/heads/master
i:
  78107: 09914be
v: v3
  • Loading branch information
Herbert Xu authored and David S. Miller committed Jan 28, 2008
1 parent de41598 commit cd793ba
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 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: b2aa5e9d43a38dcdfa0878ed750cf32f98460278
refs/heads/master: 668dc8af3150f837f7f0461001bbbc0ce25d7bdf
3 changes: 1 addition & 2 deletions trunk/net/ipv4/ah4.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,8 @@ static int ah_input(struct xfrm_state *x, struct sk_buff *skb)
err = ah_mac_digest(ahp, skb, ah->auth_data);
if (err)
goto out;
err = -EINVAL;
if (memcmp(ahp->work_icv, auth_data, ahp->icv_trunc_len)) {
x->stats.integrity_failed++;
err = -EBADMSG;
goto out;
}
}
Expand Down
13 changes: 8 additions & 5 deletions trunk/net/ipv4/esp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
u8 nexthdr[2];
struct scatterlist *sg;
int padlen;
int err;
int err = -EINVAL;

if (!pskb_may_pull(skb, sizeof(*esph)))
goto out;
Expand All @@ -183,13 +183,14 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
BUG();

if (unlikely(memcmp(esp->auth.work_icv, sum, alen))) {
x->stats.integrity_failed++;
err = -EBADMSG;
goto out;
}
}

if ((nfrags = skb_cow_data(skb, 0, &trailer)) < 0)
if ((err = skb_cow_data(skb, 0, &trailer)) < 0)
goto out;
nfrags = err;

skb->ip_summed = CHECKSUM_NONE;

Expand All @@ -202,6 +203,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
sg = &esp->sgbuf[0];

if (unlikely(nfrags > ESP_NUM_FAST_SG)) {
err = -ENOMEM;
sg = kmalloc(sizeof(struct scatterlist)*nfrags, GFP_ATOMIC);
if (!sg)
goto out;
Expand All @@ -214,11 +216,12 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
if (unlikely(err))
return err;
goto out;

if (skb_copy_bits(skb, skb->len-alen-2, nexthdr, 2))
BUG();

err = -EINVAL;
padlen = nexthdr[0];
if (padlen+2 >= elen)
goto out;
Expand Down Expand Up @@ -276,7 +279,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
return nexthdr[1];

out:
return -EINVAL;
return err;
}

static u32 esp4_get_mtu(struct xfrm_state *x, int mtu)
Expand Down
3 changes: 1 addition & 2 deletions trunk/net/ipv6/ah6.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,9 @@ static int ah6_input(struct xfrm_state *x, struct sk_buff *skb)
err = ah_mac_digest(ahp, skb, ah->auth_data);
if (err)
goto free_out;
err = -EINVAL;
if (memcmp(ahp->work_icv, auth_data, ahp->icv_trunc_len)) {
LIMIT_NETDEBUG(KERN_WARNING "ipsec ah authentication error\n");
x->stats.integrity_failed++;
err = -EBADMSG;
goto free_out;
}
}
Expand Down
3 changes: 1 addition & 2 deletions trunk/net/ipv6/esp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,7 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
BUG();

if (unlikely(memcmp(esp->auth.work_icv, sum, alen))) {
x->stats.integrity_failed++;
ret = -EINVAL;
ret = -EBADMSG;
goto out;
}
}
Expand Down
5 changes: 4 additions & 1 deletion trunk/net/xfrm/xfrm_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,11 @@ int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type)
goto drop_unlock;

nexthdr = x->type->input(x, skb);
if (nexthdr <= 0)
if (nexthdr <= 0) {
if (nexthdr == -EBADMSG)
x->stats.integrity_failed++;
goto drop_unlock;
}

skb_network_header(skb)[nhoff] = nexthdr;

Expand Down

0 comments on commit cd793ba

Please sign in to comment.