linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	Liang Li <liang.z.li@intel.com>, Wei Wang <wei.w.wang@intel.com>,
	virtualization@lists.linux-foundation.org,
	Alexander Duyck <alexander.duyck@gmail.com>
Subject: Re: [PATCH] virtio_balloon: fix up endian-ness for free cmd id
Date: Mon, 27 Jul 2020 18:56:17 +0200	[thread overview]
Message-ID: <15ac104a-d5dc-00a6-f327-314131dd1930@redhat.com> (raw)
In-Reply-To: <20200727160310.102494-1-mst@redhat.com>

On 27.07.20 18:03, Michael S. Tsirkin wrote:
> free cmd id is read using virtio endian, spec says all fields
> in balloon are LE. Fix it up.
> 
> Fixes: 86a559787e6f ("virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT")
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  drivers/virtio/virtio_balloon.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 774deb65a9bb..798ec304fe3e 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -578,10 +578,14 @@ static int init_vqs(struct virtio_balloon *vb)
>  static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
>  {
>  	if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
> -			       &vb->config_read_bitmap))
> +			       &vb->config_read_bitmap)) {
>  		virtio_cread(vb->vdev, struct virtio_balloon_config,
>  			     free_page_hint_cmd_id,
>  			     &vb->cmd_id_received_cache);
> +		/* Legacy balloon config space is LE, unlike all other devices. */
> +		if (!virtio_has_feature(vb->vdev, VIRTIO_F_VERSION_1))
> +			vb->cmd_id_received_cache = le32_to_cpu((__force __le32)vb->cmd_id_received_cache);
> +	}
>  
>  	return vb->cmd_id_received_cache;
>  }
> 

Acked-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2020-07-27 16:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 16:03 [PATCH] virtio_balloon: fix up endian-ness for free cmd id Michael S. Tsirkin
2020-07-27 16:56 ` David Hildenbrand [this message]
2020-07-28  6:37 ` Wei Wang
2020-07-29  9:33 ` Jason Wang

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=15ac104a-d5dc-00a6-f327-314131dd1930@redhat.com \
    --to=david@redhat.com \
    --cc=alexander.duyck@gmail.com \
    --cc=jasowang@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.w.wang@intel.com \
    /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 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).