From 2e45354645f77e83fe3832f150acdcfeff45f44c Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 29 Aug 2014 11:42:56 +0300 Subject: [PATCH] VMCI: integer overflow in vmci_datagram_dispatch() This is untrusted user data from vmci_host_do_send_datagram() so the VMCI_DG_SIZE() macro can have an integer overflow. Signed-off-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- drivers/misc/vmw_vmci/vmci_datagram.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c index f3cdd904fe4d..822665245588 100644 --- a/drivers/misc/vmw_vmci/vmci_datagram.c +++ b/drivers/misc/vmw_vmci/vmci_datagram.c @@ -328,7 +328,8 @@ int vmci_datagram_dispatch(u32 context_id, BUILD_BUG_ON(sizeof(struct vmci_datagram) != 24); - if (VMCI_DG_SIZE(dg) > VMCI_MAX_DG_SIZE) { + if (dg->payload_size > VMCI_MAX_DG_SIZE || + VMCI_DG_SIZE(dg) > VMCI_MAX_DG_SIZE) { pr_devel("Payload (size=%llu bytes) too big to send\n", (unsigned long long)dg->payload_size); return VMCI_ERROR_INVALID_ARGS; -- GitLab