[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0dceaf8c-de35-93d6-f81b-67c2fdebf5ef@redhat.com>
Date: Wed, 29 Jul 2020 17:33:03 +0800
From: Jason Wang <jasowang@...hat.com>
To: "Michael S. Tsirkin" <mst@...hat.com>, linux-kernel@...r.kernel.org
Cc: stable@...r.kernel.org, David Hildenbrand <david@...hat.com>,
Liang Li <liang.z.li@...el.com>,
Wei Wang <wei.w.wang@...el.com>,
virtualization@...ts.linux-foundation.org,
Alexander Duyck <alexander.duyck@...il.com>
Subject: Re: [PATCH] virtio_balloon: fix up endian-ness for free cmd id
On 2020/7/28 上午12: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@...r.kernel.org
> Signed-off-by: Michael S. Tsirkin <mst@...hat.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: Jason Wang <jasowang@...hat.com>
Powered by blists - more mailing lists