Commit 67ef1ab0 authored by Tomas Bortoli's avatar Tomas Bortoli Committed by zhengchuan
Browse files

KVM: validate userspace input in kvm_clear_dirty_log_protect()

mainline inclusion
from mainline-v5.0
commit: 98938aa8
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I66COX
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-5.10.y&id=98938aa8edd66dc95024d7c936a4bc315f6615ff



--------------------------------

The function at issue does not fully validate the content of the
structure pointed by the log parameter, though its content has just been
copied from userspace and lacks validation. Fix that.

Moreover, change the type of n to unsigned long as that is the type
returned by kvm_dirty_bitmap_bytes().

Signed-off-by: default avatarTomas Bortoli <tomasbortoli@gmail.com>
Reported-by: default avatar <syzbot+028366e52c9ace67deb3@syzkaller.appspotmail.com>
[Squashed the fix from Paolo. - Radim.]
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent f6636bd7
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment