Skip to content

Commit 81c5ffe

Browse files
committed
Merge tag 'pm-6.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fix from Rafael Wysocki: "This fixes a crash in the hibernation image saving code that can be triggered when the given compression algorithm is unavailable (Malaya Kumar Rout)" * tag 'pm-6.19-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: hibernate: Fix crash when freeing invalid crypto compressor
2 parents a81668d + 7966cf0 commit 81c5ffe

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

kernel/power/swap.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -902,8 +902,11 @@ static int save_compressed_image(struct swap_map_handle *handle,
902902
for (thr = 0; thr < nr_threads; thr++) {
903903
if (data[thr].thr)
904904
kthread_stop(data[thr].thr);
905-
acomp_request_free(data[thr].cr);
906-
crypto_free_acomp(data[thr].cc);
905+
if (data[thr].cr)
906+
acomp_request_free(data[thr].cr);
907+
908+
if (!IS_ERR_OR_NULL(data[thr].cc))
909+
crypto_free_acomp(data[thr].cc);
907910
}
908911
vfree(data);
909912
}
@@ -1499,8 +1502,11 @@ static int load_compressed_image(struct swap_map_handle *handle,
14991502
for (thr = 0; thr < nr_threads; thr++) {
15001503
if (data[thr].thr)
15011504
kthread_stop(data[thr].thr);
1502-
acomp_request_free(data[thr].cr);
1503-
crypto_free_acomp(data[thr].cc);
1505+
if (data[thr].cr)
1506+
acomp_request_free(data[thr].cr);
1507+
1508+
if (!IS_ERR_OR_NULL(data[thr].cc))
1509+
crypto_free_acomp(data[thr].cc);
15041510
}
15051511
vfree(data);
15061512
}

0 commit comments

Comments
 (0)