hv_balloon: Balloon up according to request page number
authorTianyu Lan <Tianyu.Lan@microsoft.com>
Sat, 25 Jan 2020 21:50:47 +0000 (16:50 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:34:01 +0000 (04:34 -0800)
commite6c92036c2fe8424dce1ab6c388ba1cc29c29e66
tree4958823a82fb0dc5f5e6fdf73f82cea36534dac3
parent329c6cf32f513c1c6cefb7f9551b56f8e40279a8
hv_balloon: Balloon up according to request page number

commit d33c240d47dab4fd15123d9e73fc8810cbc6ed6a upstream.

Current code has assumption that balloon request memory size aligns
with 2MB. But actually Hyper-V doesn't guarantee such alignment. When
balloon driver receives non-aligned balloon request, it produces warning
and balloon up more memory than requested in order to keep 2MB alignment.
Remove the warning and balloon up memory according to actual requested
memory size.

Fixes: f6712238471a ("hv: hv_balloon: avoid memory leak on alloc_error of 2MB memory block")
Cc: stable@vger.kernel.org
Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Tianyu Lan <Tianyu.Lan@microsoft.com>
Reviewed-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/hv_balloon.c