You've already forked linux-rockchip
mirror of
https://github.com/armbian/linux-rockchip.git
synced 2026-01-06 11:08:10 -08:00
KVM: downgrade two BUG_ONs to WARN_ON_ONCE
[ Upstream commit 5f25e71e31 ]
This is not an unrecoverable situation. Users of kvm_read_guest_offset_cached
and kvm_write_guest_offset_cached must expect the read/write to fail, and
therefore it is possible to just return early with an error value.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8d0f56c2ed
commit
49b7e49692
@@ -2590,7 +2590,8 @@ int kvm_write_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
|
||||
int r;
|
||||
gpa_t gpa = ghc->gpa + offset;
|
||||
|
||||
BUG_ON(len + offset > ghc->len);
|
||||
if (WARN_ON_ONCE(len + offset > ghc->len))
|
||||
return -EINVAL;
|
||||
|
||||
if (slots->generation != ghc->generation) {
|
||||
if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len))
|
||||
@@ -2627,7 +2628,8 @@ int kvm_read_guest_offset_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
|
||||
int r;
|
||||
gpa_t gpa = ghc->gpa + offset;
|
||||
|
||||
BUG_ON(len + offset > ghc->len);
|
||||
if (WARN_ON_ONCE(len + offset > ghc->len))
|
||||
return -EINVAL;
|
||||
|
||||
if (slots->generation != ghc->generation) {
|
||||
if (__kvm_gfn_to_hva_cache_init(slots, ghc, ghc->gpa, ghc->len))
|
||||
|
||||
Reference in New Issue
Block a user