--- zzzz-none-000/linux-4.4.271/net/ipv6/esp6.c 2021-06-03 06:22:09.000000000 +0000 +++ maple-fsgw-759/linux-4.4.271/net/ipv6/esp6.c 2023-12-20 10:37:40.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); @@ -369,6 +376,7 @@ __be32 *seqhi; u8 *iv; struct scatterlist *sg; + bool nosupp_sg; if (!pskb_may_pull(skb, sizeof(*esph) + ivlen)) { ret = -EINVAL; @@ -380,6 +388,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; @@ -480,9 +494,10 @@ return 0; if (type == NDISC_REDIRECT) - ip6_redirect(skb, net, skb->dev->ifindex, 0); + ip6_redirect(skb, net, skb->dev->ifindex, 0, + sock_net_uid(net, NULL)); else - ip6_update_pmtu(skb, net, info, 0, 0); + ip6_update_pmtu(skb, net, info, 0, 0, sock_net_uid(net, NULL)); xfrm_state_put(x); return 0;