Skip to contentSkip to conversation

kvm: Fix nonsense handling of compat ioctl

PATCH Applied Alan Cox 2 participants 2 messages Aug 22, 2012 – Aug 26, 2012 KVM

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH v2 1/1 kvm: Fix nonsense handling of compat ioctl

From: Alan Cox <[email protected]>

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.

---

 virt/kvm/kvm_main.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
virt/kvm/kvm_main.c +4 -3
index a2e85af..cd1fde9a 100644
@@ -1975,9 +1975,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:
#1 lore raw
Quoted 9 lines · Alan Cox

From: Alan Cox <[email protected]>

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.

Applied, thanks.