Re: [Linux-stm32] [PATCH] crypto: stm32/crc32 - Fix kernel BUG triggered in probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 20 Dec 2021, Marek Vasut wrote:

The include/linux/crypto.h struct crypto_alg field cra_driver_name description
states "Unique name of the transformation provider. " ... " this contains the
name of the chip or provider and the name of the transformation algorithm."

In case of the stm32-crc driver, field cra_driver_name is identical for all
registered transformation providers and set to the name of the driver itself,
which is incorrect. This patch fixes it by assigning a unique cra_driver_name
to each registered transformation provider.

The kernel crash is triggered when the driver calls crypto_register_shashes()
which calls crypto_register_shash(), which calls crypto_register_alg(), which
calls __crypto_register_alg(), which returns -EEXIST, which is propagated
back through this call chain. Upon -EEXIST from crypto_register_shash(), the
crypto_register_shashes() starts unregistering the providers back, and calls
crypto_unregister_shash(), which calls crypto_unregister_alg(), and this is
where the BUG() triggers due to incorrect cra_refcnt.

Fixes: b51dbe90912a ("crypto: stm32 - Support for STM32 CRC32 crypto module")
Signed-off-by: Marek Vasut <marex@xxxxxxx>
Cc: <stable@xxxxxxxxxxxxxxx> # 4.12+
Cc: Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>
Cc: Fabien Dessenne <fabien.dessenne@xxxxxx>
Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Cc: Lionel Debieve <lionel.debieve@xxxxxx>
Cc: Nicolas Toromanoff <nicolas.toromanoff@xxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
To: linux-crypto@xxxxxxxxxxxxxxx
---
drivers/crypto/stm32/stm32-crc32.c | 4 ++--

Hello Marek,

Thanks for the fix.

Acked-by: Nicolas Toromanoff <nicolas.toromanoff@xxxxxxxxxxx>




[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux