aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/vmw_vmci/vmci_host.c
diff options
context:
space:
mode:
authorAndy King <acking@vmware.com>2015-02-19 10:33:56 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-25 11:32:15 +0100
commit74b5c297f5ecbef0ca128fa7b385b43f036a7984 (patch)
tree2ee5e039777fbc37ca137bbfa7231b43a81e08eb /drivers/misc/vmw_vmci/vmci_host.c
parentdrivers/vmw_vmci: Show correct get_user_pages_fast upon failure (diff)
downloadlinux-dev-74b5c297f5ecbef0ca128fa7b385b43f036a7984.tar.xz
linux-dev-74b5c297f5ecbef0ca128fa7b385b43f036a7984.zip
VMCI: Check userland-provided datagram size
Ensure that the size filled in by userland in the datagram header matches the size of the buffer passed down in the IOCTL. Note that we account for the size of the header itself in the check. Acked-by: Jorgen Hansen <jhansen@vmware.com> Acked-by: Aditya Sarwade <asarwade@vmware.com> Signed-off-by: Andy King <acking@vmware.com> Reported-by: David Ramos <daramos@stanford.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/vmw_vmci/vmci_host.c')
-rw-r--r--drivers/misc/vmw_vmci/vmci_host.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c
index 66fc9921fc85..a721b5d8a9da 100644
--- a/drivers/misc/vmw_vmci/vmci_host.c
+++ b/drivers/misc/vmw_vmci/vmci_host.c
@@ -395,6 +395,12 @@ static int vmci_host_do_send_datagram(struct vmci_host_dev *vmci_host_dev,
return -EFAULT;
}
+ if (VMCI_DG_SIZE(dg) != send_info.len) {
+ vmci_ioctl_err("datagram size mismatch\n");
+ kfree(dg);
+ return -EINVAL;
+ }
+
pr_devel("Datagram dst (handle=0x%x:0x%x) src (handle=0x%x:0x%x), payload (size=%llu bytes)\n",
dg->dst.context, dg->dst.resource,
dg->src.context, dg->src.resource,