VMCI: integer overflow in vmci_datagram_dispatch()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 29 Aug 2014 08:42:56 +0000 (11:42 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Sep 2014 06:26:42 +0000 (23:26 -0700)
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 <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/vmw_vmci/vmci_datagram.c

index f3cdd904fe4d6e1ae5c48288858d793dbc0af22c..822665245588767bbbabc0cf3b4a4c47c4f044e3 100644 (file)
@@ -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;