mirror-linux/kernel/power
Malaya Kumar Rout 7966cf0ebe PM: hibernate: Fix crash when freeing invalid crypto compressor
When crypto_alloc_acomp() fails, it returns an ERR_PTR value, not NULL.

The cleanup code in save_compressed_image() and load_compressed_image()
unconditionally calls crypto_free_acomp() without checking for ERR_PTR,
which causes crypto_acomp_tfm() to dereference an invalid pointer and
crash the kernel.

This can be triggered when the compression algorithm is unavailable
(e.g., CONFIG_CRYPTO_LZO not enabled).

Fix by adding IS_ERR_OR_NULL() checks before calling crypto_free_acomp()
and acomp_request_free(), similar to the existing kthread_stop() check.

Fixes: b03d542c3c ("PM: hibernate: Use crypto_acomp interface")
Signed-off-by: Malaya Kumar Rout <mrout@redhat.com>
Cc: 6.15+ <stable@vger.kernel.org> # 6.15+
[ rjw: Added 2 empty code lines ]
Link: https://patch.msgid.link/20251230115613.64080-1-mrout@redhat.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-01-05 19:12:56 +01:00
..
Kconfig PM: QoS: Introduce a CPU system wakeup QoS limit 2025-11-25 19:01:29 +01:00
Makefile PM: EM: Add a skeleton code for netlink notification 2025-10-22 21:44:37 +02:00
autosleep.c PM: sleep: autosleep: don't include 'pm_wakeup.h' directly 2024-12-05 12:14:26 +01:00
console.c PM: console: Fix memory allocation error handling in pm_vt_switch_required() 2025-10-18 14:38:23 +02:00
em_netlink.c PM: EM: Implement em_notify_pd_created/updated() 2025-10-22 21:44:38 +02:00
em_netlink.h PM: EM: Implement em_notify_pd_created/updated() 2025-10-22 21:44:38 +02:00
em_netlink_autogen.c ynl: add regen hint to new headers 2025-12-08 23:52:43 -08:00
em_netlink_autogen.h ynl: add regen hint to new headers 2025-12-08 23:52:43 -08:00
energy_model.c PM: EM: Add to em_pd_list only when no failure 2025-10-29 13:37:00 +01:00
hibernate.c Merge branch 'pm-sleep' 2025-11-28 16:01:13 +01:00
main.c Merge branch 'pm-sleep' 2025-11-28 16:01:13 +01:00
power.h PM: sleep: Add support for wakeup during filesystem sync 2025-11-20 22:29:40 +01:00
poweroff.c
process.c Revert "PM: sleep: Make pm_wakeup_clear() call more clear" 2025-10-23 12:48:04 +02:00
qos.c PM: QoS: Introduce a CPU system wakeup QoS limit 2025-11-25 19:01:29 +01:00
snapshot.c PM: hibernate: Rework message printing in swsusp_save() 2025-10-20 20:43:09 +02:00
suspend.c PM: sleep: Fix suspend_test() at the TEST_CORE level 2025-12-28 13:01:39 +01:00
suspend_test.c
swap.c PM: hibernate: Fix crash when freeing invalid crypto compressor 2026-01-05 19:12:56 +01:00
user.c PM: sleep: Call pm_sleep_fs_sync() instead of ksys_sync_helper() 2025-11-20 22:29:40 +01:00
wakelock.c PM: wakeup: Delete space in the end of string shown by pm_show_wakelocks() 2025-05-09 15:48:39 +02:00