In the Linux kernel, the following vulnerability has been resolved:
mm/hugetlb: do not call vmaaddreservation upon ENOMEM
sysbot reported a splat [1] on _unmaphugepagerange(). This is because vmaneedsreservation() can return -ENOMEM if allocatefileregionentries() fails to allocate the file_region struct for the reservation.
Check for that and do not call vmaaddreservation() if that is the case, otherwise regionabort() and regiondel() will see that we do not have any file_regions.
If we detect that vmaneedsreservation() returned -ENOMEM, we clear the hugetlbrestorereserve flag as if this reservation was still consumed, so freehugefolio() will not increment the resv count.
[1] https://lore.kernel.org/linux-mm/0000000000004096100617c58d54@google.com/T/#ma5983bc1ab18a54910da83416b3f89f3c7ee43aa