All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Greg Kurz <gkurz@linux.vnet.ibm.com>,
	kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH] vhost/net: length miscalculation
Date: Wed, 07 Jan 2015 08:09:04 -0700	[thread overview]
Message-ID: <1420643344.6345.7.camel@redhat.com> (raw)
In-Reply-To: <1420620847-24477-1-git-send-email-mst@redhat.com>

On Wed, 2015-01-07 at 10:55 +0200, Michael S. Tsirkin wrote:
> commit 8b38694a2dc8b18374310df50174f1e4376d6824
>     vhost/net: virtio 1.0 byte swap
> had this chunk:
> -       heads[headcount - 1].len += datalen;
> +       heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);
> 
> This adds datalen with the wrong sign, causing guest panics.
> 
> Fixes: 8b38694a2dc8b18374310df50174f1e4376d6824
> Reported-by: Alex Williamson <alex.williamson@redhat.com>
> Suggested-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> 
> Alex, could you please confirm this fixes the crash for you?

Confirmed, this works.  Thanks,

Alex

>  drivers/vhost/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> index 14419a8..d415d69 100644
> --- a/drivers/vhost/net.c
> +++ b/drivers/vhost/net.c
> @@ -538,7 +538,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
>  		++headcount;
>  		seg += in;
>  	}
> -	heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);
> +	heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen);
>  	*iovcount = seg;
>  	if (unlikely(log))
>  		*log_num = nlogs;




  reply	other threads:[~2015-01-07 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-07  8:55 [PATCH] vhost/net: length miscalculation Michael S. Tsirkin
2015-01-07 15:09 ` Alex Williamson [this message]
2015-01-07 15:09 ` Alex Williamson
2015-01-07 20:58 ` Sergei Shtylyov
2015-01-07 20:58 ` Sergei Shtylyov
2015-01-08  8:08   ` Michael S. Tsirkin
2015-01-08  8:08     ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2015-01-07  8:55 Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1420643344.6345.7.camel@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=gkurz@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.