]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: coalesced_mmio: add bounds checking
authorMatt Delco <delco@chromium.org>
Mon, 16 Sep 2019 21:16:54 +0000 (14:16 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Sep 2019 13:56:55 +0000 (15:56 +0200)
commit443efde3789754ac3c2611617b6ba4df7c71dda1
tree49d837232351e9b86c9632ccc509f26596e269ed
parent03ffe36879848cffe019d3f8417b3a08d840aac2
KVM: coalesced_mmio: add bounds checking

The first/last indexes are typically shared with a user app.
The app can change the 'last' index that the kernel uses
to store the next result.  This change sanity checks the index
before using it for writing to a potentially arbitrary address.

This fixes CVE-2019-14821.

Cc: stable@vger.kernel.org
Fixes: 12ba030f1f18 ("KVM: Add coalesced MMIO support (common part)")
Signed-off-by: Matt Delco <delco@chromium.org>
Signed-off-by: Jim Mattson <jmattson@google.com>
Reported-by: syzbot+983c866c3dd6efa3662a@syzkaller.appspotmail.com
[Use READ_ONCE. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/coalesced_mmio.c