--- zzzz-none-000/linux-4.4.60/net/ipv6/esp6.c 2017-04-08 07:53:53.000000000 +0000 +++ dragonfly-4020-701/linux-4.4.60/net/ipv6/esp6.c 2018-11-08 13:36:17.000000000 +0000 @@ -168,12 +168,19 @@ u8 *tail; __be32 *seqhi; __be64 seqno; + bool nosupp_sg; /* skb is pure payload to encrypt */ aead = x->data; alen = crypto_aead_authsize(aead); ivlen = crypto_aead_ivsize(aead); + nosupp_sg = crypto_tfm_alg_flags(&aead->base) & CRYPTO_ALG_NOSUPP_SG; + if (nosupp_sg && skb_linearize(skb)) { + err = -ENOMEM; + goto error; + } + tfclen = 0; if (x->tfcpad) { struct xfrm_dst *dst = (struct xfrm_dst *)skb_dst(skb); @@ -367,6 +374,7 @@ __be32 *seqhi; u8 *iv; struct scatterlist *sg; + bool nosupp_sg; if (!pskb_may_pull(skb, sizeof(*esph) + ivlen)) { ret = -EINVAL; @@ -378,6 +386,12 @@ goto out; } + nosupp_sg = crypto_tfm_alg_flags(&aead->base) & CRYPTO_ALG_NOSUPP_SG; + if (nosupp_sg && skb_linearize(skb)) { + ret = -ENOMEM; + goto out; + } + nfrags = skb_cow_data(skb, 0, &trailer); if (nfrags < 0) { ret = -EINVAL;