]> www.infradead.org Git - users/dwmw2/linux.git/commit
firmware_loader: Fix possible resource leak in fw_log_firmware_info()
authorGaosheng Cui <cuigaosheng1@huawei.com>
Wed, 16 Oct 2024 11:03:35 +0000 (19:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Nov 2024 06:13:50 +0000 (07:13 +0100)
commit369a9c046c2fdfe037f05b43b84c386bdbccc103
tree8941ff0031688db0690ad6dc0d39db6e4ec3c20b
parentf841224f03029225dec70ee1f12ffc2473ed067a
firmware_loader: Fix possible resource leak in fw_log_firmware_info()

The alg instance should be released under the exception path, otherwise
there may be resource leak here.

To mitigate this, free the alg instance with crypto_free_shash when kmalloc
fails.

Fixes: 02fe26f25325 ("firmware_loader: Add debug message with checksum for FW file")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Russ Weight <russ.weight@linux.dev>
Link: https://lore.kernel.org/r/20241016110335.3677924-1-cuigaosheng1@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/firmware_loader/main.c