* [patch] VMCI: integer overflow in vmci_datagram_dispatch()
@ 2014-08-29 8:42 Dan Carpenter
2014-08-29 11:13 ` walter harms
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2014-08-29 8:42 UTC (permalink / raw)
To: linux-kernel, George Zhang, Greg Kroah-Hartman; +Cc: kernel-janitors
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>
diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
index f3cdd90..8226652 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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] VMCI: integer overflow in vmci_datagram_dispatch()
2014-08-29 8:42 [patch] VMCI: integer overflow in vmci_datagram_dispatch() Dan Carpenter
@ 2014-08-29 11:13 ` walter harms
2014-08-29 11:21 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: walter harms @ 2014-08-29 11:13 UTC (permalink / raw)
To: Dan Carpenter
Cc: linux-kernel, George Zhang, Greg Kroah-Hartman, kernel-janitors
Am 29.08.2014 10:42, schrieb Dan Carpenter:
> 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>
>
> diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
> index f3cdd90..8226652 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;
Are your sure about that ">" ? maybe ">=" was intended ?
re,
wh
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] VMCI: integer overflow in vmci_datagram_dispatch()
2014-08-29 11:13 ` walter harms
@ 2014-08-29 11:21 ` Dan Carpenter
0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2014-08-29 11:21 UTC (permalink / raw)
To: walter harms
Cc: linux-kernel, George Zhang, Greg Kroah-Hartman, kernel-janitors
On Fri, Aug 29, 2014 at 01:13:47PM +0200, walter harms wrote:
>
>
> Am 29.08.2014 10:42, schrieb Dan Carpenter:
> > 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>
> >
> > diff --git a/drivers/misc/vmw_vmci/vmci_datagram.c b/drivers/misc/vmw_vmci/vmci_datagram.c
> > index f3cdd90..8226652 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;
>
> Are your sure about that ">" ? maybe ">=" was intended ?
Yes, I'm sure. As a rule of thumb, > is used for size comparisons and
>= is used for index comparisons.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-08-29 11:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-29 8:42 [patch] VMCI: integer overflow in vmci_datagram_dispatch() Dan Carpenter
2014-08-29 11:13 ` walter harms
2014-08-29 11:21 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).