futex: fixup get_futex_key() for private futexes
[sfrench/cifs-2.6.git] / net / ipv4 / esp4.c
index 091e6709f83109dc1e229f24bfe3cad71d5be13a..21515d4c49eb5712c22655ba7d8166909bdcf13e 100644 (file)
@@ -168,7 +168,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
                struct xfrm_encap_tmpl *encap = x->encap;
                struct udphdr *uh;
                __be32 *udpdata32;
-               unsigned int sport, dport;
+               __be16 sport, dport;
                int encap_type;
 
                spin_lock_bh(&x->lock);
@@ -336,7 +336,7 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
        struct scatterlist *asg;
        int err = -EINVAL;
 
-       if (!pskb_may_pull(skb, sizeof(*esph)))
+       if (!pskb_may_pull(skb, sizeof(*esph) + crypto_aead_ivsize(aead)))
                goto out;
 
        if (elen <= 0)
@@ -575,7 +575,7 @@ static int esp_init_state(struct xfrm_state *x)
                              crypto_aead_ivsize(aead);
        if (x->props.mode == XFRM_MODE_TUNNEL)
                x->props.header_len += sizeof(struct iphdr);
-       else if (x->props.mode == XFRM_MODE_BEET)
+       else if (x->props.mode == XFRM_MODE_BEET && x->sel.family != AF_INET6)
                x->props.header_len += IPV4_BEET_PHMAXLEN;
        if (x->encap) {
                struct xfrm_encap_tmpl *encap = x->encap;