Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp5057779pjb; Mon, 27 Jul 2020 11:49:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH5dKLhWzgdL7zRnlR/LhE3apJJp43xTSUj8AzU3JXUYoL93wo30M7rnuwP25HrHjEFMFC X-Received: by 2002:a17:906:178b:: with SMTP id t11mr21592283eje.489.1595875774716; Mon, 27 Jul 2020 11:49:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595875774; cv=none; d=google.com; s=arc-20160816; b=VnGEHX88w4+u1UPMk9oOWPnfgtf1WMZ02xPy5PwWy/faFYGqrRVBcGL1UaGvRb4+5H HKbbkHY7v80qk7uZwmFiWseu4BuOwPpjAyxDrB2ocYYQmWTBOxMYyKDUB1Nt5xcEd/JN 7PYRvxXtxTm0o7iXL7plw8Gh/EheKozLIpYVMbHEZ6IeCba98IeH5SSI/fPq++MTw8ha j8gOqmLFhUBVAUxndQ0LU1bsKQ83sdO76biMtW/ksVt+qTSVne2M/ooTf96wUt4UasSf jEIDIEH0cbpTU+poBzfCfhlqXqb/5km8GRjJv1GfFG78nM7OQIFTdMqSW9DkMr+uYIEN nE9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=PzdX7wVbIx8ObG6INsApXS+qCsher40rhMpcw3UMWXc=; b=t/c9Mex3DsYK90yfeykTZjTnORkKuUq2SPMaXRf1djMmx8RUnAZfY594B+DZMZWzNp ulV5Y5gtpV3KRbg+h7+h11IcsIw5yAJxsXZqE4ShyoFS0qkaji/UnbnHu/WKLN614BYs 07gYlAAUAXBZfhXQkr86nT9OscLxDyDiTEokzd2JFGN8W9SErQNotNNlXKEf1zXnNKfA hiwU7+L8+HwS5NofUrXuK/VlHkozkAyODyt2Qrs+833ce/EuFzofRJHWP4W8f1aMUoH7 82LNPQfVJQSnGwrACHFFKPu75TumrshBMc0c2wtAdrYnAPE6/1zjsDOKxvH/zUk7XRm3 WHFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fRWep9/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gh11si6153383ejb.442.2020.07.27.11.49.12; Mon, 27 Jul 2020 11:49:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="fRWep9/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727852AbgG0QDw (ORCPT + 99 others); Mon, 27 Jul 2020 12:03:52 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:29640 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727116AbgG0QDw (ORCPT ); Mon, 27 Jul 2020 12:03:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595865830; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=PzdX7wVbIx8ObG6INsApXS+qCsher40rhMpcw3UMWXc=; b=fRWep9/eDzx7Ww6z4zN62m+rTnXBNTYCOg7UuWVuOsuPf17ojus0npnfFNslirEqNBp0GD DhxnNcqh91EVD4gIY0ZAV6TvzGjcDazOfwHY04iqlTfr5Sai/0tcf0mS75P2YPjXMjF7BH 12Xh1PcEEYssn4/Mk/n9R2d6eyic8TA= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-130-xNh-l0k5P1acssznhjs_Xg-1; Mon, 27 Jul 2020 12:03:48 -0400 X-MC-Unique: xNh-l0k5P1acssznhjs_Xg-1 Received: by mail-wr1-f69.google.com with SMTP id h4so4107705wrh.10 for ; Mon, 27 Jul 2020 09:03:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=PzdX7wVbIx8ObG6INsApXS+qCsher40rhMpcw3UMWXc=; b=WKrmNfNY7dq9ev+VdDCi/PN5EjQXTIOg/gkgDssVOH7nLwSy0Yhq59o6wTj6ZuxSw0 dEqGaB/PzQWX0XRB6d3MNCQFVIcviYXNyHyI4+g6W/0HbC8X15Mo6o30ZJ1fHRkxWmNe MDZ+ZVLR/rthVRHwyXRMzQ0M1TlfrAKl3KKTyAztxMHwXkTwdQFtNj+HDSKP5nNRxcRt IZKgBPvu0Y1FuF6f+WnajthnulDPXHjVb3Wl8GfD+i7vakQeQxVYellWKQ/U56NkESZu 4OSNdf3lDywk93vg+B1zKwEOZsAGuIrizTy37D8W0Q793ZkXEhruLRUlcsXpk7vmsKmr xfvA== X-Gm-Message-State: AOAM5324rijOkNKAcGdUYsED1nS8/xvu62d6+fSy9RM7uqKdSvtmqZEr J1cKl2hyMKJC7m7j7qjC2YQ5W7jaJbiiZTbU+Nf2OVMrVHABzczwjpNivD81km+4G5ouXnonUiP SWmQ+iNdCJdmhYfut8aXE7ErI X-Received: by 2002:adf:b1cf:: with SMTP id r15mr22476416wra.118.1595865827382; Mon, 27 Jul 2020 09:03:47 -0700 (PDT) X-Received: by 2002:adf:b1cf:: with SMTP id r15mr22476396wra.118.1595865827149; Mon, 27 Jul 2020 09:03:47 -0700 (PDT) Received: from redhat.com ([192.117.173.58]) by smtp.gmail.com with ESMTPSA id z63sm111712wmb.2.2020.07.27.09.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jul 2020 09:03:46 -0700 (PDT) Date: Mon, 27 Jul 2020 12:03:43 -0400 From: "Michael S. Tsirkin" To: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, David Hildenbrand , Jason Wang , Liang Li , Wei Wang , virtualization@lists.linux-foundation.org, Alexander Duyck Subject: [PATCH] virtio_balloon: fix up endian-ness for free cmd id Message-ID: <20200727160310.102494-1-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; } -- MST