Commit 44df536
Rafael Aquini
mm: zswap: move allocations during CPU init outside the lock
JIRA: https://issues.redhat.com/browse/RHEL-78678
CVE: CVE-2025-21693
Conflicts:
* differences in the 2nd and 3rd hunks in this backport are due to RHEL9
missing upstream commits 6c303f1 ("crypto: introduce: acomp_is_async
to expose if comp drivers might sleep") and 270700d ("mm/zswap: remove
the memcpy if acomp is not sleepable"), which are not required for the sake
of this work correctness.
commit 779b995
Author: Yosry Ahmed <yosryahmed@google.com>
Date: Mon Jan 13 21:44:58 2025 +0000
mm: zswap: move allocations during CPU init outside the lock
In zswap_cpu_comp_prepare(), allocations are made and assigned to various
members of acomp_ctx under acomp_ctx->mutex. However, allocations may
recurse into zswap through reclaim, trying to acquire the same mutex and
deadlocking.
Move the allocations before the mutex critical section. Only the
initialization of acomp_ctx needs to be done with the mutex held.
Link: https://lkml.kernel.org/r/20250113214458.2123410-1-yosryahmed@google.com
Fixes: 12dcb0e ("mm: zswap: properly synchronize freeing resources during CPU hotunplug")
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
Reviewed-by: Chengming Zhou <chengming.zhou@linux.dev>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Rafael Aquini <raquini@redhat.com>1 parent c9b94ff commit 44df536
1 file changed
+23
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
710 | 710 | | |
711 | 711 | | |
712 | 712 | | |
713 | | - | |
714 | | - | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
715 | 716 | | |
716 | 717 | | |
717 | | - | |
718 | | - | |
719 | | - | |
| 718 | + | |
| 719 | + | |
720 | 720 | | |
721 | | - | |
| 721 | + | |
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
| 729 | + | |
730 | 730 | | |
731 | | - | |
732 | 731 | | |
733 | | - | |
| 732 | + | |
734 | 733 | | |
735 | 734 | | |
736 | 735 | | |
737 | 736 | | |
738 | | - | |
| 737 | + | |
739 | 738 | | |
740 | | - | |
741 | 739 | | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
742 | 746 | | |
| 747 | + | |
743 | 748 | | |
744 | 749 | | |
745 | 750 | | |
| |||
748 | 753 | | |
749 | 754 | | |
750 | 755 | | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
751 | 759 | | |
752 | 760 | | |
753 | 761 | | |
754 | | - | |
755 | | - | |
756 | | - | |
757 | | - | |
758 | | - | |
759 | | - | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
760 | 766 | | |
761 | 767 | | |
762 | 768 | | |
| |||
0 commit comments