{"id":2231262,"url":"http://patchwork.ozlabs.org/api/patches/2231262/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/2b5a6517789ad618f2b1c7729520e8b69659ef83.1777550836.git.massimiliano.pellizzer@canonical.com/","project":{"id":15,"url":"http://patchwork.ozlabs.org/api/projects/15/?format=json","name":"Ubuntu Kernel","link_name":"ubuntu-kernel","list_id":"kernel-team.lists.ubuntu.com","list_email":"kernel-team@lists.ubuntu.com","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<2b5a6517789ad618f2b1c7729520e8b69659ef83.1777550836.git.massimiliano.pellizzer@canonical.com>","list_archive_url":null,"date":"2026-04-30T12:30:24","name":"[SRU,N,5/8] crypto: authenc - use memcpy_sglist() instead of null skcipher","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a15fc792ce918e09247744bec87f96b8dd9d86ee","submitter":{"id":89057,"url":"http://patchwork.ozlabs.org/api/people/89057/?format=json","name":"Massimiliano Pellizzer","email":"massimiliano.pellizzer@canonical.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/ubuntu-kernel/patch/2b5a6517789ad618f2b1c7729520e8b69659ef83.1777550836.git.massimiliano.pellizzer@canonical.com/mbox/","series":[{"id":502299,"url":"http://patchwork.ozlabs.org/api/series/502299/?format=json","web_url":"http://patchwork.ozlabs.org/project/ubuntu-kernel/list/?series=502299","date":"2026-04-30T12:30:20","name":"CVE-2026-31431","version":1,"mbox":"http://patchwork.ozlabs.org/series/502299/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231262/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231262/checks/","tags":{},"related":[],"headers":{"Return-Path":"<kernel-team-bounces@lists.ubuntu.com>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (4096-bit key;\n unprotected) header.d=canonical.com header.i=@canonical.com\n header.a=rsa-sha256 header.s=20251003 header.b=Y4Vt/rm5;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com\n (client-ip=185.125.189.65; helo=lists.ubuntu.com;\n envelope-from=kernel-team-bounces@lists.ubuntu.com;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g5tp95kT9z1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 22:31:45 +1000 (AEST)","from localhost ([127.0.0.1] helo=lists.ubuntu.com)\n\tby lists.ubuntu.com with esmtp (Exim 4.86_2)\n\t(envelope-from <kernel-team-bounces@lists.ubuntu.com>)\n\tid 1wIQYJ-00051g-7w; Thu, 30 Apr 2026 12:31:35 +0000","from smtp-relay-internal-0.internal ([10.131.114.225]\n helo=smtp-relay-internal-0.canonical.com)\n by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.86_2) (envelope-from <massimiliano.pellizzer@canonical.com>)\n id 1wIQYB-0004ah-TX\n for kernel-team@lists.ubuntu.com; Thu, 30 Apr 2026 12:31:27 +0000","from mail-wm1-f70.google.com (mail-wm1-f70.google.com\n [209.85.128.70])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id C55783F427\n for <kernel-team@lists.ubuntu.com>; Thu, 30 Apr 2026 12:31:27 +0000 (UTC)","by mail-wm1-f70.google.com with SMTP id\n 5b1f17b1804b1-48a5adc141cso5359845e9.0\n for <kernel-team@lists.ubuntu.com>; Thu, 30 Apr 2026 05:31:27 -0700 (PDT)","from tuxedo-infinitybook.ts.net\n (net-93-71-66-38.cust.vodafonedsl.it. [93.71.66.38])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-48a81ed6bafsm103695005e9.2.2026.04.30.05.31.25\n for <kernel-team@lists.ubuntu.com>\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 30 Apr 2026 05:31:25 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com;\n s=20251003; t=1777552287;\n bh=lDgAtQ1+Kt/J5WragCr7feeILv2qoOCKuau6GVl3vB8=;\n h=From:To:Subject:Date:Message-ID:In-Reply-To:References:\n MIME-Version;\n b=Y4Vt/rm5leofHNVbDiEbr7TnZ5APmaSFdpm04k4ERWdP4bBuJsVHtYWVr2Q0wKZkU\n oD44TVv/Bs31xqSNXLYs9kMiik08LDAp75Y+te87Jq/vje0i/UT8WLLEXQB0DofjZZ\n l63Q44vnp8TbXIL1FraNCOTMoX2FH2V7SuVZsCQ5+/LwO1jxdB51QSnBsEcWJLen8r\n f757vevBW26gLE5yloPXB105/6qhD5OTLVRWqIs+9vTn+GZqqS9n4Fc8GzvkzpxkO9\n TsuXdyRgRtjnzyKEU+B71BA3Llfmi/BIbSLNoHTyNbgqYn1aZo9OsC6JFlcwTQXSdz\n NazAv0T1cbPSxrmGS9qt5iEa+BFDLXEb/Tb1v3dV3KWj3yiEqHekhFFFNSpbYE+IKt\n 5QcrhaQ+cqqlY4DD5OUKdfCSrn3cUY6UQuSWtz3LfurS3a5C8XryS6xiuCYN7/ftfm\n XV0y2ewkD5eRb06yJRzniNFMrDH6tzS8orjUWUjSmF0vZ3TrGSAH/wZY54c2Eqdgu8\n 9Xu5koFOvgZlocEu8sNyh0RE/KxX31Yyjo/FKJJQ67xllFlmKAZ0B5HBSzepdYLXC+\n YZt4XilnAhrR6fiD+nsXEhNgpejOGTIlutwF7jcv2+Jol/g6cegl8tS6GnqS/m8HYT\n NjBcgUxmwY0XWbc3j3Aa+nH8=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1777552287; x=1778157087;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=lDgAtQ1+Kt/J5WragCr7feeILv2qoOCKuau6GVl3vB8=;\n b=MHg0hS/uCkOYkr34WWCIaoPyeFOVBhyuQsTAi4jBgu/IQZ1W/Ex7rhGz74BJoRD5AM\n 9SiTxMN2QDsl/oUnIj7NRGgWO3DIMgYpZHcN2kD+GI6QVdJ0snL4JS6/EyRNbOYTnt5s\n RR+748M2gaAe/uZnnDK8j+w/Raj3KUEW1fCGXr5CZYLYh7RmZHab2TH97/RTNWh/PZP3\n /ItUXcZMCqyt9fmvHDP49rXPNmC/5rBXjFjrud2EscpTbYe1+K8YSm3tCd7v/T1ImoS+\n Twf/ItB98qIWY4Qc857fz7GLwDbwyN8Z1epj6Nd6Ukg7KQYj45GBhVEyL0cRMmPuC8WY\n UWRg==","X-Gm-Message-State":"AOJu0YwVSh8oDWCy0wPj1IoLODsD0A0VupoiMQzx4cFflxpkczObwZ+S\n BTy9z7oY4t1bXTekcinbYKs+zzPqXW77OislMdIgBbfc6ZleJn1CeaxyPJViPq5D8kZdMPpU36M\n We56InJWZwVuni13OpXCTvQpdewqbTZmTnGVBTRZTGe6rGAYlzJS1yws3vOvyFSIUxYk2tU6P3c\n O/TgAVZ9wtAIvRrw==","X-Gm-Gg":"AeBDiesMe2i1FmsjQFAOGOxiG4D0o5g1g67EhUDIINx220TohCvsQe2KzzVJv6PlxB7\n sevYmJClt0+TJm/rdTKdyIiI5153QGNZ9V2XTlNnKQrFPkcad0ZBxJvCa00Y2uTETHPrX5PBywR\n fMjdRxoQwrRcyOuUtXx256KkxcoePPcaUbUK3knqMI2SOr1hfzn4s3rEeO4GNg2sMlChVlYBxjV\n JZu6k3gJ0YFnGTcZF0ehDVGqa1fyDjYQVgGrnx5qG4qw7LCZkkKuIIYtF+PcwksTWjnjr+UvjDH\n ULzjep3sqHEusyWxjFDHjhx+xLfbUp5hW8KVR/I9onD4FU9GMmpYtmIXeMmGwdf3L9oacVKeNzF\n BtD0Lz7RfEBfdqMU+MvwOSorv6zYdxzfE6HALWr4+X5V/eY9WUAAeWXItgOEp0UnUXKAjcoscMJ\n 9pcRlVa0CboSFfnxcHOAsQ2bNyNNaQTOwvnzaWjSiJS9N6YwE5y9cQf/TOBNEt7/52piYj4I096\n BPC9WHAdCACuNLaJO2Z/Vo=","X-Received":["by 2002:a05:600c:8707:b0:489:1baf:8c03 with SMTP id\n 5b1f17b1804b1-48a86084573mr43894515e9.11.1777552286865;\n Thu, 30 Apr 2026 05:31:26 -0700 (PDT)","by 2002:a05:600c:8707:b0:489:1baf:8c03 with SMTP id\n 5b1f17b1804b1-48a86084573mr43893835e9.11.1777552286186;\n Thu, 30 Apr 2026 05:31:26 -0700 (PDT)"],"From":"Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com>","To":"kernel-team@lists.ubuntu.com","Subject":"[SRU][N][PATCH 5/8] crypto: authenc - use memcpy_sglist() instead of\n null skcipher","Date":"Thu, 30 Apr 2026 14:30:24 +0200","Message-ID":"\n <2b5a6517789ad618f2b1c7729520e8b69659ef83.1777550836.git.massimiliano.pellizzer@canonical.com>","X-Mailer":"git-send-email 2.53.0","In-Reply-To":"<cover.1777550836.git.massimiliano.pellizzer@canonical.com>","References":"\n <177754965576.503496.12142658280614619991@tuxedo-infinitybook.public>\n <cover.1777550836.git.massimiliano.pellizzer@canonical.com>","MIME-Version":"1.0","X-BeenThere":"kernel-team@lists.ubuntu.com","X-Mailman-Version":"2.1.20","Precedence":"list","List-Id":"Kernel team discussions <kernel-team.lists.ubuntu.com>","List-Unsubscribe":"<https://lists.ubuntu.com/mailman/options/kernel-team>,\n <mailto:kernel-team-request@lists.ubuntu.com?subject=unsubscribe>","List-Archive":"<https://lists.ubuntu.com/archives/kernel-team>","List-Post":"<mailto:kernel-team@lists.ubuntu.com>","List-Help":"<mailto:kernel-team-request@lists.ubuntu.com?subject=help>","List-Subscribe":"<https://lists.ubuntu.com/mailman/listinfo/kernel-team>,\n <mailto:kernel-team-request@lists.ubuntu.com?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"kernel-team-bounces@lists.ubuntu.com","Sender":"\"kernel-team\" <kernel-team-bounces@lists.ubuntu.com>"},"content":"From: Eric Biggers <ebiggers@google.com>\n\ncommit dbc4b1458e931e47198c3165ff5853bc1ad6bd7a upstream.\n\nFor copying data between two scatterlists, just use memcpy_sglist()\ninstead of the so-called \"null skcipher\".  This is much simpler.\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\nSigned-off-by: Herbert Xu <herbert@gondor.apana.org.au>\nSigned-off-by: Eric Biggers <ebiggers@kernel.org>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\n(cherry picked from commit 7bc058a9b82b066fa68d4bc8b8d2b61834609410 linux-6.12.y)\nCVE-2026-31431\nSigned-off-by: Massimiliano Pellizzer <massimiliano.pellizzer@canonical.com>\n---\n crypto/Kconfig      |  1 -\n crypto/authenc.c    | 32 +-------------------------------\n crypto/authencesn.c | 38 +++-----------------------------------\n 3 files changed, 4 insertions(+), 67 deletions(-)","diff":"diff --git a/crypto/Kconfig b/crypto/Kconfig\nindex 4b6362105499..56a602956660 100644\n--- a/crypto/Kconfig\n+++ b/crypto/Kconfig\n@@ -222,7 +222,6 @@ config CRYPTO_AUTHENC\n \tselect CRYPTO_SKCIPHER\n \tselect CRYPTO_MANAGER\n \tselect CRYPTO_HASH\n-\tselect CRYPTO_NULL\n \thelp\n \t  Authenc: Combined mode wrapper for IPsec.\n \ndiff --git a/crypto/authenc.c b/crypto/authenc.c\nindex d04068af9833..f1f7886bb34c 100644\n--- a/crypto/authenc.c\n+++ b/crypto/authenc.c\n@@ -9,7 +9,6 @@\n #include <crypto/internal/hash.h>\n #include <crypto/internal/skcipher.h>\n #include <crypto/authenc.h>\n-#include <crypto/null.h>\n #include <crypto/scatterwalk.h>\n #include <linux/err.h>\n #include <linux/init.h>\n@@ -28,7 +27,6 @@ struct authenc_instance_ctx {\n struct crypto_authenc_ctx {\n \tstruct crypto_ahash *auth;\n \tstruct crypto_skcipher *enc;\n-\tstruct crypto_sync_skcipher *null;\n };\n \n struct authenc_request_ctx {\n@@ -186,21 +184,6 @@ static void crypto_authenc_encrypt_done(void *data, int err)\n \tauthenc_request_complete(areq, err);\n }\n \n-static int crypto_authenc_copy_assoc(struct aead_request *req)\n-{\n-\tstruct crypto_aead *authenc = crypto_aead_reqtfm(req);\n-\tstruct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);\n-\tSYNC_SKCIPHER_REQUEST_ON_STACK(skreq, ctx->null);\n-\n-\tskcipher_request_set_sync_tfm(skreq, ctx->null);\n-\tskcipher_request_set_callback(skreq, aead_request_flags(req),\n-\t\t\t\t      NULL, NULL);\n-\tskcipher_request_set_crypt(skreq, req->src, req->dst, req->assoclen,\n-\t\t\t\t   NULL);\n-\n-\treturn crypto_skcipher_encrypt(skreq);\n-}\n-\n static int crypto_authenc_encrypt(struct aead_request *req)\n {\n \tstruct crypto_aead *authenc = crypto_aead_reqtfm(req);\n@@ -219,10 +202,7 @@ static int crypto_authenc_encrypt(struct aead_request *req)\n \tdst = src;\n \n \tif (req->src != req->dst) {\n-\t\terr = crypto_authenc_copy_assoc(req);\n-\t\tif (err)\n-\t\t\treturn err;\n-\n+\t\tmemcpy_sglist(req->dst, req->src, req->assoclen);\n \t\tdst = scatterwalk_ffwd(areq_ctx->dst, req->dst, req->assoclen);\n \t}\n \n@@ -328,7 +308,6 @@ static int crypto_authenc_init_tfm(struct crypto_aead *tfm)\n \tstruct crypto_authenc_ctx *ctx = crypto_aead_ctx(tfm);\n \tstruct crypto_ahash *auth;\n \tstruct crypto_skcipher *enc;\n-\tstruct crypto_sync_skcipher *null;\n \tint err;\n \n \tauth = crypto_spawn_ahash(&ictx->auth);\n@@ -340,14 +319,8 @@ static int crypto_authenc_init_tfm(struct crypto_aead *tfm)\n \tif (IS_ERR(enc))\n \t\tgoto err_free_ahash;\n \n-\tnull = crypto_get_default_null_skcipher();\n-\terr = PTR_ERR(null);\n-\tif (IS_ERR(null))\n-\t\tgoto err_free_skcipher;\n-\n \tctx->auth = auth;\n \tctx->enc = enc;\n-\tctx->null = null;\n \n \tcrypto_aead_set_reqsize(\n \t\ttfm,\n@@ -361,8 +334,6 @@ static int crypto_authenc_init_tfm(struct crypto_aead *tfm)\n \n \treturn 0;\n \n-err_free_skcipher:\n-\tcrypto_free_skcipher(enc);\n err_free_ahash:\n \tcrypto_free_ahash(auth);\n \treturn err;\n@@ -374,7 +345,6 @@ static void crypto_authenc_exit_tfm(struct crypto_aead *tfm)\n \n \tcrypto_free_ahash(ctx->auth);\n \tcrypto_free_skcipher(ctx->enc);\n-\tcrypto_put_default_null_skcipher();\n }\n \n static void crypto_authenc_free(struct aead_instance *inst)\ndiff --git a/crypto/authencesn.c b/crypto/authencesn.c\nindex e08032e80f18..a5fbb638d9d7 100644\n--- a/crypto/authencesn.c\n+++ b/crypto/authencesn.c\n@@ -12,7 +12,6 @@\n #include <crypto/internal/hash.h>\n #include <crypto/internal/skcipher.h>\n #include <crypto/authenc.h>\n-#include <crypto/null.h>\n #include <crypto/scatterwalk.h>\n #include <linux/err.h>\n #include <linux/init.h>\n@@ -31,7 +30,6 @@ struct crypto_authenc_esn_ctx {\n \tunsigned int reqoff;\n \tstruct crypto_ahash *auth;\n \tstruct crypto_skcipher *enc;\n-\tstruct crypto_sync_skcipher *null;\n };\n \n struct authenc_esn_request_ctx {\n@@ -158,20 +156,6 @@ static void crypto_authenc_esn_encrypt_done(void *data, int err)\n \tauthenc_esn_request_complete(areq, err);\n }\n \n-static int crypto_authenc_esn_copy(struct aead_request *req, unsigned int len)\n-{\n-\tstruct crypto_aead *authenc_esn = crypto_aead_reqtfm(req);\n-\tstruct crypto_authenc_esn_ctx *ctx = crypto_aead_ctx(authenc_esn);\n-\tSYNC_SKCIPHER_REQUEST_ON_STACK(skreq, ctx->null);\n-\n-\tskcipher_request_set_sync_tfm(skreq, ctx->null);\n-\tskcipher_request_set_callback(skreq, aead_request_flags(req),\n-\t\t\t\t      NULL, NULL);\n-\tskcipher_request_set_crypt(skreq, req->src, req->dst, len, NULL);\n-\n-\treturn crypto_skcipher_encrypt(skreq);\n-}\n-\n static int crypto_authenc_esn_encrypt(struct aead_request *req)\n {\n \tstruct crypto_aead *authenc_esn = crypto_aead_reqtfm(req);\n@@ -193,10 +177,7 @@ static int crypto_authenc_esn_encrypt(struct aead_request *req)\n \tdst = src;\n \n \tif (req->src != req->dst) {\n-\t\terr = crypto_authenc_esn_copy(req, assoclen);\n-\t\tif (err)\n-\t\t\treturn err;\n-\n+\t\tmemcpy_sglist(req->dst, req->src, assoclen);\n \t\tsg_init_table(areq_ctx->dst, 2);\n \t\tdst = scatterwalk_ffwd(areq_ctx->dst, req->dst, assoclen);\n \t}\n@@ -283,11 +264,8 @@ static int crypto_authenc_esn_decrypt(struct aead_request *req)\n \n \tcryptlen -= authsize;\n \n-\tif (req->src != dst) {\n-\t\terr = crypto_authenc_esn_copy(req, assoclen + cryptlen);\n-\t\tif (err)\n-\t\t\treturn err;\n-\t}\n+\tif (req->src != dst)\n+\t\tmemcpy_sglist(dst, req->src, assoclen + cryptlen);\n \n \tscatterwalk_map_and_copy(ihash, req->src, assoclen + cryptlen,\n \t\t\t\t authsize, 0);\n@@ -323,7 +301,6 @@ static int crypto_authenc_esn_init_tfm(struct crypto_aead *tfm)\n \tstruct crypto_authenc_esn_ctx *ctx = crypto_aead_ctx(tfm);\n \tstruct crypto_ahash *auth;\n \tstruct crypto_skcipher *enc;\n-\tstruct crypto_sync_skcipher *null;\n \tint err;\n \n \tauth = crypto_spawn_ahash(&ictx->auth);\n@@ -335,14 +312,8 @@ static int crypto_authenc_esn_init_tfm(struct crypto_aead *tfm)\n \tif (IS_ERR(enc))\n \t\tgoto err_free_ahash;\n \n-\tnull = crypto_get_default_null_skcipher();\n-\terr = PTR_ERR(null);\n-\tif (IS_ERR(null))\n-\t\tgoto err_free_skcipher;\n-\n \tctx->auth = auth;\n \tctx->enc = enc;\n-\tctx->null = null;\n \n \tctx->reqoff = 2 * crypto_ahash_digestsize(auth);\n \n@@ -358,8 +329,6 @@ static int crypto_authenc_esn_init_tfm(struct crypto_aead *tfm)\n \n \treturn 0;\n \n-err_free_skcipher:\n-\tcrypto_free_skcipher(enc);\n err_free_ahash:\n \tcrypto_free_ahash(auth);\n \treturn err;\n@@ -371,7 +340,6 @@ static void crypto_authenc_esn_exit_tfm(struct crypto_aead *tfm)\n \n \tcrypto_free_ahash(ctx->auth);\n \tcrypto_free_skcipher(ctx->enc);\n-\tcrypto_put_default_null_skcipher();\n }\n \n static void crypto_authenc_esn_free(struct aead_instance *inst)\n","prefixes":["SRU","N","5/8"]}