Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp975917ybg; Wed, 29 Jul 2020 02:35:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2CKSYmSQkHJNj6GE+zem/oGj8gV0Ujxnw2h2MynlMOw9fB9AgHJjp0H04WYtFXo/CwIvM X-Received: by 2002:a17:906:1c56:: with SMTP id l22mr14883681ejg.84.1596015319293; Wed, 29 Jul 2020 02:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596015319; cv=none; d=google.com; s=arc-20160816; b=wnhihrHQ1JkxS6fhs+f3yfF5Y619T0K3/7fj4e5SZidl87WT9xjPU9bj5/SjKQJ4EQ Q0h9PwYqsiuYxXF+Ru9RFWKjPcYVBWBE+3XnOG+NZNivbR56kouWe38Ev1p4sBND8nAm xzjdvc0M4WOoxHMdRd8VOHmyrnnCYLco4EyqzXebMHwwOlJP/ZgHj9N4tRGEZgi5ObJF tKLeegcvxzzxGcp4exQPE+l++/DtzVnFRkoO8NWJJpHf+1+VhaJDZ2fLGgCStGESJb13 Fqr2GI34yVM+gt5wRHMYg6xZifJYJB4MYBt/Cg1trHUQnxvaH0Ppvw/Y4H/xJTIImZyD 8xtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=NcytAw49Ogv+T6nX8O+DUO/ud353HRXDgEw6dxPF2is=; b=oMTaRiAzXR+eypQMIlAyVeuNPv7U0hVLHa5HEBXwTzH6HAUKEcqajk2qtFueLKH5lh gIvsv4ddLoveWeQyCKZbCVqGw04gGsTnpvOux0uPeErkK0Lcu4Bmtle1v6aS32k6OML9 AULPbas8i3zH/r+8h3eOomnIfOpJZi3N9B659PIjV2SMuizZIPIkzHKRy5nbefWGPNok AmvvzB/teijfgKwfyq71eEuYoGAjLVklxloobLpkUg84XDzpxXbfm4GOIs/Uj2ulggIP Uc8UTix30syY2JHHub31nRWl/vWBpgog4g5eqDvfgGQ4z/rtgi70Zplq68f38A/Ni0OQ 8z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F4+6Si+X; 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 i28si1065393edj.373.2020.07.29.02.34.55; Wed, 29 Jul 2020 02:35:19 -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=F4+6Si+X; 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 S1727844AbgG2Jdy (ORCPT + 99 others); Wed, 29 Jul 2020 05:33:54 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:51771 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbgG2Jdx (ORCPT ); Wed, 29 Jul 2020 05:33:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596015232; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NcytAw49Ogv+T6nX8O+DUO/ud353HRXDgEw6dxPF2is=; b=F4+6Si+XQDWskJTMdGhm3TRK8ydUqS0364w9mXolDuM6CVG/8CP+et2QEZqQ0lq/BgsI0E fMpvC0MueoZdryp3edvaOjA9x/yPeO0RSOOJybdheVpPbOGz4/i584QQBh59rBBXl8VYsu sgYk8m1xbAiPSTc3PkvuPyU6cE2kVvU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-474-IqC2wmCtN_6Xj1-G6eL3FQ-1; Wed, 29 Jul 2020 05:33:33 -0400 X-MC-Unique: IqC2wmCtN_6Xj1-G6eL3FQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5207980183C; Wed, 29 Jul 2020 09:33:32 +0000 (UTC) Received: from [10.72.13.120] (ovpn-13-120.pek2.redhat.com [10.72.13.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F0F6512FE; Wed, 29 Jul 2020 09:33:05 +0000 (UTC) Subject: Re: [PATCH] virtio_balloon: fix up endian-ness for free cmd id To: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org, David Hildenbrand , Liang Li , Wei Wang , virtualization@lists.linux-foundation.org, Alexander Duyck References: <20200727160310.102494-1-mst@redhat.com> From: Jason Wang Message-ID: <0dceaf8c-de35-93d6-f81b-67c2fdebf5ef@redhat.com> Date: Wed, 29 Jul 2020 17:33:03 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200727160310.102494-1-mst@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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@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; > } Acked-by: Jason Wang