kvm: Fix nonsense handling of compat ioctl
authorAlan Cox <alan@linux.intel.com>
Wed, 22 Aug 2012 13:34:11 +0000 (14:34 +0100)
committerMarcelo Tosatti <mtosatti@redhat.com>
Sun, 26 Aug 2012 18:11:48 +0000 (15:11 -0300)
KVM_SET_SIGNAL_MASK passed a NULL argument leaves the on stack signal
sets uninitialized. It then passes them through to
kvm_vcpu_ioctl_set_sigmask.

We should be passing a NULL in this case not translated garbage.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
virt/kvm/kvm_main.c

index 246852397e301ee86ac5c40f653e4695eae659a8..d617f69131d7667d3847c7e0fc040a717625bf38 100644 (file)
@@ -1976,9 +1976,10 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
                        if (copy_from_user(&csigset, sigmask_arg->sigset,
                                           sizeof csigset))
                                goto out;
-               }
-               sigset_from_compat(&sigset, &csigset);
-               r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset);
+                       sigset_from_compat(&sigset, &csigset);
+                       r = kvm_vcpu_ioctl_set_sigmask(vcpu, &sigset);
+               } else
+                       r = kvm_vcpu_ioctl_set_sigmask(vcpu, NULL);
                break;
        }
        default: