From: Greg Kroah-Hartman Date: Sun, 7 May 2023 04:10:10 +0000 (+0200) Subject: drop crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch X-Git-Tag: v5.15.111~93 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12d7e0a0c6e57fe73584b66120be4764a33dc140;p=thirdparty%2Fkernel%2Fstable-queue.git drop crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch from 4.19 and 5.4 --- diff --git a/queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch b/queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch deleted file mode 100644 index 7f82a79a7b9..00000000000 --- a/queue-4.19/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch +++ /dev/null @@ -1,45 +0,0 @@ -From a543ada7db729514ddd3ba4efa45f4c7b802ad85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 13 Mar 2023 10:17:24 +0100 -Subject: crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Toke Høiland-Jørgensen - -commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream. - -The crypto_unregister_alg() function expects callers to ensure that any -algorithm that is unregistered has a refcnt of exactly 1, and issues a -BUG_ON() if this is not the case. However, there are in fact drivers that -will call crypto_unregister_alg() without ensuring that the refcnt has been -lowered first, most notably on system shutdown. This causes the BUG_ON() to -trigger, which prevents a clean shutdown and hangs the system. - -To avoid such hangs on shutdown, demote the BUG_ON() in -crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because -this problem was observed on a 6.2 kernel, cf the link below. - -Link: https://lore.kernel.org/r/87r0tyq8ph.fsf@toke.dk -Cc: stable@vger.kernel.org -Signed-off-by: Toke Høiland-Jørgensen -Signed-off-by: Herbert Xu -Signed-off-by: Greg Kroah-Hartman ---- - crypto/algapi.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/crypto/algapi.c -+++ b/crypto/algapi.c -@@ -419,7 +419,9 @@ int crypto_unregister_alg(struct crypto_ - if (ret) - return ret; - -- BUG_ON(refcount_read(&alg->cra_refcnt) != 1); -+ if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1)) -+ return; -+ - if (alg->cra_destroy) - alg->cra_destroy(alg); - diff --git a/queue-4.19/series b/queue-4.19/series index 6d093b623b1..4ddf72ed969 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -13,7 +13,6 @@ xhci-fix-debugfs-register-accesses-while-suspended.patch mips-fw-allow-firmware-to-pass-a-empty-env.patch pwm-meson-fix-axg-ao-mux-parents.patch ring-buffer-sync-irq-works-before-buffer-destruction.patch -crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch i2c-omap-fix-standard-mode-false-ack-readings.patch diff --git a/queue-5.4/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch b/queue-5.4/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch deleted file mode 100644 index 3d6f35cd4d9..00000000000 --- a/queue-5.4/crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch +++ /dev/null @@ -1,45 +0,0 @@ -From a543ada7db729514ddd3ba4efa45f4c7b802ad85 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= -Date: Mon, 13 Mar 2023 10:17:24 +0100 -Subject: crypto: api - Demote BUG_ON() in crypto_unregister_alg() to a WARN_ON() -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Toke Høiland-Jørgensen - -commit a543ada7db729514ddd3ba4efa45f4c7b802ad85 upstream. - -The crypto_unregister_alg() function expects callers to ensure that any -algorithm that is unregistered has a refcnt of exactly 1, and issues a -BUG_ON() if this is not the case. However, there are in fact drivers that -will call crypto_unregister_alg() without ensuring that the refcnt has been -lowered first, most notably on system shutdown. This causes the BUG_ON() to -trigger, which prevents a clean shutdown and hangs the system. - -To avoid such hangs on shutdown, demote the BUG_ON() in -crypto_unregister_alg() to a WARN_ON() with early return. Cc stable because -this problem was observed on a 6.2 kernel, cf the link below. - -Link: https://lore.kernel.org/r/87r0tyq8ph.fsf@toke.dk -Cc: stable@vger.kernel.org -Signed-off-by: Toke Høiland-Jørgensen -Signed-off-by: Herbert Xu -Signed-off-by: Greg Kroah-Hartman ---- - crypto/algapi.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - ---- a/crypto/algapi.c -+++ b/crypto/algapi.c -@@ -427,7 +427,9 @@ int crypto_unregister_alg(struct crypto_ - if (ret) - return ret; - -- BUG_ON(refcount_read(&alg->cra_refcnt) != 1); -+ if (WARN_ON(refcount_read(&alg->cra_refcnt) != 1)) -+ return; -+ - if (alg->cra_destroy) - alg->cra_destroy(alg); - diff --git a/queue-5.4/series b/queue-5.4/series index f987c17331e..7204171f0d0 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -20,7 +20,6 @@ kheaders-use-array-declaration-instead-of-char.patch pwm-meson-fix-axg-ao-mux-parents.patch pwm-meson-fix-g12a-ao-clk81-name.patch ring-buffer-sync-irq-works-before-buffer-destruction.patch -crypto-api-demote-bug_on-in-crypto_unregister_alg-to-a-warn_on.patch reiserfs-add-security-prefix-to-xattr-name-in-reiserfs_security_write.patch kvm-nvmx-emulate-nops-in-l2-and-pause-if-it-s-not-intercepted.patch i2c-omap-fix-standard-mode-false-ack-readings.patch