Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1272716pxf; Fri, 12 Mar 2021 06:14:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJwxSv6rPtdKeCOxYClI9W41gnSXpnAlJ/rmDDI28up6MnOYQFWRloELNUYfQX3I2YWb22ct X-Received: by 2002:a17:906:1b54:: with SMTP id p20mr8624830ejg.307.1615558440147; Fri, 12 Mar 2021 06:14:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615558440; cv=none; d=google.com; s=arc-20160816; b=iVZ9FD6nansdcTI3e7c62eF/+IhpueRx6R2bhCSGAGnN0iIKMA5Du/+JL2lfGxavfy s++EHYJ/QdimXMqXqnhsjhXy4yEuuf7+TASoNe6yoUPCdHki4EaOpWonRxkavlSMYCpy YlIuFFVBVj5u1OUr/6qICMRqMLVLplJEsEOdsDFO0vsD2TUK5Zjv0BhvKuXpBUUJVVdS wUlndOkubNrIz/BHsYqUBE01TWelesDXwIshb7Wz9AhpEPUSsIM84KDph7eDwv4ZTdI9 Vygj9RkRoCq1yn4FUOLCqgd6siBPHb5YN0FJqq7EK/kWuAKRoba6s6zRCd2ChLwiaXSj ZMvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sQYoIfj5WQ3gNxzaMGVHtAJ8toU1d/6LwVnCduC2jYw=; b=rRGyJ9WxvYRRsED7YM/GotQxoXl4VOeihSKl46DMkP/PplkcmL6F+rKP0bJZlbJ5RY e9Rwygn9AwjpRlIKVJpl11NxOudJbegq+RXInYPX66VTLR1q7m5oIXvlYBM7i4nXIE6M fn3EZK1LGqXtW9A422lYBpIGb5ZtoTInRUFICh5AwtcAYBPnCXAuj+9rcP4xCKa/29AT K26GOXcH8ILRRbwqJMbrgNF4wCwTOu1U7JYBSpjPq+ZpO6k6gUKD48EpzB0dP8rg4kAu N5KNRMOdH3bb+usSfC/sYsXjHp0xOyUVMakPxuxiFO3t9Uk0vYdnRdnL3wO+80t9yyKS enFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LRFkbdiZ; 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 i2si4005095ejg.669.2021.03.12.06.13.31; Fri, 12 Mar 2021 06:14:00 -0800 (PST) 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=LRFkbdiZ; 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 S231806AbhCLOJs (ORCPT + 99 others); Fri, 12 Mar 2021 09:09:48 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:43849 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbhCLOJW (ORCPT ); Fri, 12 Mar 2021 09:09:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615558162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=sQYoIfj5WQ3gNxzaMGVHtAJ8toU1d/6LwVnCduC2jYw=; b=LRFkbdiZM2Agp62DLBALgezzkAZIvFCe3OWMccp5oNzpOCNqltb445MO/K9xGAfAbIqN1j DniVc7N6C5v0GxMRGuxLH2ncov5fZZZ1ms2czgbtv+of3R/Vo5n1VkG/DVrMS1pf2DUzoZ 6UVkCmr8S+L/xMffbzH9XJ5n8etzoqQ= 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-340-A4vm1f_pNRqwjRFzk--NuQ-1; Fri, 12 Mar 2021 09:09:20 -0500 X-MC-Unique: A4vm1f_pNRqwjRFzk--NuQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3D392EC1A0; Fri, 12 Mar 2021 14:09:19 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-75.ams2.redhat.com [10.36.112.75]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9B52F60877; Fri, 12 Mar 2021 14:09:14 +0000 (UTC) From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, Jason Wang , netdev@vger.kernel.org, "Michael S. Tsirkin" , kvm@vger.kernel.org Subject: [PATCH] vhost: Fix vhost_vq_reset() Date: Fri, 12 Mar 2021 15:09:13 +0100 Message-Id: <20210312140913.788592-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org vhost_reset_is_le() is vhost_init_is_le(), and in the case of cross-endian legacy, vhost_init_is_le() depends on vq->user_be. vq->user_be is set by vhost_disable_cross_endian(). But in vhost_vq_reset(), we have: vhost_reset_is_le(vq); vhost_disable_cross_endian(vq); And so user_be is used before being set. To fix that, reverse the lines order as there is no other dependency between them. Signed-off-by: Laurent Vivier --- drivers/vhost/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index a262e12c6dc2..5ccb0705beae 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c @@ -332,8 +332,8 @@ static void vhost_vq_reset(struct vhost_dev *dev, vq->error_ctx = NULL; vq->kick = NULL; vq->log_ctx = NULL; - vhost_reset_is_le(vq); vhost_disable_cross_endian(vq); + vhost_reset_is_le(vq); vq->busyloop_timeout = 0; vq->umem = NULL; vq->iotlb = NULL; -- 2.29.2