[PATCH 6.1 0/2] Backport to fix CVE-2024-37021 and CVE-2024-36479