KVM: s390: Fix for 4.10 (via kvm/master)

Fix a kernel memory exposure.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJYgiQxAAoJEBF7vIC1phx8JbIP/AxHtkQY3tN75awMmRMGxcaT
 hsrbSKMYGCb2cg0eMoO7T7sKgtZE6YY/ewbn8KvsTKJDspdT9wygvkKpFRMc4Kcw
 /ylXrmBXYDEzI5WyHOKPIknhKe5LhSFpFcCcqJoIY9q5gtmOAGWj2oS8M4HLIH1U
 GxR2K3wG029izXbPOmxxNQBi+lptE2lSJWFuJvzDg5cvM4r6mbtIdWxEDSh/UfRw
 e4ZZNCJsSg81kXP91OHesZOMZjWS/YUm5LmWX2UwoXtEGSUw9lPv60titFOpw322
 mv8n8I1IXEffY7mVUrw3LeDcQhXFMBTxwbjfzn/ekf+yKU19g6b/tCg2m32t+4Lx
 T8w6cI6OHqK4x5gvTZhhWoxAlS7J2VTT9Yd6+zLvI+fN41on/QgKosa5/Ra5WKGI
 DXMRmAX/kr/+5Eer2LRcRwnm0HaFZ6u9RkqF0AD+Bw4GrKKl5//Xkdo4lH9WxGIy
 bP8NP8GsJP1JbbFVg3qd0hpumET5k3Wg3YBTfaG1jO4gu/vf68+KW5qDFEj5wdlR
 zoLYGn/sqcGPtTjKFHba8fyr4rgbXs/MbZ58hctFtIG3S8rzjlRs94pr6GuQlTnv
 S77YKo2VTp6OM9KaanTfR5R98UjjSy4GMHeuWVevKnTwutGG1Wuh2dl+lSBcmB8K
 r1wTwNwaIraGiaOWngfv
 =V4VR
 -----END PGP SIGNATURE-----

Merge tag 'kvm-s390-master-4.10-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux

KVM: s390: Fix for 4.10 (via kvm/master)

Fix a kernel memory exposure.
This commit is contained in:
Radim Krčmář 2017-01-20 17:59:02 +01:00
commit fec9690123
1 changed files with 2 additions and 2 deletions

View File

@ -916,7 +916,7 @@ static int kvm_s390_get_machine(struct kvm *kvm, struct kvm_device_attr *attr)
memcpy(&mach->fac_mask, kvm->arch.model.fac_mask,
S390_ARCH_FAC_LIST_SIZE_BYTE);
memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list,
S390_ARCH_FAC_LIST_SIZE_BYTE);
sizeof(S390_lowcore.stfle_fac_list));
if (copy_to_user((void __user *)attr->addr, mach, sizeof(*mach)))
ret = -EFAULT;
kfree(mach);
@ -1437,7 +1437,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
/* Populate the facility mask initially. */
memcpy(kvm->arch.model.fac_mask, S390_lowcore.stfle_fac_list,
S390_ARCH_FAC_LIST_SIZE_BYTE);
sizeof(S390_lowcore.stfle_fac_list));
for (i = 0; i < S390_ARCH_FAC_LIST_SIZE_U64; i++) {
if (i < kvm_s390_fac_list_mask_size())
kvm->arch.model.fac_mask[i] &= kvm_s390_fac_list_mask[i];